Closed jsanta closed 7 years ago
That's obvious. echo
appends a new line. Try this one:
echo -n 'Hola mundo' | openssl dgst -sha256
(stdin)= ca8f60b2cc7f05837d98b208b57fb6481553fc5f1219d59618fd025002a66f5c
@pohutukawa didn't see it so obvious, but thanks :) I finally fixed this by retrieving my file and doing:
var _hash = new TextEncoder('UTF-8').encode(response.data);
_hash = asmCrypto.SHA256.hex(_hash);
On my terminal:
[12:58:46] → echo 'Hola mundo' | openssl dgst -sha256 9797b1e9be5a424f3f94392a8102a6c247a533d2d6e287d038c104f325e84fdb
On the browser:
asmCrypto.SHA256.hex('Hola mundo') "ca8f60b2cc7f05837d98b208b57fb6481553fc5f1219d59618fd025002a66f5c"
Can't figure out if it's my mistake and I'm calling ther wrong method or if there's another setting for this to work as expected.