From: Chris Duncan Date: Fri, 6 Nov 2026 19:38:10 +0000 (-0800) Subject: Document point to bytes conversion function. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=d41d5ed898f209eb2e7f7580d548b118d681db8d;p=nano25519.git Document point to bytes conversion function. --- diff --git a/src/assembly/ed25519/p.ts b/src/assembly/ed25519/p.ts index fa190f1..d8459dc 100644 --- a/src/assembly/ed25519/p.ts +++ b/src/assembly/ed25519/p.ts @@ -377,6 +377,18 @@ export function p3_sub_precomp (r: p1p1, p: p3, q: p_precomp): void { fe_addsub(r.T, r.Z, r.Z, r.T) } +/** + * s = h + * + * Encodes `h` as 32 bytes where bits 0 to 254 are `y` little-endian and bit 255 + * is the sign of `x` which is its least significant bit. + * + * ``` + * x = X₁/Z₁ + * y = Y₁/Z₁ + * s = y + 2²⁵⁵(x mod 2) + * ``` + */ export function p3_tobytes (s: StaticArray, h: p3): void { fe_invert(t.Z, h.Z) fe_mul_pair(t.X, h.X, t.Z, t.Y, h.Y, t.Z)