mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 08:43:09 +00:00
chore: use big endian
This commit is contained in:
parent
b53ba62209
commit
f911bf8cfa
@ -61,9 +61,13 @@ export function writeUIntLE(
|
||||
* @param array: Uint8Array
|
||||
* @returns BigInt
|
||||
*/
|
||||
export function buildBigIntFromUint8Array(array: Uint8Array): bigint {
|
||||
export function buildBigIntFromUint8Array(
|
||||
array: Uint8Array,
|
||||
byteOffset: number = 0
|
||||
): bigint {
|
||||
// Use all bytes from byteOffset to the end, big-endian
|
||||
let hex = "";
|
||||
for (let i = array.length - 1; i >= 0; i--) {
|
||||
for (let i = byteOffset; i < array.length; i++) {
|
||||
hex += array[i].toString(16).padStart(2, "0");
|
||||
}
|
||||
return BigInt("0x" + hex);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user