Skip to content

Commit 61b5e50

Browse files
committed
Add ProjectiveMontgomeryXpoint::double()
1 parent 2308d95 commit 61b5e50

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
@@ -252,6 +252,20 @@ impl ProjectiveMontgomeryXpoint {
252252
v
253253
}
254254

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

0 commit comments

Comments
 (0)