mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-06 20:41:14 +00:00
Rename elligator_map -> elligator_encode
leaves an obvious name open for the reverse mapping
This commit is contained in:
parent
8aa1458941
commit
e2651cceb6
2 changed files with 4 additions and 4 deletions
|
|
@ -512,7 +512,7 @@ impl EdwardsPoint {
|
||||||
|
|
||||||
let fe = FieldElement::from_bytes(&res);
|
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);
|
let E1_opt = M1.to_edwards(sign_bit);
|
||||||
|
|
||||||
E1_opt
|
E1_opt
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ impl MontgomeryPoint {
|
||||||
///
|
///
|
||||||
/// See
|
/// See
|
||||||
/// https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-10#section-6.7.1
|
/// 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 minus_a = -&MONT_A; /* A = 486662 */
|
||||||
let one = FieldElement::one();
|
let one = FieldElement::one();
|
||||||
let d_1 = &one + &r_0.square2(); /* 2r^2 */
|
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 bits_in: [u8; 32] = (&bytes[..]).try_into().expect("Range invariant broken");
|
||||||
|
|
||||||
let fe = FieldElement::from_bytes(&bits_in);
|
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);
|
assert_eq!(eg.to_bytes(), ELLIGATOR_CORRECT_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ mod test {
|
||||||
fn montgomery_elligator_zero_zero() {
|
fn montgomery_elligator_zero_zero() {
|
||||||
let zero = [0u8; 32];
|
let zero = [0u8; 32];
|
||||||
let fe = FieldElement::from_bytes(&zero);
|
let fe = FieldElement::from_bytes(&zero);
|
||||||
let eg = elligator_map(&fe);
|
let eg = elligator_encode(&fe);
|
||||||
assert_eq!(eg.to_bytes(), zero);
|
assert_eq!(eg.to_bytes(), zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue