openvm_sha2_circuit/sha2_chips/block_hasher_chip/
columns.rs

1use openvm_circuit_primitives_derive::ColsRef;
2use openvm_sha2_air::{
3    Sha2BlockHasherSubairConfig, Sha2DigestCols, Sha2DigestColsRef, Sha2DigestColsRefMut,
4    Sha2RoundCols, Sha2RoundColsRef, Sha2RoundColsRefMut,
5};
6
7// offset in the columns struct where the inner column start
8pub const INNER_OFFSET: usize = 1;
9
10// Just adding request_id to both columns structs
11#[repr(C)]
12#[derive(Clone, Copy, Debug, ColsRef)]
13#[config(Sha2BlockHasherSubairConfig)]
14pub struct Sha2BlockHasherRoundCols<
15    T,
16    const WORD_BITS: usize,
17    const WORD_U8S: usize,
18    const WORD_U16S: usize,
19    const ROUNDS_PER_ROW: usize,
20    const ROUNDS_PER_ROW_MINUS_ONE: usize,
21    const ROW_VAR_CNT: usize,
22> {
23    pub request_id: T,
24    pub inner: Sha2RoundCols<
25        T,
26        WORD_BITS,
27        WORD_U8S,
28        WORD_U16S,
29        ROUNDS_PER_ROW,
30        ROUNDS_PER_ROW_MINUS_ONE,
31        ROW_VAR_CNT,
32    >,
33}
34
35#[repr(C)]
36#[derive(Clone, Copy, Debug, ColsRef)]
37#[config(Sha2BlockHasherSubairConfig)]
38pub struct Sha2BlockHasherDigestCols<
39    T,
40    const WORD_BITS: usize,
41    const WORD_U8S: usize,
42    const WORD_U16S: usize,
43    const HASH_WORDS: usize,
44    const ROUNDS_PER_ROW: usize,
45    const ROUNDS_PER_ROW_MINUS_ONE: usize,
46    const ROW_VAR_CNT: usize,
47> {
48    pub request_id: T,
49    pub inner: Sha2DigestCols<
50        T,
51        WORD_BITS,
52        WORD_U8S,
53        WORD_U16S,
54        HASH_WORDS,
55        ROUNDS_PER_ROW,
56        ROUNDS_PER_ROW_MINUS_ONE,
57        ROW_VAR_CNT,
58    >,
59}