You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
I am trying to migrate from node-forge to blueimp-mp5 + web crypto api.
I created test script:
` var hex = 'B955EF8C83544AD74F803321866F005A';
var bytesStr = forge.util.hexToBytes(hex);
var data = bytesStr;
var h1 = forge.md.md5.create().start().update(data).digest().getBytes();
var h2 = md5(data, null, true);
console.log("H1: ", h1);
console.log("H2: ", h2);`
If 'data' is normal string, everything seems to work fine. But if 'data' is binary (like in example), hashes are different.
Am I doing something wrong or is it bug please?
Activity
blueimp commentedon Sep 6, 2020
The input to the
md5function is always expected to be a string:https://github.com/blueimp/JavaScript-MD5/blob/master/README.md#api
This project was developed as a cross-browser MD5 library that also works in NodeJS and was built before ArrayBuffer was widely available.
If you need support for non-string inputs, you probably want to use a different implementation.
qilx commentedon Sep 11, 2020
Here is example rewritten to use 'atob' to get input data. This function returns string.
BinBashBanana commentedon Apr 24, 2021
You could use something like,
Pass a Uint8Array to btou, and it will return a UTF-8 string.