From 31690de773abda8ba029f173e614e76f40faea9f Mon Sep 17 00:00:00 2001 From: duguorong Date: Sat, 16 Dec 2023 11:23:23 +0800 Subject: [PATCH] fix: rename the "simple_svdw_*" with "sswu_*" --- src/hash_to_curve.rs | 8 ++++---- src/secp256k1/curve.rs | 8 ++++---- src/secp256r1/curve.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hash_to_curve.rs b/src/hash_to_curve.rs index 54f32359..afafaaf6 100644 --- a/src/hash_to_curve.rs +++ b/src/hash_to_curve.rs @@ -91,7 +91,7 @@ fn hash_to_field>( // Implementation of #[allow(clippy::too_many_arguments)] -pub(crate) fn simple_svdw_map_to_curve(u: C::Base, z: C::Base) -> C +pub(crate) fn sswu_map_to_curve(u: C::Base, z: C::Base) -> C where C: CurveExt, { @@ -157,7 +157,7 @@ where // Implementation of #[allow(clippy::type_complexity)] -pub(crate) fn simple_svdw_hash_to_curve<'a, C>( +pub(crate) fn sswu_hash_to_curve<'a, C>( curve_id: &'static str, domain_prefix: &'a str, z: C::Base, @@ -170,7 +170,7 @@ where let mut us = [C::Base::ZERO; 2]; hash_to_field("SSWU", curve_id, domain_prefix, message, &mut us); - let [q0, q1]: [C; 2] = us.map(|u| simple_svdw_map_to_curve::(u, z)); + let [q0, q1]: [C; 2] = us.map(|u| sswu_map_to_curve::(u, z)); let r = q0 + &q1; debug_assert!(bool::from(r.is_on_curve())); @@ -180,7 +180,7 @@ where // Implementation of #[allow(clippy::type_complexity)] -pub(crate) fn simple_svdw_hash_to_curve_secp256k1<'a>( +pub(crate) fn sswu_hash_to_curve_secp256k1<'a>( _curve_id: &'static str, domain_prefix: &'a str, ) -> Box Secp256k1 + 'a> { diff --git a/src/secp256k1/curve.rs b/src/secp256k1/curve.rs index 9af2330c..d7af866a 100644 --- a/src/secp256k1/curve.rs +++ b/src/secp256k1/curve.rs @@ -1,7 +1,7 @@ use crate::ff::WithSmallOrderMulGroup; use crate::ff::{Field, PrimeField}; use crate::group::{prime::PrimeCurveAffine, Curve, Group as _, GroupEncoding}; -use crate::hash_to_curve::{simple_svdw_hash_to_curve, simple_svdw_hash_to_curve_secp256k1}; +use crate::hash_to_curve::{sswu_hash_to_curve, sswu_hash_to_curve_secp256k1}; use crate::secp256k1::Fp; use crate::secp256k1::Fq; use crate::{Coordinates, CurveAffine, CurveExt}; @@ -65,7 +65,7 @@ new_curve_impl!( SECP_A, SECP_B, "secp256k1", - |curve_id, domain_prefix| simple_svdw_hash_to_curve_secp256k1(curve_id, domain_prefix), + |curve_id, domain_prefix| sswu_hash_to_curve_secp256k1(curve_id, domain_prefix), ); impl Secp256k1 { @@ -134,14 +134,14 @@ new_curve_impl!( ISO_SECP_A, ISO_SECP_B, "secp256k1", - |curve_id, domain_prefix| simple_svdw_hash_to_curve(curve_id, domain_prefix, IsoSecp256k1::SVDW_Z), + |curve_id, domain_prefix| sswu_hash_to_curve(curve_id, domain_prefix, IsoSecp256k1::SSWU_Z), ); impl IsoSecp256k1 { // Z = -11 (reference: ) // 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc24 // NOTE: This `Z` is the `SSWU_Z` of `Secp256k1` curve. - const SVDW_Z: Fp = Fp([ + const SSWU_Z: Fp = Fp([ 0xfffffffefffffc24, 0xffffffffffffffff, 0xffffffffffffffff, diff --git a/src/secp256r1/curve.rs b/src/secp256r1/curve.rs index 7e6e24ef..e592d82b 100644 --- a/src/secp256r1/curve.rs +++ b/src/secp256r1/curve.rs @@ -1,7 +1,7 @@ use crate::ff::WithSmallOrderMulGroup; use crate::ff::{Field, PrimeField}; use crate::group::{prime::PrimeCurveAffine, Curve, Group as _, GroupEncoding}; -use crate::hash_to_curve::simple_svdw_hash_to_curve; +use crate::hash_to_curve::sswu_hash_to_curve; use crate::secp256r1::Fp; use crate::secp256r1::Fq; use crate::{Coordinates, CurveAffine, CurveExt}; @@ -76,7 +76,7 @@ new_curve_impl!( SECP_A, SECP_B, "secp256r1", - |curve_id, domain_prefix| simple_svdw_hash_to_curve(curve_id, domain_prefix, Secp256r1::SSVDW_Z), + |curve_id, domain_prefix| sswu_hash_to_curve(curve_id, domain_prefix, Secp256r1::SSVDW_Z), ); impl Secp256r1 {