From 4ca653217158de5ee7a0889cb3deadd590e56324 Mon Sep 17 00:00:00 2001 From: dapplion Date: Wed, 25 Nov 2020 17:57:33 +0000 Subject: [PATCH] Use toBuffer to prevent allocation --- src/helpers/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index 683b098..d69ae97 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -13,7 +13,7 @@ export function bytesToHex(bytes: Uint8Array): string { } export function isEqualBytes(a: Buffer | Uint8Array, b: Buffer | Uint8Array): boolean { - return Buffer.from(a).equals(Buffer.from(b)); + return toBuffer(a).equals(toBuffer(b)); } export function toBuffer(input: Uint8Array): Buffer {