From: Chris Duncan Date: Thu, 20 Aug 2026 06:52:59 +0000 (-0700) Subject: Use real math symbols in comments for legibility. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=refs%2Fheads%2Fnext%2Fout-buf;p=nano25519.git Use real math symbols in comments for legibility. --- diff --git a/src/assembly/crypto_verify.ts b/src/assembly/crypto_verify.ts index f558b2d..68c22ab 100644 --- a/src/assembly/crypto_verify.ts +++ b/src/assembly/crypto_verify.ts @@ -23,10 +23,10 @@ const S = new StaticArray(32) */ export function crypto_verify (s: StaticArray, M: StaticArray, mlen: i32, pub: StaticArray): i32 { - // fail if public key `k` is non-canonical (`p = 2²⁵⁵-19 <= k`) + // fail if public key `k` is non-canonical (`p = 2²⁵⁵-19 ≤ k`) if (!ge_is_canonical(pub)) return -1 - // fail if private scalar `S` is non-canonical (`L <= S`) + // fail if private scalar `S` is non-canonical (`L ≤ S`) memory.copy(changetype(S), changetype(s) + 32, 32) if (!sc_is_canonical(S)) return -1 diff --git a/src/assembly/fe.ts b/src/assembly/fe.ts index 5b21a74..2f29809 100644 --- a/src/assembly/fe.ts +++ b/src/assembly/fe.ts @@ -4,7 +4,7 @@ /** * Arithmetic on field elements. These are integers in the range * - * `0 <= n < p` + * `0 ≤ n < p` * * where * @@ -640,15 +640,15 @@ export function fe_pow22523 (out: FieldElement, z: FieldElement): void { * Basic claim: q = floor(2⁻²⁵⁵(h + 19 2^(-25)h9 + 2^(-1))). * * Proof: - * Have |h|<=p so |q|<=1 so |19² 2⁻²⁵⁵ q|<1/4. + * Have |h|≤p so |q|≤1 so |19² 2⁻²⁵⁵ q|<1/4. * Also have |h-2²³⁰ h9|<2²³¹ so |19 2⁻²⁵⁵(h-2²³⁰ h9)|<1/4. * * Write y=2^(-1)-19² 2⁻²⁵⁵q-19 2⁻²⁵⁵(h-2²³⁰ h9). * Then 0): void { const e = ge_scalarmult_base_e diff --git a/src/assembly/sc.ts b/src/assembly/sc.ts index ae85e4d..48606e0 100644 --- a/src/assembly/sc.ts +++ b/src/assembly/sc.ts @@ -19,8 +19,8 @@ const L = StaticArray.fromArray([ /** * Validate signature scalar S is canonical (S < L) * - Accept immediately if `S < 2²⁵²` since this implies `S < L` - * - Reject immediately if `S >= 2²⁵³` since this implies `S >= L` - * - Otherwise, check canonicity for `2²⁵² <= S < 2²⁵³` + * - Reject immediately if `S ≥ 2²⁵³` since this implies `S ≥ L` + * - Otherwise, check canonicity for `2²⁵² ≤ S < 2²⁵³` */ export function sc_is_canonical (S: StaticArray): bool { if ((S[31] & 0xF0) == 0) return true