Derive Eq, PartialEq for Signature.

This commit is contained in:
Isis Lovecruft 2018-07-15 21:50:20 +00:00
parent 80075a0b41
commit 5c26349b6c
Failed to extract signature

View file

@ -68,7 +68,7 @@ pub const EXPANDED_SECRET_KEY_LENGTH: usize = EXPANDED_SECRET_KEY_KEY_LENGTH + E
/// "detached"—that is, they do **not** include a copy of the message which has
/// been signed.
#[allow(non_snake_case)]
#[derive(Copy)]
#[derive(Copy, Eq, PartialEq)]
#[repr(C)]
pub struct Signature {
/// `r` is an `EdwardsPoint`, formed by using an hash function with
@ -104,20 +104,6 @@ impl Debug for Signature {
}
}
impl Eq for Signature {}
impl PartialEq for Signature {
fn eq(&self, other: &Signature) -> bool {
let mut equal: u8 = 0;
for i in 0..32 {
equal |= self.R.0[i] ^ other.R.0[i];
equal |= self.s[i] ^ other.s[i];
}
equal == 0
}
}
impl Signature {
/// Convert this `Signature` to a byte array.
#[inline]