]> git.codecow.com Git - nano25519.git/commitdiff
Document point to bytes conversion function.
authorChris Duncan <chris@codecow.com>
Fri, 6 Nov 2026 19:38:10 +0000 (11:38 -0800)
committerChris Duncan <chris@codecow.com>
Fri, 6 Nov 2026 19:38:10 +0000 (11:38 -0800)
src/assembly/ed25519/p.ts

index fa190f1b2cfdf9efeeb01c519c845a4cd565366d..d8459dc5583e965b9515d2153f721bf6a82eea81 100644 (file)
@@ -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<u8>, h: p3): void {
        fe_invert(t.Z, h.Z)
        fe_mul_pair(t.X, h.X, t.Z, t.Y, h.Y, t.Z)