【发布时间】:2011-11-01 00:53:41
【问题描述】:
我正在尝试获得与http://jssha.sourceforge.net/ 相同的结果
在哪里
我对“测试”这个词有疑问:
var word = 'testing';
var hex = toHex(word); // '740065007300740069006e006700';
在选择 input type作为 hex variable和sha-512的值时,在jssha上,我得到以下结果:
6e42b2c2a6351036b78384212774135d99d849da3066264983e495b5f74dc922e3d361b8ea9c8527169757233ed0bd4e56b2c42aab0a21bbcca67219dc53b472
虽然我无法使用nodejs crypto module 获得相同的结果。
require('crypto').createHash('sha512').update(hex).digest('hex')
输出:
9ad6d9053c6c420fe61ec2fffd094e3a325bc71708e18232fd764a5eb30315e38464e620ef0b55b92fbf6c809838652a72d9412b0398b28d61ca432962451de2
所以我想知道如何使用加密模块获得与jssha 相同的结果?
谢谢
【问题讨论】:
标签: javascript node.js cryptography hex sha512