indutny / hash.js

Hash functions in pure javascript
318 stars 43 forks source link

Fix utf8 character handling #22

Closed kachkaev closed 5 years ago

kachkaev commented 5 years ago

This PR brings parity between hash.js and Node.js crypto module, which is crucial for distributed systems. Prior to the fix, utf8 characters were not correctly converted to a byte array and this produced different hash values compared to what crypto's functions did.

Fixes https://github.com/indutny/hash.js/issues/20

I had to remove Node 4 from Travis as it was failing anyway. This Node version reached its end of life half a year ago, so hope this is fine. Testing for Node 8 and 10 was added.

It'd be great if the patch was released as v2.0.0 as it imposes a breaking change to the hash outputs. We should also describe the changes on the releases page to help folks with upgrading.

indutny commented 5 years ago

Published in 1.1.6

kachkaev commented 5 years ago

OK, thank you for being so responsive! 🎉

Hope that versioning it as 1.1.6 instead of 2.0.0 won't magically break too many things! 😬 🤞

indutny commented 5 years ago

We can always revert it :grin:

indutny commented 5 years ago

Thanks for the patch!