emn178 / js-sha3

A simple SHA-3 / Keccak hash function for JavaScript supports UTF-8 encoding.
MIT License
345 stars 85 forks source link

SHA3 for Binary File #2

Closed HKWhyIP closed 9 years ago

HKWhyIP commented 9 years ago

Hi,

I am using FileReader.readAsArrayBuffer to read contents of a binary file. How should I convert the arraybuffer to the format (UTF8 or ASCII?) that will work with js-sha3?

Thanks

Ken

emn178 commented 9 years ago

Hi,

I just added this feature. It supports ArrayBuffer now, and you can try it.

Best regards.

HKWhyIP commented 9 years ago

Thanks for the prompt update.

I have tried using ArrayBuffer but the hash result is different from the hash code generated by crypto-js (I have used other tools to verify the hash code generated by crypto-js). You can see my program at http://jsfiddle.net/chitester11/x8774oys/3/.

Do I use the correct format of the ArrayBuffer?

Thanks for your help in advance.

Ken

emn178 commented 9 years ago

Hi,

Sorry, there was a bug, and I fixed it now.

Best regards.

HKWhyIP commented 9 years ago

Hi,

It works now! You can test it at: http://jsfiddle.net/x8774oys/4/. It can be 20 times faster than Crypto-js!

Excellent work!

Thanks

Ken