Struct secret_integers::U128

source ·
pub struct U128(pub u128);

Tuple Fields§

§0: u128

Implementations§

source§

impl U128

source

pub fn classify<T: Into<u128>>(x: T) -> Self

source

pub fn declassify(self) -> u128

Warning: use with caution, breaks the constant-time guarantee.

source

pub fn zero() -> Self

source

pub fn one() -> Self

source

pub fn ones() -> Self

source

pub fn from_le_bytes(bytes: &[U8]) -> Vec<U128>

source

pub fn to_le_bytes(ints: &[U128]) -> Vec<U8>

source

pub fn from_be_bytes(bytes: &[U8]) -> Vec<U128>

source

pub fn to_be_bytes(ints: &[U128]) -> Vec<U8>

source

pub fn max_value() -> U128

source§

impl U128

source

pub fn checked_add(self, rhs: Self) -> Self

Warning: panics when overflow.

source§

impl U128

source

pub fn checked_sub(self, rhs: Self) -> Self

Warning: panics when overflow.

source§

impl U128

source

pub fn checked_mul(self, rhs: Self) -> Self

Warning: panics when overflow.

source§

impl U128

source

pub fn rotate_left(self, rotval: usize) -> Self

source

pub fn rotate_right(self, rotval: usize) -> Self

source§

impl U128

source

pub fn comp_eq(self, rhs: Self) -> Self

Produces a new integer which is all ones if the two arguments are equal and all zeroes otherwise. With inspiration from Wireguard.

source

pub fn comp_ne(self, rhs: Self) -> Self

Produces a new integer which is all ones if the first argument is different from the second argument, and all zeroes otherwise.

source

pub fn comp_gte(self, rhs: Self) -> Self

Produces a new integer which is all ones if the first argument is greater than or equal to the second argument, and all zeroes otherwise. With inspiration from WireGuard.

source

pub fn comp_gt(self, rhs: Self) -> Self

Produces a new integer which is all ones if the first argument is strictly greater than the second argument, and all zeroes otherwise.

source

pub fn comp_lte(self, rhs: Self) -> Self

Produces a new integer which is all ones if the first argument is less than or equal to the second argument, and all zeroes otherwise.

source

pub fn comp_lt(self, rhs: Self) -> Self

Produces a new integer which is all ones if the first argument is strictly less than the second argument, and all zeroes otherwise.

Trait Implementations§

source§

impl Add<U128> for U128

Warning: has wrapping semantics.

§

type Output = U128

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl AddAssign<U128> for U128

Warning: has wrapping semantics.

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl BitAnd<U128> for U128

§

type Output = U128

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
source§

impl BitAndAssign<U128> for U128

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitOr<U128> for U128

§

type Output = U128

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
source§

impl BitOrAssign<U128> for U128

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor<U128> for U128

§

type Output = U128

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
source§

impl BitXorAssign<U128> for U128

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl Clone for U128

source§

fn clone(&self) -> U128

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for U128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for U128

source§

fn default() -> U128

Returns the “default value” for a type. Read more
source§

impl Display for U128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<I128> for U128

source§

fn from(x: I128) -> U128

Converts to this type from the input type.
source§

impl From<U128> for I128

Warning: wrapping semantics.

source§

fn from(x: U128) -> I128

Converts to this type from the input type.
source§

impl From<U128> for U16

Warning: wrapping semantics.

source§

fn from(x: U128) -> U16

Converts to this type from the input type.
source§

impl From<U128> for U32

Warning: wrapping semantics.

source§

fn from(x: U128) -> U32

Converts to this type from the input type.
source§

impl From<U128> for U64

Warning: wrapping semantics.

source§

fn from(x: U128) -> U64

Converts to this type from the input type.
source§

impl From<U128> for U8

Warning: wrapping semantics.

source§

fn from(x: U128) -> U8

Converts to this type from the input type.
source§

impl From<U128> for u128

Warning: conversion can be lossy!

source§

fn from(x: U128) -> u128

Converts to this type from the input type.
source§

impl From<U16> for U128

source§

fn from(x: U16) -> U128

Converts to this type from the input type.
source§

impl From<U32> for U128

source§

fn from(x: U32) -> U128

Converts to this type from the input type.
source§

impl From<U64> for U128

source§

fn from(x: U64) -> U128

Converts to this type from the input type.
source§

impl From<U8> for U128

source§

fn from(x: U8) -> U128

Converts to this type from the input type.
source§

impl From<u128> for U128

source§

fn from(x: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for U128

source§

fn from(x: u16) -> U128

Converts to this type from the input type.
source§

impl From<u32> for U128

source§

fn from(x: u32) -> U128

Converts to this type from the input type.
source§

impl From<u64> for U128

source§

fn from(x: u64) -> U128

Converts to this type from the input type.
source§

impl From<u8> for U128

source§

fn from(x: u8) -> U128

Converts to this type from the input type.
source§

impl From<usize> for U128

source§

fn from(x: usize) -> U128

Converts to this type from the input type.
source§

impl LowerHex for U128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl Mul<U128> for U128

Warning: has wrapping semantics.

§

type Output = U128

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl MulAssign<U128> for U128

Warning: has wrapping semantics.

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Neg for U128

§

type Output = U128

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl Not for U128

§

type Output = U128

The resulting type after applying the ! operator.
source§

fn not(self) -> Self

Performs the unary ! operation. Read more
source§

impl Shl<usize> for U128

§

type Output = U128

The resulting type after applying the << operator.
source§

fn shl(self, rhs: usize) -> Self

Performs the << operation. Read more
source§

impl ShlAssign<usize> for U128

source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
source§

impl Shr<usize> for U128

§

type Output = U128

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: usize) -> Self

Performs the >> operation. Read more
source§

impl ShrAssign<usize> for U128

source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
source§

impl Sub<U128> for U128

Warning: has wrapping semantics.

§

type Output = U128

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign<U128> for U128

Warning: has wrapping semantics.

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Copy for U128

Auto Trait Implementations§

§

impl RefUnwindSafe for U128

§

impl Send for U128

§

impl Sync for U128

§

impl Unpin for U128

§

impl UnwindSafe for U128

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.