Merge pull request #231 from hdevalence/fix-to-monty-doc

Fix comment on Montgomery conversion.
This commit is contained in:
Henry de Valence 2019-02-12 19:31:42 -08:00 committed by GitHub
commit 73eee8a1da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,6 +450,10 @@ impl EdwardsPoint {
/// Convert this `EdwardsPoint` on the Edwards model to the /// Convert this `EdwardsPoint` on the Edwards model to the
/// corresponding `MontgomeryPoint` on the Montgomery model. /// 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 /// Note that this is a one-way conversion, since the Montgomery
/// model does not retain sign information. /// model does not retain sign information.
pub fn to_montgomery(&self) -> MontgomeryPoint { 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 denominator is zero only when y=1, the identity point of
// the Edwards curve. Since 0.invert() = 0, in this case we // 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 U = &self.Z + &self.Y;
let W = &self.Z - &self.Y; let W = &self.Z - &self.Y;
let u = &U * &W.invert(); let u = &U * &W.invert();