Reverse byte order when converting to/from hex strings (#161)

This commit is contained in:
Jeffrey Dallatezza
2025-03-14 13:00:45 -07:00
committed by GitHub
parent c2810e1cda
commit e9ff4677af
+2 -2
View File
@@ -42,7 +42,7 @@ export function deepEqual(obj1: any, obj2: any): boolean {
export function uint8ArrayToHexString(array: Uint8Array): string {
return Array.prototype.map
.call(array, x => ('00' + x.toString(16)).slice(-2))
.call(array.reverse(), x => ('00' + x.toString(16)).slice(-2))
.join('');
}
@@ -69,7 +69,7 @@ export function hexStringToUint8Array(str: string): Uint8Array {
if (data.length != 32) {
return new Uint8Array(0);
}
return data;
return data.reverse();
}
export function hexStringToU128(str: string): bigint {