pub struct Mpi { /* private fields */ }
Implementations§
Source§impl Mpi
impl Mpi
pub fn new(value: mpi_sint) -> Result<Mpi>
Sourcepub fn from_binary(num: &[u8]) -> Result<Mpi>
pub fn from_binary(num: &[u8]) -> Result<Mpi>
Initialize an MPI number from big endian binary data
pub fn get_bit(&self, bit: usize) -> bool
pub fn set_bit(&mut self, bit: usize, val: bool) -> Result<()>
Sourcepub fn less_than_const_time(&self, other: &Mpi) -> Result<bool>
pub fn less_than_const_time(&self, other: &Mpi) -> Result<bool>
Sourcepub fn cmp_const_time(&self, other: &Mpi) -> Result<Ordering>
pub fn cmp_const_time(&self, other: &Mpi) -> Result<Ordering>
Sourcepub fn eq_const_time(&self, other: &Mpi) -> Result<bool>
pub fn eq_const_time(&self, other: &Mpi) -> Result<bool>
Checks equalness with the other in constant time.
pub fn as_u32(&self) -> Result<u32>
pub fn sign(&self) -> Sign
pub fn to_string_radix(&self, radix: i32) -> Result<String>
Sourcepub fn to_binary_padded(&self, min_len: usize) -> Result<Vec<u8>>
pub fn to_binary_padded(&self, min_len: usize) -> Result<Vec<u8>>
Serialize the MPI as big endian binary data, padding to at least min_len bytes
Sourcepub fn bit_length(&self) -> Result<usize>
pub fn bit_length(&self) -> Result<usize>
Return size of this MPI in bits
Sourcepub fn byte_length(&self) -> Result<usize>
pub fn byte_length(&self) -> Result<usize>
Return size of this MPI in bytes (rounded up)
pub fn divrem(&self, other: &Mpi) -> Result<(Mpi, Mpi)>
pub fn divrem_int(&self, other: mpi_sint) -> Result<(Mpi, Mpi)>
pub fn modinv(&self, modulus: &Mpi) -> Result<Mpi>
Sourcepub fn mod_sqrt(&self, p: &Mpi) -> Result<Mpi>
pub fn mod_sqrt(&self, p: &Mpi) -> Result<Mpi>
Returns an integer a such that (a*a) === self (mod p)
The modulus must be prime; computing a square root modulo a composite number is equivalent to factoring the composite.
pub fn trailing_zeros(&self) -> usize
Trait Implementations§
Source§impl<'a> AddAssign<&'a Mpi> for Mpi
impl<'a> AddAssign<&'a Mpi> for Mpi
Source§fn add_assign(&mut self, other: &Mpi)
fn add_assign(&mut self, other: &Mpi)
Performs the
+=
operation. Read moreSource§impl AddAssign<i64> for Mpi
impl AddAssign<i64> for Mpi
Source§fn add_assign(&mut self, other: mpi_sint)
fn add_assign(&mut self, other: mpi_sint)
Performs the
+=
operation. Read moreSource§impl AddAssign for Mpi
impl AddAssign for Mpi
Source§fn add_assign(&mut self, other: Mpi)
fn add_assign(&mut self, other: Mpi)
Performs the
+=
operation. Read moreSource§impl<'a> DivAssign<&'a Mpi> for Mpi
Note this will panic if other == 0
impl<'a> DivAssign<&'a Mpi> for Mpi
Note this will panic if other == 0
Source§fn div_assign(&mut self, other: &Mpi)
fn div_assign(&mut self, other: &Mpi)
Performs the
/=
operation. Read moreSource§impl DivAssign<i64> for Mpi
Note this will panic if other == 0
impl DivAssign<i64> for Mpi
Note this will panic if other == 0
Source§fn div_assign(&mut self, other: mpi_sint)
fn div_assign(&mut self, other: mpi_sint)
Performs the
/=
operation. Read moreSource§impl DivAssign for Mpi
Note this will panic if other == 0
impl DivAssign for Mpi
Note this will panic if other == 0
Source§fn div_assign(&mut self, other: Mpi)
fn div_assign(&mut self, other: Mpi)
Performs the
/=
operation. Read moreSource§impl<'a> MulAssign<&'a Mpi> for Mpi
impl<'a> MulAssign<&'a Mpi> for Mpi
Source§fn mul_assign(&mut self, other: &Mpi)
fn mul_assign(&mut self, other: &Mpi)
Performs the
*=
operation. Read moreSource§impl MulAssign<i64> for Mpi
impl MulAssign<i64> for Mpi
Source§fn mul_assign(&mut self, other: mpi_sint)
fn mul_assign(&mut self, other: mpi_sint)
Performs the
*=
operation. Read moreSource§impl MulAssign for Mpi
impl MulAssign for Mpi
Source§fn mul_assign(&mut self, other: Mpi)
fn mul_assign(&mut self, other: Mpi)
Performs the
*=
operation. Read moreSource§impl Ord for Mpi
impl Ord for Mpi
Source§impl PartialOrd for Mpi
impl PartialOrd for Mpi
Source§impl<'a> RemAssign<&'a Mpi> for Mpi
Note this will panic if other == 0
impl<'a> RemAssign<&'a Mpi> for Mpi
Note this will panic if other == 0
Source§fn rem_assign(&mut self, other: &Mpi)
fn rem_assign(&mut self, other: &Mpi)
Performs the
%=
operation. Read moreSource§impl RemAssign<i64> for Mpi
Note this will panic if other == 0
impl RemAssign<i64> for Mpi
Note this will panic if other == 0
Source§fn rem_assign(&mut self, other: mpi_sint)
fn rem_assign(&mut self, other: mpi_sint)
Performs the
%=
operation. Read moreSource§impl RemAssign for Mpi
Note this will panic if other == 0
impl RemAssign for Mpi
Note this will panic if other == 0
Source§fn rem_assign(&mut self, other: Mpi)
fn rem_assign(&mut self, other: Mpi)
Performs the
%=
operation. Read moreSource§impl ShlAssign<usize> for Mpi
impl ShlAssign<usize> for Mpi
Source§fn shl_assign(&mut self, shift: usize)
fn shl_assign(&mut self, shift: usize)
Performs the
<<=
operation. Read moreSource§impl ShrAssign<usize> for Mpi
impl ShrAssign<usize> for Mpi
Source§fn shr_assign(&mut self, shift: usize)
fn shr_assign(&mut self, shift: usize)
Performs the
>>=
operation. Read moreSource§impl<'a> SubAssign<&'a Mpi> for Mpi
impl<'a> SubAssign<&'a Mpi> for Mpi
Source§fn sub_assign(&mut self, other: &Mpi)
fn sub_assign(&mut self, other: &Mpi)
Performs the
-=
operation. Read moreSource§impl SubAssign<i64> for Mpi
impl SubAssign<i64> for Mpi
Source§fn sub_assign(&mut self, other: mpi_sint)
fn sub_assign(&mut self, other: mpi_sint)
Performs the
-=
operation. Read moreSource§impl SubAssign for Mpi
impl SubAssign for Mpi
Source§fn sub_assign(&mut self, other: Mpi)
fn sub_assign(&mut self, other: Mpi)
Performs the
-=
operation. Read moreimpl Eq for Mpi
impl Send for Mpi
Auto Trait Implementations§
impl Freeze for Mpi
impl RefUnwindSafe for Mpi
impl !Sync for Mpi
impl Unpin for Mpi
impl UnwindSafe for Mpi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more