From bc17bd4c873628117daaa67636f0702d4380560e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20BR=C3=89ZOT?= Date: Fri, 14 Feb 2025 12:07:24 +0100 Subject: [PATCH] expose missing `generator()` function for the R25519 curve --- .../curves/curve_25519/ristretto_25519/curve_point.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/asymmetric_crypto/curves/curve_25519/ristretto_25519/curve_point.rs b/src/asymmetric_crypto/curves/curve_25519/ristretto_25519/curve_point.rs index 44d92bf..a0b193b 100644 --- a/src/asymmetric_crypto/curves/curve_25519/ristretto_25519/curve_point.rs +++ b/src/asymmetric_crypto/curves/curve_25519/ristretto_25519/curve_point.rs @@ -2,7 +2,7 @@ use core::ops::{Add, Mul, Sub}; use std::iter::Sum; use curve25519_dalek::{ - constants, + constants::{self, RISTRETTO_BASEPOINT_POINT}, ristretto::{CompressedRistretto, RistrettoPoint}, traits::Identity, }; @@ -131,6 +131,12 @@ impl R25519CurvePoint { pub fn identity() -> Self { Self(RistrettoPoint::identity()) } + + /// Returns the generator element of the curve. + #[must_use] + pub fn generator() -> Self { + Self(RISTRETTO_BASEPOINT_POINT) + } } impl<'a> Add<&'a R25519CurvePoint> for R25519CurvePoint {