//! Multi Precision Integers.
use std::fmt;
use std::io::Write;
use std::cmp::Ordering;
use quickcheck::{Arbitrary, Gen};
use rand::Rng;
use constants::{
Curve,
HashAlgorithm,
PublicKeyAlgorithm,
SymmetricAlgorithm,
};
use crypto::hash::Hash;
use crypto::mem::{secure_cmp, Protected};
use serialize::Serialize;
use Error;
use Result;
use nettle;
/// Holds a single MPI.
#[derive(Clone, Hash)]
pub struct MPI {
/// Integer value as big-endian.
value: Box<[u8]>,
}
impl From<Vec<u8>> for MPI {
fn from(v: Vec<u8>) -> Self {
Self::new(&v)
}
}
impl MPI {
/// Creates a new MPI.
///
/// This function takes care of leading zeros.
pub fn new(value: &[