需要的库CryptoJS/rollups/sha1.jsCryptoJS/components/lib-typedarrays-min.jshash: (fobj, callback_end, callback_progress)-> blob = new Blob() read = 0 unit = 1024 * 1024 sha1 = CryptoJS.algo.SHA1.create() reader = new FileReader() reader.onload = (e)-> bytes = CryptoJS.lib.WordArray.create(new Uint8Array(e.target.result)) sha1.update bytes read += unit if read < fobj.size callback_progress read / fobj.size blob = fobj.slice read, read + unit reader.readAsArrayBuffer blob else hash = sha1.finalize() callback_progress 1 callback_end hash.toString(CryptoJS.enc.Hex) @processing = false reader.readAsArrayBuffer fobj.slice(read, read + unit)
JS SHA1 文件 函数
<span title='2015-05-24 18:45:00 +0000 UTC'>2015/05/24 May</span> · 1 min · 68 words · map[name:SCys uri:]