Add missing_docs lint, extend docs.

master
Andreas Fackler 6 years ago committed by Andreas Fackler
parent c7eda7a14a
commit c2d63b214a
  1. 4
      src/error.rs
  2. 6
      src/lib.rs
  3. 2
      src/mock/ms8.rs

@ -5,10 +5,13 @@ use failure::Fail;
/// A crypto error.
#[derive(Clone, Eq, PartialEq, Debug, Fail)]
pub enum Error {
/// Not enough signature shares.
#[fail(display = "Not enough signature shares")]
NotEnoughShares,
/// Signature shares contain a duplicated index.
#[fail(display = "Signature shares contain a duplicated index")]
DuplicateEntry,
/// The degree is too high for the coefficients to be indexed by `usize`.
#[fail(display = "The degree is too high for the coefficients to be indexed by usize.")]
DegreeTooHigh,
}
@ -32,6 +35,7 @@ mod tests {
/// An error reading a structure from an array of bytes.
#[derive(Clone, Eq, PartialEq, Debug, Fail)]
pub enum FromBytesError {
/// Invalid representation
#[fail(display = "Invalid representation.")]
Invalid,
}

@ -1,3 +1,5 @@
//! A pairing-based threshold cryptosystem for collaborative decryption and signatures.
// Clippy warns that it's dangerous to derive `PartialEq` and explicitly implement `Hash`, but the
// `pairing::bls12_381` types don't implement `Hash`, so we can't derive it.
#![cfg_attr(feature = "cargo-clippy", allow(derive_hash_xor_eq))]
@ -10,6 +12,7 @@
),
allow(trivially_copy_pass_by_ref)
)]
#![warn(missing_docs)]
#[cfg(test)]
extern crate bincode;
@ -31,10 +34,10 @@ pub extern crate pairing;
mod into_fr;
mod secret;
mod serde_impl;
pub mod error;
pub mod poly;
pub mod serde_impl;
use std::fmt;
use std::hash::{Hash, Hasher};
@ -208,6 +211,7 @@ impl Hash for Signature {
}
impl Signature {
/// Returns `true` if the signature contains an odd number of ones.
pub fn parity(&self) -> bool {
let uncomp = self.0.into_affine().into_uncompressed();
let xor_bytes: u8 = uncomp.as_ref().iter().fold(0, |result, byte| result ^ byte);

@ -147,10 +147,12 @@ generate_op_impls!(Mersenne8, Mul, MulAssign, mul, mul_assign);
impl Mersenne8 {
#[inline]
/// Creates a new `Mersenne8`, with the value `v` modulo `MS8`.
pub fn new(v: u32) -> Mersenne8 {
Mersenne8(v % MS8)
}
/// Takes `self` to the power of `exp`.
#[inline]
pub fn pow(self, exp: u32) -> Mersenne8 {
Mersenne8(modular_pow(self.0, exp, MS8))

Loading…
Cancel
Save