From 9574a28fd8b1ffdc05554e1e0dc16c48b60c632e Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 21 Nov 2024 10:27:52 +0000 Subject: [PATCH] utils.bytesToHex: small change --- src/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index d656e66..d5e4e51 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -38,11 +38,11 @@ export function bytesToHex(bytes: Uint8Array): string { } // We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 } as const; +const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const; function asciiToBase16(ch: number): number | undefined { if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48 - if (ch >= asciis._A && ch <= asciis._F) return ch - (asciis._A - 10); // 'B' => 66-(65-10) - if (ch >= asciis._a && ch <= asciis._f) return ch - (asciis._a - 10); // 'b' => 98-(97-10) + if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10) + if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10) return; }