How to read a binary file with FileReader in order to hash it with SHA-256 in CryptoJS?
问题 how do I convert a UTF-8 string to Latin1 encoded string using javascript? Here is what I am trying to do: I get a file, split that in chunks by reading as arraybuffer then, I parse the arraybuffer as string and passing it to cryptoJS for hash computation using following code: cryptosha256 = CryptoJS.algo.SHA256.create(); cryptosha256.update(text); hash = cryptosha256.finalize(); It all works well for a text file. I get problems when using the code for hashing a non-text files (image/.wmv