]> git.codecow.com Git - nano25519.git/commitdiff
Fix doc comments.
authorChris Duncan <chris@codecow.com>
Sat, 10 Oct 2026 08:55:36 +0000 (01:55 -0700)
committerChris Duncan <chris@codecow.com>
Sat, 10 Oct 2026 08:55:36 +0000 (01:55 -0700)
scripts/blake2b-gen.mjs
src/assembly/crypto_verify.ts
src/assembly/index.ts

index 607027e95ce448721365af4a986e624b535c9584..121e79b8d311912c0b535de264ef2c66c455bdc7 100644 (file)
@@ -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 = (() => {
index 4d1b000bc9ad56433f277934b2dd6d155a2b8c9f..8531ad2e903d41213dd580362ad5314e50469120 100644 (file)
@@ -26,7 +26,7 @@ const t_u8x32 = new StaticArray<u8>(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<u8>): ge_p3 | null {
        const b = ge_frombytes_negate_vartime(A, pub, t_u8x32, t_fe_0, t_fe_1, t_fe_2)
index 921047d7ff3b34904c8c0826e80a66271c254369..9914c6034944ed8c364fc4e85c8886f43e134ae0 100644 (file)
@@ -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