mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Use clearer identity check in equality
This commit is contained in:
@@ -46,7 +46,8 @@ impl ConstantTimeEq for Point {
|
|||||||
let y1 = self.y * other.z;
|
let y1 = self.y * other.z;
|
||||||
let y2 = other.y * self.z;
|
let y2 = other.y * self.z;
|
||||||
|
|
||||||
(self.x.is_zero() & other.x.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
|
// Both identity or equivalent over their denominators
|
||||||
|
(self.z.is_zero() & other.z.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ impl ConstantTimeEq for Point {
|
|||||||
let y1 = self.y * other.z;
|
let y1 = self.y * other.z;
|
||||||
let y2 = other.y * self.z;
|
let y2 = other.y * self.z;
|
||||||
|
|
||||||
(self.x.is_zero() & other.x.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
|
// Identity or equivalent
|
||||||
|
(self.z.is_zero() & other.z.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user