Closed makepanic closed 10 years ago
Reading your script, you have a function called hex2bin and you pass its output to jsSHA with type "TEXT" If you just pass the string as-is (without hex2bin) and set its type to "HEX" you should be set.
Thanks it now works fine. The strange thing is that using the pastebin implementation of jsSha in the browser it works fine:
https://github.com/makepanic/globe/blob/master/src/js/helpers/util.js#L23
guess this can be closed
I honestly have no idea how it would have worked in the browser as it is currently written.
It looks like you may be using a slightly order version of the library. The most recently version (1.5) has slightly better Node support and I shrunk the file size quite a bit. Also, it has the ability to output uppercase HEX strings.
Let me know if you have any more problems!
I've tried to use the jsSHA SHA-1 implementation in node but had a weird bug. An earlier implementation of the same method in the browser works as expected.
I wrote a small nodeunit test that uses jsSHA and node crypto to hash the same input.
Running the script in nodeunit I get:
If there's something wrong with the implementation just tell me :+1: