Struct librespot_core::diffie_hellman::DH_PRIME[][src]

pub struct DH_PRIME { /* fields omitted */ }

Methods from Deref<Target = BigUint>

pub fn to_bytes_be(&self) -> Vec<u8, Global>[src]

Returns the byte representation of the BigUint in big-endian byte order.

Examples

use num_bigint::BigUint;

let i = BigUint::parse_bytes(b"1125", 10).unwrap();
assert_eq!(i.to_bytes_be(), vec![4, 101]);

pub fn to_bytes_le(&self) -> Vec<u8, Global>[src]

Returns the byte representation of the BigUint in little-endian byte order.

Examples

use num_bigint::BigUint;

let i = BigUint::parse_bytes(b"1125", 10).unwrap();
assert_eq!(i.to_bytes_le(), vec![101, 4]);

pub fn to_u32_digits(&self) -> Vec<u32, Global>[src]

Returns the u32 digits representation of the BigUint ordered least significant digit first.

Examples

use num_bigint::BigUint;

assert_eq!(BigUint::from(1125u32).to_u32_digits(), vec![1125]);
assert_eq!(BigUint::from(4294967295u32).to_u32_digits(), vec![4294967295]);
assert_eq!(BigUint::from(4294967296u64).to_u32_digits(), vec![0, 1]);
assert_eq!(BigUint::from(112500000000u64).to_u32_digits(), vec![830850304, 26]);

pub fn to_str_radix(&self, radix: u32) -> String[src]

Returns the integer formatted as a string in the given radix. radix must be in the range 2...36.

Examples

use num_bigint::BigUint;

let i = BigUint::parse_bytes(b"ff", 16).unwrap();
assert_eq!(i.to_str_radix(16), "ff");

pub fn to_radix_be(&self, radix: u32) -> Vec<u8, Global>[src]

Returns the integer in the requested base in big-endian digit order. The output is not given in a human readable alphabet but as a zero based u8 number. radix must be in the range 2...256.

Examples

use num_bigint::BigUint;

assert_eq!(BigUint::from(0xFFFFu64).to_radix_be(159),
           vec![2, 94, 27]);
// 0xFFFF = 65535 = 2*(159^2) + 94*159 + 27

pub fn to_radix_le(&self, radix: u32) -> Vec<u8, Global>[src]

Returns the integer in the requested base in little-endian digit order. The output is not given in a human readable alphabet but as a zero based u8 number. radix must be in the range 2...256.

Examples

use num_bigint::BigUint;

assert_eq!(BigUint::from(0xFFFFu64).to_radix_le(159),
           vec![27, 94, 2]);
// 0xFFFF = 65535 = 27 + 94*159 + 2*(159^2)

pub fn bits(&self) -> usize[src]

Determines the fewest bits necessary to express the BigUint.

pub fn modpow(&self, exponent: &BigUint, modulus: &BigUint) -> BigUint[src]

Returns (self ^ exponent) % modulus.

Panics if the modulus is zero.

pub fn sqrt(&self) -> BigUint[src]

Returns the truncated principal square root of self -- see Roots::sqrt

pub fn cbrt(&self) -> BigUint[src]

Returns the truncated principal cube root of self -- see Roots::cbrt.

pub fn nth_root(&self, n: u32) -> BigUint[src]

Returns the truncated principal nth root of self -- see Roots::nth_root.

Trait Implementations

impl Deref for DH_PRIME[src]

type Target = BigUint

The resulting type after dereferencing.

impl LazyStatic for DH_PRIME[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,