Module openssl::bn

source ·
Expand description

BigNum implementation

Large numbers are important for a cryptographic library. OpenSSL implementation of BigNum uses dynamically assigned memory to store an array of bit chunks. This allows numbers of any size to be compared and mathematical functions performed.

OpenSSL wiki describes the BIGNUM data structure.

Examples

use openssl::bn::BigNum;
use openssl::error::ErrorStack;

fn main() -> Result<(), ErrorStack> {
  let a = BigNum::new()?; // a = 0
  let b = BigNum::from_dec_str("1234567890123456789012345")?;
  let c = &a * &b;
  assert_eq!(a, c);
  Ok(())
}

Structs