mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-09 21:10:43 +00:00
Derive Eq, PartialEq for Signature.
This commit is contained in:
parent
80075a0b41
commit
5c26349b6c
1 changed files with 1 additions and 15 deletions
|
|
@ -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
|
/// "detached"—that is, they do **not** include a copy of the message which has
|
||||||
/// been signed.
|
/// been signed.
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Eq, PartialEq)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Signature {
|
pub struct Signature {
|
||||||
/// `r` is an `EdwardsPoint`, formed by using an hash function with
|
/// `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 {
|
impl Signature {
|
||||||
/// Convert this `Signature` to a byte array.
|
/// Convert this `Signature` to a byte array.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue