Advertisement
krot

sha1 file

Aug 5th, 2021
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  var reader = new FileReader();
  2.                     reader.onload = (e) => {
  3.                             var hash =  CryptoJS.SHA1(this.arrayBufferToWordArray(e.target.result)).toString();
  4.                          
  5.                     }
  6. reader.readAsArrayBuffer(this.profile_file);
  7.  
  8. arrayBufferToWordArray:function(ab) {
  9.             var i8a = new Uint8Array(ab);
  10.             var a = [];
  11.             for (var i = 0; i < i8a.length; i += 4) {
  12.             a.push(i8a[i] << 24 | i8a[i + 1] << 16 | i8a[i + 2] << 8 | i8a[i + 3]);
  13.             }
  14.             return CryptoJS.lib.WordArray.create(a, i8a.length);
  15.         },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement