简体   繁体   English

需要一种在vba中模拟PHP crypt()函数的方法

[英]Need a way to emulate PHP crypt() Function in vba

I have this function in PHP 我在PHP中有此功能

public function hashPassword($password) {
    return crypt($password, '$2a$07$twfAAA1954npfBBB1982oo');
}

It have stored passwords in a DB. 它已将密码存储在数据库中。 and I am converting this DB to use Access as a front end instead of PHP and HTML. 并且我正在将该数据库转换为使用Access作为前端而不是PHP和HTML。 I need VBA / vbscript code that will convert an entered password and if it is the same password, match the output from the above function. 我需要VBA / vbscript代码,它将转换输入的密码,如果密码相同,则匹配上述功能的输出。

I have tried all normal hash algorithms and none of them work. 我已经尝试了所有普通的哈希算法,但没有一个起作用。 I'm not sure how the crypt function works, but it appears to have some sort of seed value which is '$2a$07$twfAAA1954npfBBB1982oo' plus the password. 我不确定crypt函数的工作方式,但是它似乎具有某种种子值,即'$2a$07$twfAAA1954npfBBB1982oo'和密码。 Then it probably uses some standard hash algorithm. 然后,它可能使用一些标准的哈希算法。

Can some one give me the code, or at least tell me how the crypt function uses that seed value so that i can recreate the crypt() function in vba? 有人可以给我代码,或者至少告诉我crypt函数如何使用该种子值,以便我可以在vba中重新创建crypt()函数吗?

I found the source code for the crypt function but I'm not strong enough in my knowledge of PHP to understand what really is going on. 我找到了crypt函数的源代码,但是我对PHP的了解不够深,无法理解真正的情况。

About the original function: http://php.net/crypt So it uses the string you mention as a salt. 关于原始功能: http : //php.net/crypt因此它使用您提到的字符串作为盐。 And the algorithm is: CRYPT_BLOWFISH 算法是:CRYPT_BLOWFISH

And there a few blowfish implementations in VB: VB中有一些河豚实现:

After digging deeper i found that crypt is using blowfish. 深入研究后,我发现土窖正在使用河豚。

But i can't seem to get the values to match up using the blow fish algorithms. 但是我似乎无法使用打击鱼算法来获得与之匹配的值。 can you help make sense of this. 你能帮我弄清楚这一点吗?

the password is: Truck0409! 密码是:Truck0409! the salt is: $2a$07$twfAAA1954npfBBB1982oo and the stored password returned from crypt function is:$2a$07$twfAAA1954npfBBB1982oeksSlrRQpws2mkzTSloxQRt4QivN4wha 盐是:$ 2a $ 07 $ twfAAA1954npfBBB1982oo并且从密码函数返回的存储密码是:$ 2a $ 07 $ twfAAA1954npfBBB1982oeksSlrRQpws2mkzTSloxQRt4QivN4wha

if you enter in the password and salt in http://www.functions-online.com/crypt.html 如果您在http://www.functions-online.com/crypt.html中输入密码和密码

you get the same result, but i can not get it to work on any blowfish encrypters like: http://webnet77.com/cgi-bin/helpers/blowfish.pl 您得到相同的结果,但我无法在任何河豚加密器上使用它,例如: http : //webnet77.com/cgi-bin/helpers/blowfish.pl

So i till i can get the same result from using the blow fish encrypters i dont want to waste my time looking up blowfish algorithms in vba. 因此,直到我使用河豚鱼加密器得到相同的结果,我都不想浪费时间在vba中查找河豚算法。 Can anyone explain how to get the same result using blowfish? 谁能解释如何使用河豚鱼获得相同的结果?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM