admin管理员组

文章数量:1278859

anyone know how to get file MD5 from Filereader readAsArrayBuffer() ?

my current solution is using CryptoJS

  1. convert arraybuffer to base64
  2. decode base64 to binary string.
  3. use CryptoJS.MD5(p_str).toString(CryptoJS.enc.Hex).toUpperCase();

this method get me correct MD5 but I hope to skip the part decode the base64. the suggestions I found is using readAsBinaryString() which deprecated function.

anyone know how to get file MD5 from Filereader readAsArrayBuffer() ?

my current solution is using CryptoJS

  1. convert arraybuffer to base64
  2. decode base64 to binary string.
  3. use CryptoJS.MD5(p_str).toString(CryptoJS.enc.Hex).toUpperCase();

this method get me correct MD5 but I hope to skip the part decode the base64. the suggestions I found is using readAsBinaryString() which deprecated function.

Share Improve this question asked Feb 25 at 8:43 Charles CandyCharles Candy 275 bronze badges 1
  • I think you got the best possible way. You could create an ExtJS class, but otherwise you are good – Dinkheller Commented Mar 1 at 11:52
Add a comment  | 

1 Answer 1

Reset to default 0

thanks. someone suggest sparkmd5 which calculate md5 from array buffer which is working.

SparkMD5.ArrayBuffer.hash(e.target.result)

本文标签: javascripthow to get file MD5 from FileReader readAsArrayBuffer()Stack Overflow