We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b71499 commit 845bbfcCopy full SHA for 845bbfc
packages/rln/src/utils/bytes.ts
@@ -56,17 +56,16 @@ export function writeUIntLE(
56
return buf;
57
}
58
59
-/**
60
- * Transforms Uint8Array into BigInt
61
- * @param array: Uint8Array
62
- * @returns BigInt
63
- */
64
export function buildBigIntFromUint8Array(
65
array: Uint8Array,
66
byteOffset: number = 0
67
): bigint {
68
- const dataView = new DataView(array.buffer);
69
- return dataView.getBigUint64(byteOffset, true);
+ // Use all bytes from byteOffset to the end, little-endian
+ let hex = "";
+ for (let i = array.length - 1; i >= byteOffset; i--) {
+ hex += array[i].toString(16).padStart(2, "0");
+ }
+ return BigInt("0x" + hex);
70
71
72
/**
0 commit comments