From eaa4aada1897fad424f5a5c86ddbfcbf52fea5d4 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 20 Jun 2026 22:27:21 -0700 Subject: [PATCH] Deprecate unused functions. --- src/utils/bigint.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/utils/bigint.ts b/src/utils/bigint.ts index 3360b88..10db9ee 100644 --- a/src/utils/bigint.ts +++ b/src/utils/bigint.ts @@ -22,15 +22,6 @@ export function bigintAsUintNArray (int: bigint, bits: number, length: number = return uintArray } -export function bigintBitLength (int: bigint): bigint { - let bitLength = 1n - while (int > 1n || int < -1n) { - bitLength++ - int >>= 1n - } - return bitLength -} - export function bigintByteLength (int: bigint): number { let byteLength = 0 while (int > 0n || int < -1n) { @@ -66,26 +57,6 @@ export function bigintFrom (value: bigint | boolean | number | string | unknown, throw new TypeError(`can't convert string to BigInt`) } -export function bigintRandom (max: bigint = 0xFFFFFFFFFFFFFFFFn): bigint { - if (typeof max !== 'bigint' || max < 1n) { - throw new TypeError('Invalid max value') - } - const randomUint8Array = new Uint8Array(bigintByteLength(max)) - const mask = (1n << bigintBitLength(max)) - 1n - let output = 0n - do { - output = 0n - crypto.getRandomValues(randomUint8Array) - output = BigInt(randomUint8Array[0]) - for (let i = 1; i < randomUint8Array.length; i++) { - output <<= 8n - output += BigInt(randomUint8Array[i]) - } - output &= mask - } while (output > max) - return output -} - export function bigintToHex (int: bigint, length: unknown = 0): string { if (typeof length !== 'number') { throw new TypeError('invalid length') -- 2.52.0