Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Dec 2, 2022
1 parent 770f8a3 commit 1ed91d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/_sha2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export abstract class SHA2<T extends SHA2<T>> extends Hash<T> {
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
this.process(view, 0);
const oview = createView(out);
const oLen = this.outputLen;
if (oLen % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');
const outLen = oLen / 4;
const len = this.outputLen;
if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');
const state = this.get();
const outLen = len / 4;
if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');
for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
}
Expand Down

0 comments on commit 1ed91d9

Please sign in to comment.