Rename elligator_map -> elligator_encode

leaves an obvious name open for the reverse mapping
This commit is contained in:
François Garillot 2021-01-12 13:46:04 -08:00
parent 8aa1458941
commit e2651cceb6
No known key found for this signature in database
GPG key ID: AC66C67853005854
2 changed files with 4 additions and 4 deletions

View file

@ -512,7 +512,7 @@ impl EdwardsPoint {
let fe = FieldElement::from_bytes(&res);
let M1 = crate::montgomery::elligator_map(&fe);
let M1 = crate::montgomery::elligator_encode(&fe);
let E1_opt = M1.to_edwards(sign_bit);
E1_opt

View file

@ -160,7 +160,7 @@ impl MontgomeryPoint {
///
/// See
/// https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-10#section-6.7.1
pub(crate) fn elligator_map(r_0: &FieldElement) -> MontgomeryPoint {
pub(crate) fn elligator_encode(r_0: &FieldElement) -> MontgomeryPoint {
let minus_a = -&MONT_A; /* A = 486662 */
let one = FieldElement::one();
let d_1 = &one + &r_0.square2(); /* 2r^2 */
@ -442,7 +442,7 @@ mod test {
let bits_in: [u8; 32] = (&bytes[..]).try_into().expect("Range invariant broken");
let fe = FieldElement::from_bytes(&bits_in);
let eg = elligator_map(&fe);
let eg = elligator_encode(&fe);
assert_eq!(eg.to_bytes(), ELLIGATOR_CORRECT_OUTPUT);
}
@ -450,7 +450,7 @@ mod test {
fn montgomery_elligator_zero_zero() {
let zero = [0u8; 32];
let fe = FieldElement::from_bytes(&zero);
let eg = elligator_map(&fe);
let eg = elligator_encode(&fe);
assert_eq!(eg.to_bytes(), zero);
}
}