forked from tornado-packages/noble-curves
modular: bring back 1.1.0 hashToPrivateScalar for clean diff
This commit is contained in:
parent
ca99179bd8
commit
f049398718
@ -420,9 +420,9 @@ export function hashToPrivateScalar(
|
||||
): bigint {
|
||||
hash = ensureBytes('privateHash', hash);
|
||||
const hashLen = hash.length;
|
||||
const minLen = nLength(groupOrder).nByteLength + 8; // 8b (64 bits) gives 2^-64 bias
|
||||
const minLen = nLength(groupOrder).nByteLength + 8;
|
||||
if (minLen < 24 || hashLen < minLen || hashLen > 1024)
|
||||
throw new Error(`expected ${minLen}-1024 bytes of input, got ${hashLen}`);
|
||||
throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);
|
||||
const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);
|
||||
return mod(num, groupOrder - _1n) + _1n;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user