Cryto.createhash Sha512 With Hexdigest Input Type
I am trying to get the same result I obtain at http://jssha.sourceforge.net/ where I have the word 'testing' in question: var word = 'testing'; var hex = toHex(word); // '740065007
Solution 1:
"testing" in hex is 74657374696e67 if you use utf8 which is pretty much standard. What your toHex method returns assumes utf16.
For that hash, the website says:
521b9ccefbcd14d179e7a1bb877752870a6d620938b28a66a107eac6e6805b9d0989f45b5730508041aa5e710847d439ea74cd312c9355f1f2dae08d40e41d50
Do this in node.js to hash a hex string:
require('crypto').createHash('sha512').update(
newBuffer("74657374696e67", "hex")
).digest('hex')
Node gives you the same hash. Oh, and this also gives you the same hash:
require('crypto').createHash('sha512').update("testing").digest('hex')
Post a Comment for "Cryto.createhash Sha512 With Hexdigest Input Type"