From fcb1247a5f85efbe0f51b808f54792b66711e71c Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 29 Jun 2026 12:31:06 -0700 Subject: [PATCH] Delete redundant Tools.hash function, just use exported Blake2b directly. --- package-lock.json | 18 +++++++++--------- src/lib/tools.ts | 29 ----------------------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4cf9be7..01f25f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -776,9 +776,9 @@ } }, "node_modules/bare-os": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.1.tgz", - "integrity": "sha512-6M5XjcnsygQNPMCMPXSK379xrJFiZ/AEMNBmFEmQW8d/789VQATvriyi5r0HYTL9TkQ26rn3kgdTG3aisbrXkQ==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.3.tgz", + "integrity": "sha512-fF4Q7QsyKVF5Rj0qvI8BgUNjqzC2JvQlpTaPLjVJVxYVUX5Zr9un+y3w1HmA4nNKdFmRBT8z/WmrjvXzXVerKQ==", "license": "Apache-2.0", "optional": true, "engines": { @@ -1389,9 +1389,9 @@ "optional": true }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", "funding": [ { "type": "github", @@ -1797,9 +1797,9 @@ } }, "node_modules/tar-fs": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.2.tgz", - "integrity": "sha512-QGxxTxxyleAdyM3kpFs14ymbYmNFrfY+pHj7Z8FgtbZ7w2//VAgLMac7sT6nRpIHjppXO2AwwEOg0bPFVRcmXw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.3.tgz", + "integrity": "sha512-/hU4AXnIdZu+Gvl1pk0oI5f5HxWsCJRtY2aFaJdk9VvyL48DWU6iU5WAIPG+wIi1YvWA6eTJvIviP/tMAZZNwQ==", "license": "MIT", "optional": true, "dependencies": { diff --git a/src/lib/tools.ts b/src/lib/tools.ts index e95f0c5..24a5e90 100644 --- a/src/lib/tools.ts +++ b/src/lib/tools.ts @@ -6,7 +6,6 @@ import { Account } from './account' import { Block } from './block' import { MAX_SUPPLY, UNITS } from './constants' import { bytes, hex, utf8 } from './convert' -import { Blake2b } from './crypto' import { Rpc } from './rpc' import { Wallet } from './wallet' @@ -109,34 +108,6 @@ export class Tools { } } - /** - * Hashes one or more arbitrary strings to a 32-byte value using BLAKE2b. - * - * @param {(string|string[])} data String(s) to hash - * @param {string} [encoding] Interprets input strings as hexadecimal values if 'hex' is passed, else UTF-8 - */ - static hash (data: string | string[], encoding?: 'hex'): Uint8Array - /** - * Hashes one or more arbitrary strings to a 32-byte value using BLAKE2b. - * - * @param {(string|string[])} data String(s) to hash - * @param {string} [encoding] Interprets input strings as hexadecimal values if 'hex' is passed, else UTF-8 - * @param {string} [format] Formats output as a hexadecimal value if 'hex' is passed, else Uint8Array - */ - static hash (data: string | string[], encoding?: 'hex', format?: 'hex'): string | Uint8Array { - if (!Array.isArray(data)) data = [data] - const hash = new Blake2b(32) - if (encoding === 'hex') { - data.forEach(str => hash.update(hex.toBytes(str))) - } else { - const enc = new TextEncoder() - data.forEach(str => hash.update(enc.encode(str))) - } - return format === 'hex' - ? bytes.toHex(hash.digest()) - : hash.digest() - } - /** * Signs an arbitrary string with a secret key using nano25519. The input data * is encoded as UTF-8 and can be up to 32 KiB in total. -- 2.52.0