Skip to content

Commit fa1b45d

Browse files
committed
Add ProjectiveMontgomeryXpoint::double()
1 parent 8ae8a2f commit fa1b45d

File tree

1 file changed

+14
-0
lines changed
  • ed448-goldilocks/src/montgomery

1 file changed

+14
-0
lines changed

ed448-goldilocks/src/montgomery/x.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ impl ProjectiveMontgomeryXpoint {
255255
v
256256
}
257257

258+
/// Double this point
259+
// https://eprint.iacr.org/2020/1338.pdf (2.2)
260+
pub fn double(&self) -> Self {
261+
let v1 = (self.U + self.W).square();
262+
let v2 = (self.U - self.W).square();
263+
let U = v1 * v2;
264+
let v3 = v1 - v2;
265+
let v4 = FieldElement::A_PLUS_TWO_OVER_FOUR * v3;
266+
let v5 = v2 + v4;
267+
let W = v3 * v5;
268+
269+
Self { U, W }
270+
}
271+
258272
/// Convert the point to affine form
259273
pub fn to_affine(&self) -> MontgomeryXpoint {
260274
let x = self.U * self.W.invert();

0 commit comments

Comments
 (0)