/**
* 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
/**
* 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`,
* 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 = (() => {
/**
* 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)
* 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