Derive Eq, PartialEq for CompressedEdwardsY

This commit is contained in:
Henry de Valence 2017-01-31 01:13:07 -05:00
parent 7034a875bd
commit eaa5d3e595

View file

@ -98,7 +98,7 @@ use util::CTAssignable;
/// ///
/// The first 255 bits of a CompressedEdwardsY represent the /// The first 255 bits of a CompressedEdwardsY represent the
/// y-coordinate. The high bit of the 32nd byte gives the sign of `x`. /// y-coordinate. The high bit of the 32nd byte gives the sign of `x`.
#[derive(Copy, Clone)] #[derive(Copy, Clone, Eq, PartialEq)]
pub struct CompressedEdwardsY(pub [u8; 32]); pub struct CompressedEdwardsY(pub [u8; 32]);
impl Debug for CompressedEdwardsY { impl Debug for CompressedEdwardsY {
@ -107,18 +107,6 @@ impl Debug for CompressedEdwardsY {
} }
} }
impl Eq for CompressedEdwardsY {}
impl PartialEq for CompressedEdwardsY {
/// Determine if this `CompressedEdwardsY` is equal to another.
///
/// # Warning
///
/// This function is NOT constant time.
fn eq(&self, other: &CompressedEdwardsY) -> bool {
return self.0 == other.0;
}
}
impl Index<usize> for CompressedEdwardsY { impl Index<usize> for CompressedEdwardsY {
type Output = u8; type Output = u8;