diff --git a/src/lib/discovery/enrtree.ts b/src/lib/discovery/enrtree.ts index 32b37ccaa9..e87b87946d 100644 --- a/src/lib/discovery/enrtree.ts +++ b/src/lib/discovery/enrtree.ts @@ -2,8 +2,9 @@ import * as secp from "@noble/secp256k1"; import * as base32 from "hi-base32"; import { fromString } from "uint8arrays/from-string"; +import { keccak256 } from "../crypto"; import { ENR } from "../enr"; -import { keccak256Buf, utf8ToBytes } from "../utils"; +import { utf8ToBytes } from "../utils"; export type ENRRootValues = { eRoot: string; @@ -51,7 +52,7 @@ export class ENRTree { const _sig = secp.Signature.fromCompact(signatureBuffer.slice(0, 64)); isVerified = secp.verify( _sig, - keccak256Buf(signedComponentBuffer), + keccak256(signedComponentBuffer), new Uint8Array(decodedPublicKey) ); } catch { diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 7e64388a4c..2d0ca74b11 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,4 +1,3 @@ -import { keccak256, Message } from "js-sha3"; import { fromString } from "uint8arrays/from-string"; import { toString } from "uint8arrays/to-string"; @@ -21,13 +20,6 @@ export function hexToBytes(hex: string | Uint8Array): Uint8Array { export const bytesToHex = (bytes: Uint8Array): string => toString(bytes, "base16"); -/** - * Return Keccak-256 of the input. - */ -export function keccak256Buf(message: Message): Uint8Array { - return new Uint8Array(keccak256.arrayBuffer(message)); -} - /** * Decode byte array to utf-8 string. */