Tag: sha512

在node.js中validation来自PHP的SHA512哈希

我试图从PHP到Javascript(node.js)端口传统的密码哈希scheme,但我在这个过程中缺less的东西。 原始的,工作的PHP版本 这里是“原始”,工作代码: function create_hash($password) { $salt = uniqid(); $algorithm = '6'; // CRYPT_SHA512 $rounds = '1234'; // This is the "salt" string we give to crypt(). $cryptSalt = '$' . $algorithm . '$rounds=' . $rounds . '$' . $salt; $hashedPassword = crypt($password, $cryptSalt); return $hashedPassword; } function hash_is_valid($password, $hash) { return (crypt($password, $hash) == […]

Nodejsencryption与Python hashlib

我试图做一个Python函数和nodejs函数计算相同的散列。 但是,好像输出的二进制文件在nodejsencryption和python hashlib之间是不同的。 我正在使用的python是: hash = hashlib.sha512() hash.update(salt) hash.update(password.encode('utf8')) hash.digest() 节点/咖啡文本是: crypto.createHash('sha512').update(salt, 'binary').update(password, 'utf8').digest() 这些线应该产生相同的结果,但由于某些原因,他们不。 帮帮我?

(Not-so)聪明钥匙导致Node JS中的SHA512 Hmac问题

这是一个古怪的问题,但我一直在这个工作几个小时,并没有取得很大的进展。 我希望这里有人能够build议… 我正在移植一个脚本从PHP到节点。 php脚本使用这个函数: hash_hmac('sha512', $text, $key); 我已经在使用encryption模块的节点中再现了这一点: var hash = crypto.createHmac( "sha512", key ); hash.update( text ); return hash.digest( "hex" ); 我已经证实,当给定相同的文本和密钥时,这些函数产生相同的散列。 除… 在php中用于键的string看起来类似于:(不要问) define("SITE_KEY", " __ , ,' e`—o (( ( | ___,' \\~——————————-' \_;/ ( / /) ._______________________________. ) (( ( (( ( “-' “-' "); 我试图在Javascript中重现这一点,就像这样: var key = "\ __\ […]