|
|
@ -18,7 +18,7 @@ const CHACHA_RNG_SEED_SIZE: usize = 8; |
|
|
|
const ERR_OS_RNG: &str = "could not initialize the OS random number generator"; |
|
|
|
const ERR_OS_RNG: &str = "could not initialize the OS random number generator"; |
|
|
|
|
|
|
|
|
|
|
|
/// A public key, or a public key share.
|
|
|
|
/// A public key, or a public key share.
|
|
|
|
#[derive(Debug)] |
|
|
|
#[derive(Clone, Debug)] |
|
|
|
pub struct PublicKey<E: Engine>(E::G1); |
|
|
|
pub struct PublicKey<E: Engine>(E::G1); |
|
|
|
|
|
|
|
|
|
|
|
impl<E: Engine> PartialEq for PublicKey<E> { |
|
|
|
impl<E: Engine> PartialEq for PublicKey<E> { |
|
|
@ -70,13 +70,11 @@ impl<E: Engine> PartialEq for Signature<E> { |
|
|
|
|
|
|
|
|
|
|
|
impl<E: Engine> Signature<E> { |
|
|
|
impl<E: Engine> Signature<E> { |
|
|
|
pub fn parity(&self) -> bool { |
|
|
|
pub fn parity(&self) -> bool { |
|
|
|
2 % self |
|
|
|
let uncomp = self.0.into_affine().into_uncompressed(); |
|
|
|
.0 |
|
|
|
let bytes = uncomp.as_ref(); |
|
|
|
.into_affine() |
|
|
|
let parity = 0 == bytes.last().expect("non-empty signature") % 2; |
|
|
|
.into_uncompressed() |
|
|
|
debug!("Signature: {:?}, output: {}", bytes, parity); |
|
|
|
.as_ref() |
|
|
|
parity |
|
|
|
.last() |
|
|
|
|
|
|
|
.expect("non-empty signature") == 0 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -162,7 +160,7 @@ impl<E: Engine> PartialEq for DecryptionShare<E> { |
|
|
|
|
|
|
|
|
|
|
|
/// A public key and an associated set of public key shares.
|
|
|
|
/// A public key and an associated set of public key shares.
|
|
|
|
#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] |
|
|
|
#[cfg_attr(feature = "serialization-serde", derive(Serialize, Deserialize))] |
|
|
|
#[derive(Debug)] |
|
|
|
#[derive(Clone, Debug)] |
|
|
|
pub struct PublicKeySet<E: Engine> { |
|
|
|
pub struct PublicKeySet<E: Engine> { |
|
|
|
/// The coefficients of a polynomial whose value at `0` is the "master key", and value at
|
|
|
|
/// The coefficients of a polynomial whose value at `0` is the "master key", and value at
|
|
|
|
/// `i + 1` is key share number `i`.
|
|
|
|
/// `i + 1` is key share number `i`.
|
|
|
|