Crate openvm_sha256_air

Source
Expand description

Implementation of the SHA256 compression function without padding This this AIR doesn’t constrain any of the message padding

Structs§

Sha256Air
Expects the message to be padded to a multiple of 512 bits
Sha256DigestCols
Sha256FlagsCols
Sha256MessageHelperCols
These are the columns that are used to help with the message schedule additions Note: these need to be correctly assigned for every row even on padding rows
Sha256MessageScheduleCols
Sha256RoundCols
In each SHA256 block:
Sha256WorkVarsCols

Constants§

SHA256_BLOCK_BITS
Number of bits in a SHA256 block
SHA256_BLOCK_U8S
Number of cells in a SHA256 block
SHA256_BLOCK_WORDS
Number of words in a SHA256 block
SHA256_BUFFER_SIZE
Size of the buffer of the first 4 rows of a block (each row’s size)
SHA256_DIGEST_WIDTH
Width of the Sha256DigestCols
SHA256_H
SHA256 initial hash values
SHA256_HASH_WORDS
Number of words in a SHA256 hash
SHA256_K
SHA256 constant K’s
SHA256_ROUNDS_PER_ROW
Number of rounds per row
SHA256_ROUND_WIDTH
Width of the Sha256RoundCols
SHA256_ROWS_PER_BLOCK
Number of rows per block
SHA256_ROW_VAR_CNT
Number of vars needed to encode the row index with Encoder
SHA256_WIDTH
Width of the Sha256Cols
SHA256_WORD_BITS
Number of bits in a SHA256 word
SHA256_WORD_U8S
Number of 8-bit limbs in a SHA256 word
SHA256_WORD_U16S
Number of 16-bit limbs in a SHA256 word

Functions§

big_sig0
Big sigma_0 function from SHA256
big_sig1
Big sigma_1 function from SHA256
ch
Choose function from SHA256
compose
Composes a list of limb values into a single field element
constraint_word_addition
Constrain the addition of SHA256_WORD_BITS bit words in 16-bit limbs It takes in the terms some in bits some in 16-bit limbs, the expected sum in bits and the carries
generate_trace
records consists of pairs of (input_block, is_last_block).
get_flag_pt_array
Wrapper of get_flag_pt to get the flag pointer as an array
get_random_message
Generate a random message of a given length
limbs_into_u32
Convert a list of limbs in little endian into a u32
maj
Majority function from SHA256
small_sig0
Small sigma_0 function from SHA256
small_sig1
Small sigma_1 function from SHA256
u32_into_limbs
Convert a u32 into a list of limbs in little endian