Struct tbn::arith::U256[][src]

#[repr(C)]pub struct U256(pub [u128; 2]);

256-bit, stack allocated biginteger for use in prime field arithmetic.

Implementations

impl U256[src]

pub fn from_slice(s: &[u8]) -> Result<U256, Error>[src]

Initialize U256 from slice of bytes (big endian)

pub fn to_big_endian(&self, s: &mut [u8]) -> Result<(), Error>[src]

pub fn zero() -> U256[src]

pub fn one() -> U256[src]

pub fn random<R: Rng>(rng: &mut R, modulo: &U256) -> U256[src]

Produce a random number (mod modulo)

pub fn is_zero(&self) -> bool[src]

pub fn set_bit(&mut self, n: usize, to: bool) -> bool[src]

pub fn get_bit(&self, n: usize) -> Option<bool>[src]

pub fn add(&mut self, other: &U256, modulo: &U256)[src]

Add other to self (mod modulo)

pub fn sub(&mut self, other: &U256, modulo: &U256)[src]

Subtract other from self (mod modulo)

pub fn mul(&mut self, other: &U256, modulo: &U256, inv: u128)[src]

Multiply self by other (mod modulo) via the Montgomery multiplication method.

pub fn neg(&mut self, modulo: &U256)[src]

Turn self into its additive inverse (mod modulo)

pub fn is_even(&self) -> bool[src]

pub fn invert(&mut self, modulo: &U256)[src]

Turn self into its multiplicative inverse (mod modulo)

pub fn bits(&self) -> BitIterator<'_>

Notable traits for BitIterator<'a>

impl<'a> Iterator for BitIterator<'a> type Item = bool;
[src]

Return an Iterator<Item=bool> over all bits from MSB to LSB.

Trait Implementations

impl Clone for U256[src]

impl Copy for U256[src]

impl Debug for U256[src]

impl Decodable for U256[src]

impl Encodable for U256[src]

impl Eq for U256[src]

impl From<[u64; 4]> for U256[src]

impl From<u64> for U256[src]

impl Ord for U256[src]

impl PartialEq<U256> for U256[src]

impl PartialOrd<U256> for U256[src]

impl StructuralEq for U256[src]

impl StructuralPartialEq for U256[src]

Auto Trait Implementations

impl RefUnwindSafe for U256

impl Send for U256

impl Sync for U256

impl Unpin for U256

impl UnwindSafe for U256

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.