diff --git a/src/lib.rs b/src/lib.rs index 6d3650c..e8990d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,7 +124,7 @@ pub trait Suite: Copy + Clone { /// /// By default uses "try and increment" method described by RFC 9381. fn data_to_point(data: &[u8]) -> Option> { - utils::hash_to_curve_tai_rfc_9381::(data, false) + utils::hash_to_curve_tai_rfc_9381::(data) } /// Map the point to a hash value using `Self::Hasher`. diff --git a/src/suites/secp256.rs b/src/suites/secp256.rs index eefe321..8ce1963 100644 --- a/src/suites/secp256.rs +++ b/src/suites/secp256.rs @@ -72,7 +72,7 @@ impl Suite for P256Sha256Tai { } fn data_to_point(data: &[u8]) -> Option { - utils::hash_to_curve_tai_rfc_9381::(data, true) + utils::hash_to_curve_tai_rfc_9381::(data) } } diff --git a/src/utils.rs b/src/utils.rs index 65185e4..9025af5 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -88,10 +88,9 @@ pub fn hash_to_curve_tai_rfc_9381(data: &[u8]) -> Option(&buf).to_vec(); - if point_be_encoding { + if S::Codec::BIG_ENDIAN { hash.reverse(); } hash.push(0x00); @@ -354,7 +353,7 @@ mod tests { #[test] fn hash_to_curve_tai_works() { - let pt = hash_to_curve_tai_rfc_9381::(b"hello world", false).unwrap(); + let pt = hash_to_curve_tai_rfc_9381::(b"hello world").unwrap(); // Check that `pt` is in the prime subgroup assert!(pt.is_on_curve()); assert!(pt.is_in_correct_subgroup_assuming_on_curve())