fe_mul(r.T2d, p.T, ed25519_d2)
}
-const ge_p3_tobytes_fe_scratch_0: FieldElement = fe()
-const ge_p3_tobytes_fe_scratch_1: FieldElement = fe()
-const ge_p3_tobytes_fe_scratch_2: FieldElement = fe()
-const ge_p3_tobytes_fe_scratch_3: FieldElement = fe()
-const ge_p3_tobytes_recip: FieldElement = fe()
-const ge_p3_tobytes_x: FieldElement = fe()
-const ge_p3_tobytes_y: FieldElement = fe()
-export function ge_p3_tobytes (s: StaticArray<u8>, h: ge_p3): void {
- const fe_scratch_0 = ge_p3_tobytes_fe_scratch_0
- const fe_scratch_1 = ge_p3_tobytes_fe_scratch_1
- const fe_scratch_2 = ge_p3_tobytes_fe_scratch_2
- const fe_scratch_3 = ge_p3_tobytes_fe_scratch_3
- const recip = ge_p3_tobytes_recip
- const x = ge_p3_tobytes_x
- const y = ge_p3_tobytes_y
- fe_invert(recip, h.Z, fe_scratch_0, fe_scratch_1, fe_scratch_2, fe_scratch_3)
- fe_mul(x, h.X, recip)
- fe_mul(y, h.Y, recip)
- fe_tobytes(s, y, fe_scratch_0)
- s[31] ^= fe_isnegative(x, fe_scratch_0) << 7
-}
-
/**
* r = 2 * p
*/
fe_sub(r.Z, p.Z, r.T)
fe_add(r.T, p.Z, r.T)
}
+
+const fe_scratch_0: FieldElement = fe()
+const fe_scratch_1: FieldElement = fe()
+const fe_scratch_2: FieldElement = fe()
+const fe_scratch_3: FieldElement = fe()
+const recip: FieldElement = fe()
+const x: FieldElement = fe()
+const y: FieldElement = fe()
+export function ge_p3_tobytes (s: StaticArray<u8>, h: ge_p3): void {
+ fe_invert(recip, h.Z, fe_scratch_0, fe_scratch_1, fe_scratch_2, fe_scratch_3)
+ fe_mul(x, h.X, recip)
+ fe_mul(y, h.Y, recip)
+ fe_tobytes(s, y, fe_scratch_0)
+ s[31] ^= fe_isnegative(x, fe_scratch_0) << 7
+}