From 7750e5e0505231c19fad0e5bdab12fb8646118d4 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 26 Aug 2026 21:24:39 -0700 Subject: [PATCH] Add option to check bulk verification on speed test page. --- test/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/index.html b/test/index.html index 6e91b1d..8f3cdbd 100644 --- a/test/index.html +++ b/test/index.html @@ -121,7 +121,8 @@ SPDX-License-Identifier: GPL-3.0-or-later const derive = (prv, api) => { const prv8 = new Uint8Array(prv.match(/.{2}/g).map(b => parseInt(b, 16))) switch (api) { - case 'nano25519': { + case 'nano25519': + case 'nano25519 with bulk block verification': { const pub8 = nano25519.derive(prv8) return [...pub8].map(b => b.toString(16).padStart(2, '0')).join('') } @@ -147,7 +148,8 @@ SPDX-License-Identifier: GPL-3.0-or-later const pub8 = new Uint8Array(pub.match(/.{2}/g).map(b => parseInt(b, 16))) const sk8 = new Uint8Array((prv + pub).match(/.{2}/g).map(b => parseInt(b, 16))) switch (api) { - case 'nano25519': { + case 'nano25519': + case 'nano25519 with bulk block verification': { const sig8 = nano25519.sign(msg8, prv8, pub8) return [...sig8].map(b => b.toString(16).padStart(2, '0')).join('') } @@ -176,6 +178,12 @@ SPDX-License-Identifier: GPL-3.0-or-later case 'nano25519': { return nano25519.verify(sig8, msg8, pub8) } + case 'nano25519 with bulk block verification': { + const blocks = [] + for (let i = 0; i < 256; i++) blocks[i] = { hash: msg8, signature: sig8 } + const verified = nano25519.verify_blocks(pub8, blocks) + return verified.every(v => v === true) + } case 'NanocurrencyWeb': { return NanocurrencyWeb.tools.verify(pub, sig, msg) } @@ -394,6 +402,7 @@ SPDX-License-Identifier: GPL-3.0-or-later } end = performance.now() duration = end - start + duration /= (api === 'nano25519 with bulk block verification') ? 256 : 1 verifyTimes[i].push(duration) } catch (err) { document.getElementById('output').innerHTML += `Error: ${err.message}
` @@ -506,6 +515,7 @@ SPDX-License-Identifier: GPL-3.0-or-later