Skip to content

Commit e1c0a2a

Browse files
committed
Make ProjectiveMontgomeryXpoint::identity() an associated const
1 parent 543067d commit e1c0a2a

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
@@ -71,7 +71,7 @@ impl Mul<&EdwardsScalar> for &MontgomeryXpoint {
7171
fn mul(self, scalar: &EdwardsScalar) -> ProjectiveMontgomeryXpoint {
7272
// Algorithm 8 of Costello-Smith 2017
7373
let affine_u = FieldElement::from_bytes(&self.0);
74-
let mut x0 = ProjectiveMontgomeryXpoint::identity();
74+
let mut x0 = ProjectiveMontgomeryXpoint::IDENTITY;
7575
let mut x1 = ProjectiveMontgomeryXpoint {
7676
U: affine_u,
7777
W: FieldElement::ONE,
@@ -222,12 +222,10 @@ fn differential_add_and_double(
222222

223223
impl ProjectiveMontgomeryXpoint {
224224
/// The identity element of the group: the point at infinity.
225-
pub fn identity() -> ProjectiveMontgomeryXpoint {
226-
ProjectiveMontgomeryXpoint {
227-
U: FieldElement::ONE,
228-
W: FieldElement::ZERO,
229-
}
230-
}
225+
pub const IDENTITY: Self = Self {
226+
U: FieldElement::ONE,
227+
W: FieldElement::ZERO,
228+
};
231229

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

0 commit comments

Comments
 (0)