From d9c1a581fdcc323436651845a9536f260186ecf5 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 10 Oct 2026 01:55:36 -0700 Subject: [PATCH] Fix doc comments. --- scripts/blake2b-gen.mjs | 11 ++++------- src/assembly/crypto_verify.ts | 2 +- src/assembly/index.ts | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/blake2b-gen.mjs b/scripts/blake2b-gen.mjs index 607027e..121e79b 100644 --- a/scripts/blake2b-gen.mjs +++ b/scripts/blake2b-gen.mjs @@ -3,8 +3,8 @@ /** * Generate the BLAKE2b hashing algorithm for WebAssembly API. Specifically, it - * outputs `asm/index.ts`, an AssemblyScript file that must be compiled as part - * of a WASM module. + * outputs `src/assembly/ed25519/blake2b.ts`, an AssemblyScript file that must + * be compiled as part of a WASM module. * * Some whitespace output is removed for brevity in the final files, which * should be checked separately for correctness using language-specific tools @@ -41,11 +41,6 @@ const blake2b_sigma = [ /** * Initialization vector defined by BLAKE2. - * - * Application of each XOR is defined by BLAKE2 section 2.4 compression - * function. Each value represents two halves of the original u64 value from - * the reference implementation. They appear reversed pairwise in order to - * align with little-endian computation. */ const blake2b_iv = [ `0x6a09e667f3bcc908`, @@ -167,6 +162,8 @@ function ROUND (r) { * Builds string of code that first initializes the BLAKE2b state vectors and * then compresses the input message. * + * Application of each XOR is defined by BLAKE2 § 2.4 compression function. + * * @type {string} API-specific code executing 12 rounds of G mixing */ const COMPRESS = (() => { diff --git a/src/assembly/crypto_verify.ts b/src/assembly/crypto_verify.ts index 4d1b000..8531ad2 100644 --- a/src/assembly/crypto_verify.ts +++ b/src/assembly/crypto_verify.ts @@ -26,7 +26,7 @@ const t_u8x32 = new StaticArray(32) /** * Verify public key `pub` can be decoded. - * @returns 0 if public key fails to decode, else return pointer to A + * @returns null if public key fails to decode, else return pointer to A */ export function crypto_verify_decodepubkey (pub: StaticArray): ge_p3 | null { const b = ge_frombytes_negate_vartime(A, pub, t_u8x32, t_fe_0, t_fe_1, t_fe_2) diff --git a/src/assembly/index.ts b/src/assembly/index.ts index 921047d..9914c60 100644 --- a/src/assembly/index.ts +++ b/src/assembly/index.ts @@ -230,9 +230,9 @@ export function verify (mlen: i32): void { * concatenated value. The performance gain of verifying in bulk scales as * `(1-(1/n)) x (k/(k+r))` where `n` is block count, `k` is the time required to * verify the public key, and `r` is the time required to compute all the - * remaining verification steps. Testing shows public key derivation to be ~12% + * remaining verification steps. Testing shows public key decoding to be ~9% * the total verification time, so batching up to 64 block signature/hash pairs - * reaches ~96% of that gain; any more blocks would simply add latency returning + * reaches ~98% of that gain; any more blocks would simply add latency returning * the final results. * * All pairs are verified against a single public key. The results are written -- 2.52.0