Fix comment on Montgomery conversion.

Closes #213.
This commit is contained in:
Henry de Valence 2019-02-12 19:30:18 -08:00
parent ff0dc4a3db
commit 96df60895f

View file

@ -450,6 +450,10 @@ impl EdwardsPoint {
/// Convert this `EdwardsPoint` on the Edwards model to the
/// corresponding `MontgomeryPoint` on the Montgomery model.
///
/// This function has one exceptional case; the identity point of
/// the Edwards curve is sent to the 2-torsion point \\((0,0)\\)
/// on the Montgomery curve.
///
/// Note that this is a one-way conversion, since the Montgomery
/// model does not retain sign information.
pub fn to_montgomery(&self) -> MontgomeryPoint {
@ -457,7 +461,7 @@ impl EdwardsPoint {
//
// The denominator is zero only when y=1, the identity point of
// the Edwards curve. Since 0.invert() = 0, in this case we
// compute u = 0, the identity point of the Montgomery line.
// compute the 2-torsion point (0,0).
let U = &self.Z + &self.Y;
let W = &self.Z - &self.Y;
let u = &U * &W.invert();