Skip to content

Commit 22a5c09

Browse files
committed
Further simplify Edwards to Montgomery conversion
1 parent e741815 commit 22a5c09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ed448-goldilocks/src/edwards/affine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl AffinePoint {
114114
// See https://www.rfc-editor.org/rfc/rfc7748#section-4.2 4-isogeny maps
115115
pub fn to_montgomery_x(&self) -> MontgomeryXpoint {
116116
// u = y^2/x^2
117-
let u = self.y.square() * self.x.square().invert();
117+
let u = (self.y * self.x.invert()).square();
118118

119119
MontgomeryXpoint(u.to_bytes())
120120
}
@@ -123,7 +123,7 @@ impl AffinePoint {
123123
// See https://www.rfc-editor.org/rfc/rfc7748#section-4.2 4-isogeny maps
124124
pub fn to_montgomery(&self) -> MontgomeryPoint {
125125
// u = y^2/x^2
126-
// v = (2 - x^2 - y^2)*y/x^3)
126+
// v = (2 - x^2 - y^2)*y/x^3
127127

128128
// Optimized to one inversion:
129129
// x_inv = x^-1

0 commit comments

Comments
 (0)