Module nonlinear_gates

Module nonlinear_gates 

Source
Expand description

Implementation of Different non-linear Gates used in SHA-2 family of circuits as described in NIST SP-180-4 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf

Structs§

ChGate
Multiplexer gate as defined by SHA-2 family of circuits.
ConstInputGate
Represents a constant input to the circuit. Unlike other gates, the ConstInputGate takes as input a name for the constant and its value and creates an input shred as well the MLE of input data that can be bound to the circuit at a later time.
MajGate
Bitwise majority selector gate as defined by SHA-2 family of Hash functions.
Sigma
The capital Sigma function described on Printed Page Number 10 in NIST SP-180.4. The const parameters ROTR1, ROTR2, ROTR3 denote the rotations defined in NIST spec. Bits are assumed to be in MSB first decomposition form.
SmallSigma
The Small Sigma function described on Printed Page Number 10 in NIST SP-180.4. The const parameters have following meaning ROTR1 : Value of rotation in first ROTR ROTR2 : Value of rotation in second ROTR SHR3 : Value of rotation in third SHR MSB-first bit decomposition required.

Traits§

IsBitDecomposable
A trait to deal with bit decomposition and bit rotation as needed by SHA-2 family of hash functions.

Functions§

bit_decompose_lsb_first
Decompose a numerical type in bits: LSB first
bit_decompose_msb_first
Decompose a numerical type in bits: MSB first
sha_words_2_num_vars 🔒