This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { lib as CryptoLib, SHA256 } from 'crypto-js' | |
const arrayBufferToWordArray = (ab: any) => { | |
const i8a = new Uint8Array(ab) | |
const a = [] | |
for (let i = 0; i < i8a.length; i += 4) { | |
a.push((i8a[i] << 24) | (i8a[i + 1] << 16) | (i8a[i + 2] << 8) | i8a[i + 3]) | |
} | |
return CryptoLib.WordArray.create(a, i8a.length) | |
} |