Skip to content

Commit 5c8ea4e

Browse files
committed
Add ProjectiveMontgomeryXpoint::double()
1 parent 30c66ca commit 5c8ea4e

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

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

0 commit comments

Comments
 (0)