Struct botan::MPI[][src]

pub struct MPI { /* fields omitted */ }

A big integer type

Methods

impl MPI
[src]

Crate a new (zero-valued) MPI

Crate a new MPI setting value from an array of bytes (big-endian)

Crate a new MPI setting value from a i32

Crate a new MPI setting value from a u32

Crate a new MPI duplicating the value of self

Set self to value specified with an i32

Set self to value specified with a string

Set self to value specified with an array of bytes (big-endian)

Set self to zero

Set a specific bit of self

Clear a specific bit of self

Return the value of a bit in self

Randomize self to an integer of specified bit size

Randomize self to an integer within specified range

Return value of self as decimal string

Return value of self as hex string

Return value of self as a byte array (big endian)

Return number of significant bits

Return number of significant bytes

Return self as a u32, if it fits

Return true if self is an integer >= 0

Return true if self is an integer < 0

Return true if self is an integer == 0

Return true if self is odd

Return true if self is even

Return true if self equals other

Compare self with other

Flip the sign of self

Addition operator

Addition operator, assignment version

Addition operator

Addition operator, assignment version

Subtraction operator

Subtraction operator, assignment version

Subtraction operator

Subtraction operator, assignment version

Multiplication operator

Multiplication operator, assignment version

Bitwise left shift

Bitwise left shift, assignment version

Bitwise right shift

Bitwise right shift, assignment version

Division/modulo operator

Swap two MPI values

Perform a primality test on self

Examples

use std::str::FromStr;
let n = botan::MPI::from_str("1111111111111111111").unwrap();
let rng = botan::RandomNumberGenerator::new_system().unwrap();
assert!(n.is_prime(&rng, 128).unwrap());

Return the greatest common divisor of x and y

Examples

use std::str::FromStr;
let x = botan::MPI::from_str("1111111111111111").unwrap();
let y = botan::MPI::from_str("111111111111").unwrap();
assert_eq!(botan::MPI::gcd(&x, &y).unwrap(), botan::MPI::from_str("1111").unwrap());

Return the inverse of x modulo m, or 0 if gcd(x,m) > 1

Return (x^e) mod m

Trait Implementations

impl Drop for MPI
[src]

Executes the destructor for this type. Read more

impl Clone for MPI
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialOrd for MPI
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq for MPI
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for MPI
[src]

impl Ord for MPI
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl FromStr for MPI
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl Debug for MPI
[src]

Formats the value using the given formatter. Read more

impl Display for MPI
[src]

Formats the value using the given formatter. Read more

impl UpperHex for MPI
[src]

Formats the value using the given formatter.

impl LowerHex for MPI
[src]

Formats the value using the given formatter.

impl<'a> Add<&'a MPI> for MPI
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<'a, 'b> Add<&'a MPI> for &'b MPI
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl Add<u32> for MPI
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<'a> Add<u32> for &'a MPI
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<'a> AddAssign<&'a MPI> for MPI
[src]

Performs the += operation.

impl AddAssign<u32> for MPI
[src]

Performs the += operation.

impl<'a> Sub<&'a MPI> for MPI
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<'a, 'b> Sub<&'a MPI> for &'b MPI
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl Sub<u32> for MPI
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<'a> Sub<u32> for &'a MPI
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<'a> SubAssign<&'a MPI> for MPI
[src]

Performs the -= operation.

impl SubAssign<u32> for MPI
[src]

Performs the -= operation.

impl<'a> Mul<&'a MPI> for MPI
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, 'b> Mul<&'a MPI> for &'b MPI
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a> MulAssign<&'a MPI> for MPI
[src]

Performs the *= operation.

impl<'a, 'b> Div<&'b MPI> for &'a MPI
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl<'a> DivAssign<&'a MPI> for MPI
[src]

Performs the /= operation.

impl<'a, 'b> Rem<&'b MPI> for &'a MPI
[src]

The resulting type after applying the % operator.

Performs the % operation.

impl<'a> RemAssign<&'a MPI> for MPI
[src]

Performs the %= operation.

impl<'a> Shl<usize> for &'a MPI
[src]

The resulting type after applying the << operator.

Performs the << operation.

impl ShlAssign<usize> for MPI
[src]

Performs the <<= operation.

impl<'a> Shr<usize> for &'a MPI
[src]

The resulting type after applying the >> operator.

Performs the >> operation.

impl ShrAssign<usize> for MPI
[src]

Performs the >>= operation.

impl Neg for MPI
[src]

The resulting type after applying the - operator.

Performs the unary - operation.

Auto Trait Implementations

impl !Send for MPI

impl !Sync for MPI