mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-05 20:10:35 +00:00
Eliminate extra inversions in MontgomeryPoint.ct_eq().
This commit is contained in:
parent
7e4fd5677c
commit
5e6e6c3fa8
1 changed files with 3 additions and 2 deletions
|
|
@ -257,8 +257,9 @@ impl Identity for MontgomeryPoint {
|
|||
/// `1` if the points are equal, and `0` otherwise.
|
||||
impl Equal for MontgomeryPoint {
|
||||
fn ct_eq(&self, that: &MontgomeryPoint) -> u8 {
|
||||
slices_equal(self.compress().as_bytes(),
|
||||
that.compress().as_bytes())
|
||||
// (U_P:W_P) = (U_Q:W_Q) iff U_P * W_Q == U_Q * W_P,
|
||||
// since U_P/W_P == U_Q/W_Q.
|
||||
(&self.U * &that.W).ct_eq(&(&self.W * &that.U))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue