feat: replace js-sha512 with @noble/hashes for SHA-512 implementation and update related logic
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import type { RNG } from './RNG.js';
|
||||
|
||||
import { sha512 } from 'js-sha512';
|
||||
|
||||
import { convertBytesLikeToUint8Array } from './convertBytesLikeToUint8Array.js';
|
||||
import type { BytesLike } from './BytesLike.js';
|
||||
import { sha512ArrayBuffer } from './sha512.js';
|
||||
|
||||
const maxRngSupportBit = 53;
|
||||
const maxInt = 0x1f_ffff_ffff_ffff; // NOTE: b 0, 10000110011, 11...11
|
||||
@@ -111,7 +110,7 @@ export class LiteHashDRBG implements RNG {
|
||||
|
||||
protected genNextBlock(): void {
|
||||
this.hq.setUint32(this.hqIdxPos, this.stateIdx, true);
|
||||
const digest = sha512.arrayBuffer(this.hq.buffer as ArrayBuffer);
|
||||
const digest = sha512ArrayBuffer(this.hq.buffer as ArrayBuffer);
|
||||
this.buffer = digest;
|
||||
this.bufferIdx = 0;
|
||||
this.stateIdx += 1;
|
||||
|
||||
Reference in New Issue
Block a user