Skip to main content

Challenge

Struct Challenge 

Source
pub struct Challenge { /* private fields */ }
Expand description

Deterministic byte stream SHA-256(seed ‖ u32be(ctr)), consumed sequentially.

Implementations§

Source§

impl Challenge

Source

pub fn seed(&self) -> [u8; 32]

The 32-byte seed (e.g. the commitment B of ro/kg-commit).

Source

pub fn bytes(&mut self, n: usize) -> Vec<u8> ⓘ

Source

pub fn bits(&mut self, n: u32) -> BoxedUint

Uniform integer below 2^n (precision n rounded up to whole limbs, at least 64).

Source

pub fn pm_pow2(&mut self, ell: u32) -> SBig

e ∈ ±2^ℓ: u − 2^{ℓ−1} + 1 for an ℓ-bit u (§10.3).

Source

pub fn small(&mut self, n: u32) -> u64

ℓ0-bit unsigned challenge as a small integer.

Source

pub fn scalar(&mut self) -> Scalar

Scalar of F_q: 64 bytes reduced modulo q.

Source

pub fn unit_mod(&mut self, m: &Modulus) -> Result<Residue>

y ∈ Z*_M: bits(M)+128 bits reduced mod M, next block while gcd(y, M) ≠ 1.

Source

pub fn qr_mod(&mut self, m: &Modulus) -> Result<Residue>

g ∈ QR_d \ {0, 1}: value mod d from the stream, squared.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.