From: Chris Duncan Date: Wed, 20 Nov 2024 00:40:50 +0000 (-0800) Subject: Switch to blake2b package from blake2b-wasm for ckd worker. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=58ddab8ce93f10e63dfb976177f81cdb52439ebf;p=libnemo.git Switch to blake2b package from blake2b-wasm for ckd worker. --- diff --git a/src/lib/ckd.ts b/src/lib/ckd.ts index c0548e0..0e921ae 100644 --- a/src/lib/ckd.ts +++ b/src/lib/ckd.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2024 Chris Duncan // SPDX-License-Identifier: GPL-3.0-or-later -import blake2b from 'blake2b-wasm' +import blake2b from 'blake2b' import { nanoCKD } from './bip32-key-derivation.js' let addEventListener = globalThis.addEventListener @@ -55,6 +55,6 @@ async function ckdBlake2b (seed: string, index: number): Promise { const inputHex = `${seed}${indexHex}`.padStart(72, '0') const inputArray = (inputHex.match(/.{1,2}/g) ?? []).map(h => parseInt(h, 16)) const inputBytes = Uint8Array.from(inputArray) - const hash = blake2b().update(inputBytes).digest('hex') + const hash = blake2b(32).update(inputBytes).digest('hex') return hash }