Trait clacc::BigInt

source ·
pub trait BigInt: 'static + Default + From<i64> + for<'a> From<&'a [u8]> + Clone + Sized + Send + Sync + Eq + PartialOrd + Serialize + for<'de> Deserialize<'de> + Debug + Display + LowerHex + UpperHex {
    fn add<'a>(&self, other: &'a Self) -> Self;
    fn sub<'a>(&self, other: &'a Self) -> Self;
    fn mul<'a>(&self, other: &'a Self) -> Self;
    fn div<'a>(&self, other: &'a Self) -> Self;
    fn gcdext<'a>(&self, y: &'a Self) -> (Self, Self, Self);
    fn modulus<'a>(&self, m: &'a Self) -> Self;
    fn powm<'a>(&self, e: &'a Self, m: &Self) -> Self;
    fn invert<'a>(&self, m: &'a Self) -> Option<Self>;
    fn next_prime(&self) -> Self;
    fn size_in_bits(&self) -> usize;
    fn to_vec(&self) -> Vec<u8>;
}
Expand description

A trait describing an arbitrary precision integer.

Required Methods§

Returns self + other.

Returns self - other.

Returns self * other.

Returns self / other.

Returns the greatest common divisor of self and the coefficients a and b satisfying a*x + b*y = g.

Return the modulus of self / m.

Returns self^e mod m.

Returns self^-1 mod m.

Returns the next prime greater than self.

Returns the size of the number in bits.

Export the number as a u8 vector.

Implementors§