Skip to content

Commit 171b266

Browse files
committed
Make ProjectiveMontgomeryXpoint::identity() an associated const
1 parent a3e64cc commit 171b266

File tree

1 file changed

+5
-7
lines changed
  • ed448-goldilocks/src/montgomery

1 file changed

+5
-7
lines changed

ed448-goldilocks/src/montgomery/x.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Mul<&EdwardsScalar> for &MontgomeryXpoint {
7575
fn mul(self, scalar: &EdwardsScalar) -> ProjectiveMontgomeryXpoint {
7676
// Algorithm 8 of Costello-Smith 2017
7777
let affine_u = FieldElement::from_bytes(&self.0);
78-
let mut x0 = ProjectiveMontgomeryXpoint::identity();
78+
let mut x0 = ProjectiveMontgomeryXpoint::IDENTITY;
7979
let mut x1 = ProjectiveMontgomeryXpoint {
8080
U: affine_u,
8181
W: FieldElement::ONE,
@@ -226,12 +226,10 @@ fn differential_add_and_double(
226226

227227
impl ProjectiveMontgomeryXpoint {
228228
/// The identity element of the group: the point at infinity.
229-
pub fn identity() -> ProjectiveMontgomeryXpoint {
230-
ProjectiveMontgomeryXpoint {
231-
U: FieldElement::ONE,
232-
W: FieldElement::ZERO,
233-
}
234-
}
229+
pub const IDENTITY: Self = Self {
230+
U: FieldElement::ONE,
231+
W: FieldElement::ZERO,
232+
};
235233

236234
/// Compute the Y-coordinate
237235
// See https://www.rfc-editor.org/rfc/rfc7748#section-1.

0 commit comments

Comments
 (0)