Halo2 学习笔记——Gadgets 之 SHA-256

1. 引言

SHA-256详细说明参见 NIST FIPS PUB 180-4

与该说明书不同之处在于,Halo2中使用 ⊞ \boxplus 来表示addition modulo 2 32 2^{32} 232 + + + 来表示field addition, ⊕ \oplus 来表示 XOR。

2. Gadget interface

SHA-256用8个32-bit变量来维护state,其输入为512-bit blocks,内部会将这些blocks切分为32-bit chunks,因此设计了SHA-256 gadget来consume input in 32-bit chunks。

3. Chip instructions

SHA-256 gadget需要具有如下指令的chip:

# extern crate halo2;
# use halo2::plonk::Error;
# use std::fmt;
#
# trait Chip: Sized {}
# trait Layouter<C: Chip> {}
const BLOCK_SIZE: usize = 16;
const DIGEST_SIZE: usize = 8;

pub trait Sha256Instructions: Chip {
    /// Variable representing the SHA-256 internal state.
    type State: Clone + fmt::Debug;
    /// Variable representing a 32-bit word of the input block to the SHA-256 compression
    /// function.
    type BlockWord: Copy + fmt::Debug;

    /// Places the SHA-256 IV in the circuit, returning the initial state variable.
    fn initialization_vector(layouter: &mut impl Layouter<Self>) -> Result<Self::State, Error>;

    /// Starting from the given initial state, processes a block of input and returns the
    /// final state.
    fn compress(
        layouter: &mut impl Layouter<Self>,
        initial_state: &Self::State,
        input: [Self::BlockWord; BLOCK_SIZE],
    ) -> Result<Self::State, Error>;

    /// Converts the given state into a message digest.
    fn digest(
        layouter: &mut impl Layouter<Self>,
        state: &Self::State,
    ) -> Result<[Self::BlockWord; DIGEST_SIZE], Error>;
}

这些指令用于strike a balance between the reusability of the instructions and the scope for chips to internally optimise them。特别地,考虑将compression function 按其组成部分切分为 Ch, Maj等等,并提供a compression function gadget 来实现the round logic。但是,这将阻止chips from using relative references between the various parts of a compression round。采用一个指令来实现所有的compression rounds则类似于the Intel SHA extensions——提供了一个指令来运行多个compression rounds。

4. 16-bit table chip for SHA-256

Halo2中的chip for SHA-256实现是基于a single 16-bit lookup table的。其最少需要 2 16 2^{16} 216 circuit rows,从而也适合用于larger circuits中。

Halo2中定义的最大constraint degree为 9 9 9,将支持进行constraining carries 和 “small pieces” to a range of up to { 0..7 } \{0..7\} { 0..7} in one row。

4.1 Compression round

一共有64 compression rounds。每一轮的输入为32-bit values A , B , C , D , E , F , G , H A, B, C,D,E,F,G,H A,B,C,D,E,F,G,H,并执行如下操作:
C h ( E , F , G ) = ( E ∧ F ) ⊕ ( ¬ E ∧ G ) M a j ( A , B , C ) = ( A ∧ B ) ⊕ ( A ∧ C ) ⊕ ( B ∧ C ) = c o u n t ( A , B , C ) ≥ 2 Σ 0 ( A ) = ( A ⋙ 2 ) ⊕ ( A ⋙ 13 ) ⊕ ( A ⋙ 22 ) Σ 1 ( E ) = ( E ⋙ 6 ) ⊕ ( E ⋙ 11 ) ⊕ ( E ⋙ 25 ) H ′ = H + C h ( E , F , G ) + Σ 1 ( E ) + K t + W t E n e w = r e d u c e 6 ( H ′ + D ) A n e w = r e d u c e 7 ( H ′ + M a j ( A , B , C ) + Σ 0 ( A ) ) \begin{array}{rcl} Ch(E, F, G) &=& (E \wedge F) \oplus (¬E \wedge G) \\ Maj(A, B, C) &=& (A \wedge B) \oplus (A \wedge C) \oplus (B \wedge C) \\ &=& count(A, B, C) \geq 2 \\ \Sigma_0(A) &=& (A ⋙ 2) \oplus (A ⋙ 13) \oplus (A ⋙ 22) \\ \Sigma_1(E) &=& (E ⋙ 6) \oplus (E ⋙ 11) \oplus (E ⋙ 25) \\ H' &=& H + Ch(E, F, G) + \Sigma_1(E) + K_t + W_t \\ E_{new} &=& reduce_6(H' + D) \\ A_{new} &=& reduce_7(H' + Maj(A, B, C) + \Sigma_0(A)) \end{array} Ch(E,F,G)Maj(A,B,C)Σ0(A)Σ1(E)HEnewAnew========(EF)(¬EG)(AB)(AC)(BC)count(A,B,C)2(A2)(A13)(A22)(E6)(E11)(E25)H+Ch(E,F,G)+Σ1(E)+Kt+Wtreduce6(H+D)reduce7(H+Maj(A,B,C)+Σ0(A))
其中 r e d u c e i reduce_i reducei 必须handle a carry 0 ≤ c a r r y < i 0\leq carry <i 0carry<i
在这里插入图片描述
定义 s p r e a d \mathtt{spread} spread 为 a table mapping a 16 16 16-bit input to an output interleaved with zero bits。不需要一个单独的table来进行 range checks 因为可复用 s p r e a d \mathtt{spread} spread

4.2 Modular addition

对于addition modulo 2 32 2^{32} 232
a ⊞ b = c a \boxplus b = c ab=c
将其切分为 16 16 16-bit chunks表示为:
( a L : Z 2 16 , a H : Z 2 16 ) ⊞ ( b L : Z 2 16 , b H : Z 2 16 ) = ( c L : Z 2 16 , c H : Z 2 16 ) (a_L : \mathbb{Z}_{2^{16}}, a_H : \mathbb{Z}_{2^{16}}) \boxplus (b_L : \mathbb{Z}_{2^{16}}, b_H : \mathbb{Z}_{2^{16}}) = (c_L : \mathbb{Z}_{2^{16}}, c_H : \mathbb{Z}_{2^{16}}) (aL:Z216,aH:Z216)(bL:Z216,bH:Z216)=(cL:Z216,cH:Z216)
使用field addition重组表示为:
c a r r y ⋅ 2 32 + c H ⋅ 2 16 + c L = ( a H + b H ) ⋅ 2 16 + a L + b L \mathsf{carry} \cdot 2^{32} + c_H \cdot 2^{16} + c_L = (a_H + b_H) \cdot 2^{16} + a_L + b_L carry232+cH216+cL=(aH+bH)216+aL+bL
注意,此处正确处理了the carry from a L + b L a_L+b_L aL+bL
更一般地说,可将output分解为任意bit,而不仅仅是分解为 16 16 16-bit chunks。

该constraint要求每个chunk都正确range-checked了(否则,会存在field溢出的问题):

  • The operand and result chunks 可使用 s p r e a d \mathtt{spread} spread来constrained,通过looking up each chunk in the “dense” column within a subset of the table。This way we additionally get the “spread” form of the output for free; in particular this is true for the output of the bottom-right ⊞ \boxplus which becomes A n e w A_{new} Anew, and the output of the leftmost ⊞ \boxplus which becomes E n e w E_{new} Enew. 后续将使用该方法来优化 M a j Maj Maj C h Ch Ch
  • c a r r y \mathsf{carry} carry must be constrained to the precise range of allowed carry values for the number of operands. 采用的方法为:small range constraint

4.3 Maj function

M a j Maj Maj函数可通过 4 4 4个lookups来实现: 2    s p r e a d ∗ 2 2\; \mathtt{spread} * 2 2spread2 chunks:

  • 如上所述,在第一轮之后,有 A A A in spread form A ′ A' A。类似的,有 B B B等于前一轮的 A A A(可假设其为spread form B ′ B' B), C C C等于前一轮的 B B B(可假设其为spread form C ′ C' C),如论是源于the fixed IV,还是源于the use of s p r e a d \mathtt{spread} spread to reduce the output of the feedforward in the previous block。
  • Add the spread forms in the field: M ′ = A ′ + B ′ + C ′ M'=A'+B'+C' M=A+B+C
    • 可add as 32 32 32-bit words 或 add in pieces,二者效果是等价的。
  • Witness the compressed even bits M i e v e n M_i^{even} Mieven and the compressed odd bits M i o d d M_i^{odd} Miodd for i = { 0..1 } i=\{0..1\} i={ 0..1}
  • Constrain M ′ = s p r e a d ( M 0 e v e n ) + 2 ⋅ s p r e a d ( M 0 o d d ) + 2 32 ⋅ s p r e a d ( M 1 e v e n ) + 2 33 ⋅ s p r e a d ( M 1 o d d ) M' = \mathtt{spread}(M^{even}_0) + 2 \cdot \mathtt{spread}(M^{odd}_0) + 2^{32} \cdot \mathtt{spread}(M^{even}_1) + 2^{33} \cdot \mathtt{spread}(M^{odd}_1) M=spread(M0even)+2spread(M0odd)+232spread(M1even)+233spread(M1odd), 其中 M i o d d M^{odd}_i Miodd M a j Maj Maj函数的输出。

注意:“even” bits, 意味着the bits of weight an even-power of 2 2 2,即 of weight 2 0 , 2 2 , ⋯ 2^0,2^2,\cdots 20,22,。类似地,“odd” bits意味着the bits of weight an odd-power of 2 2 2,即 of weight 2 1 , 2 3 , ⋯ 2^1,2^3,\cdots 21,23,

4.4 Ch function

【TODO:借助an additional table可进一步优化为仅需4个或5个lookups。】
C h Ch Ch函数可通过 8 8 8个lookups来实现: 4    s p r e a d ∗ 2 4\; \mathtt{spread} * 2 4spread2 chunks:

  • 如上所述,在第一轮之后,有 E E E in spread form E ′ E' E。类似的,有 F F F等于前一轮的 E E E(可假设其为spread form E ′ E' E), G G G等于前一轮的 F F F(可假设其为spread form G ′ G' G),如论是源于the fixed IV,还是源于the use of s p r e a d \mathtt{spread} spread to reduce the output of the feedforward in the previous block。
  • 计算: P ′ = E ′ + F ′ P'=E'+F' P=E+F Q ′ = ( e v e n s − E ′ ) + G ′ Q'=(evens-E')+G' Q=(evensE)+G,其中 e v e n s = s p r e a d ( 2 32 − 1 ) evens=\mathtt{spread}(2^{32}-1) evens=spread(2321)
    • 可add as 32 32 32-bit words 或 add in pieces,二者效果是等价的。
    • e v e n s − E ′ evens-E' evensE用于计算the spread of ¬ E ¬E ¬E,计算negation和 s p r e a d \mathtt{spread} spread并不交互通讯。可实现,是因为 E ′ E' E中的每个spread bit都subtracted from 1 1 1,因此不存在borrows。
  • Witness P i e v e n , P i o d d , Q i e v e n , Q i o d d P_i^{even},P_i^{odd},Q_i^{even}, Q_i^{odd} Pieven,Piodd,Qieven,Qiodd,使得 P ′ = s p r e a d ( P 0 e v e n ) + 2 ⋅ s p r e a d ( P 0 o d d ) + 2 32 ⋅ s p r e a d ( P 1 e v e n ) + 2 33 ⋅ s p r e a d ( P 1 o d d ) P' = \mathtt{spread}(P^{even}_0) + 2 \cdot \mathtt{spread}(P^{odd}_0) + 2^{32} \cdot \mathtt{spread}(P^{even}_1) + 2^{33} \cdot \mathtt{spread}(P^{odd}_1) P=spread(P0even)+2spread(P0odd)+232spread(P1even)+233spread(P1odd) Q ′ = s p r e a d ( Q 0 e v e n ) + 2 ⋅ s p r e a d ( Q 0 o d d ) + 2 32 ⋅ s p r e a d ( Q 1 e v e n ) + 2 33 ⋅ s p r e a d ( Q 1 o d d ) Q' = \mathtt{spread}(Q^{even}_0) + 2 \cdot \mathtt{spread}(Q^{odd}_0) + 2^{32} \cdot \mathtt{spread}(Q^{even}_1) + 2^{33} \cdot \mathtt{spread}(Q^{odd}_1) Q=spread(Q0even)+2spread(Q0odd)+232spread(Q1even)+233spread(Q1odd)
  • { P i o d d + Q i o d d } i = 0..1 \{P^{odd}_i + Q^{odd}_i\}_{i=0..1} { Piodd+Qiodd}i=0..1 C h Ch Ch函数的输出。

4.5 Σ_0 function

Σ 0 ( A ) \Sigma_0(A) Σ0(A) 可通过 6 6 6个 lookups来实现。
为此,需将 A A A切分为pieces ( a , b , c , d ) (a,b,c,d) (a,b,c,d),lengths分别为 ( 2 , 11 , 9 , 10 ) (2,11,9,10) (2,11,9,10) counting from the little end。同时,可获得这些pieces 的spread forms。具体实现方案为:
借助2个PLONK rows。因为 10 10 10-bit piece和 11 11 11-bit piece可使用 s p r e a d \mathtt{spread} spread lookup来处理,而 9 9 9-bit piece 可切分为 3 ∗ 3 3*3 33 subpieces。最后的 2 2 2-bit piece可range-checked by polynomial constraints in parallel with the two lookups, two small pieces in each row。可通过插值来找到the spread forms of these small pieces。

注意,切分为pieces的过程可与 A n e w A_{new} Anew的reduction结合在一起实现,即,不再需要为 A n e w A_{new} Anew构建额外的lookup。最后一轮,reduce A n e w A_{new} Anew after adding the feedforward (requiring a carry of up to 7 7 7 which is fine)。
( A ⋙ 2 ) ⊕ ( A ⋙ 13 ) ⊕ ( A ⋙ 22 ) (A ⋙ 2) \oplus (A ⋙ 13) \oplus (A ⋙ 22) (A2)(A13)(A22) 等价为
( A ⋙ 2 ) ⊕ ( A ⋙ 13 ) ⊕ ( A ⋘ 10 ) (A ⋙ 2) \oplus (A ⋙ 13) \oplus (A ⋘ 10) (A2)(A13)(A10)
在这里插入图片描述
然后,再使用4个 s p r e a d \mathtt{spread} spread lookups来获取the even bits of a linear combination of the pieces的结果:
( a ∣ ∣ d ∣ ∣ c ∣ ∣ b ) ⊕ ( b ∣ ∣ a ∣ ∣ d ∣ ∣ c ) ⊕ ( c ∣ ∣ b ∣ ∣ a ∣ ∣ d ) ⇓ R ′ = 4 30 a + 4 20 d + 4 11 c + b    + 4 21 b + 4 19 a + 4 9 d + c    + 4 23 c + 4 12 b + 4 10 a + d    \begin{array}{rcccccccl} & (a &||& d &||& c &||& b) & \oplus \\ & (b &||& a &||& d &||& c) & \oplus \\ & (c &||& b &||& a &||& d) & \\ &&&&\Downarrow \\ R' = & 4^{30} a &+& 4^{20} d &+& 4^{11} c &+& b\;&+ \\ & 4^{21} b &+& 4^{19} a &+& 4^{ 9} d &+& c\;&+ \\ & 4^{23} c &+& 4^{12} b &+& 4^{10} a &+& d\;& \end{array} R=(a(b(c430a421b423c+++dab420d419a412b+++cda411c49d410a+++b)c)d)bcd++
此时,witness the compressed even bits R i e v e n R_i^{even} Rieven and the compressed odd bits R i o d d R_i^{odd} Riodd,并constrain:
R ′ = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) R' = \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) R=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
其中 { R i e v e n } i = 0..1 \{R^{even}_i\}_{i=0..1} { Rieven}i=0..1即为 Σ 0 \Sigma_0 Σ0函数的输出。

4.6 Σ_1 function

Σ 1 ( E ) \Sigma_1(E) Σ1(E) 可通过 6 6 6个 lookups来实现。
为此,需将 E E E切分为pieces ( a , b , c , d ) (a,b,c,d) (a,b,c,d),lengths分别为 ( 6 , 5 , 14 , 7 ) (6,5,14,7) (6,5,14,7) counting from the little end。同时,可获得这些pieces 的spread forms。具体实现方案为:
借助2个PLONK rows。因为 7 7 7-bit piece和 14 14 14-bit piece可使用 s p r e a d \mathtt{spread} spread lookup来处理,而 5 5 5-bit piece 可切分为 3 3 3-bit subpiece 和 2 2 2-bit subpiece, 6 6 6-bit piece可切分为 2 ∗ 3 2*3 23-bit subpieces。这4种small pieces可range-checked by polynomial constraints in parallel with the two lookups, two small pieces in each row。可通过插值来找到the spread forms of these small pieces。

注意,切分为pieces的过程可与 E n e w E_{new} Enew的reduction结合在一起实现,即,不再需要为 E n e w E_{new} Enew构建额外的lookup。最后一轮,reduce E n e w E_{new} Enew after adding the feedforward (requiring a carry of up to 6 6 6 which is fine)。
( E ⋙ 6 ) ⊕ ( E ⋙ 11 ) ⊕ ( E ⋙ 25 ) (E ⋙ 6) \oplus (E ⋙ 11) \oplus (E ⋙ 25) (E6)(E11)(E25) is equivalent to
( E ⋙ 6 ) ⊕ ( E ⋙ 11 ) ⊕ ( E ⋘ 7 ) (E ⋙ 6) \oplus (E ⋙ 11) \oplus (E ⋘ 7) (E6)(E11)(E7)
在这里插入图片描述
然后,再使用4个 s p r e a d \mathtt{spread} spread lookups来获取the even bits of a linear combination of the pieces的结果:(与 Σ 0 \Sigma_0 Σ0的实现类似)
( a ∣ ∣ d ∣ ∣ c ∣ ∣ b ) ⊕ ( b ∣ ∣ a ∣ ∣ d ∣ ∣ c ) ⊕ ( c ∣ ∣ b ∣ ∣ a ∣ ∣ d ) ⇓ R ′ = 4 26 a + 4 19 d + 4 5 c + b    + 4 27 b + 4 21 a + 4 14 d + c    + 4 18 c + 4 13 b + 4 7 a + d    \begin{array}{rcccccccl} & (a &||& d &||& c &||& b) & \oplus \\ & (b &||& a &||& d &||& c) & \oplus \\ & (c &||& b &||& a &||& d) & \\ &&&&\Downarrow \\ R' = & 4^{26} a &+& 4^{19} d &+& 4^{ 5} c &+& b\;&+ \\ & 4^{27} b &+& 4^{21} a &+& 4^{14} d &+& c\;&+ \\ & 4^{18} c &+& 4^{13} b &+& 4^{ 7} a &+& d\;& \end{array} R=(a(b(c426a427b418c+++dab419d421a413b+++cda45c414d47a+++b)c)d)bcd++
此时,witness the compressed even bits R i e v e n R_i^{even} Rieven and the compressed odd bits R i o d d R_i^{odd} Riodd,并constrain:
R ′ = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) R' = \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) R=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
其中 { R i e v e n } i = 0..1 \{R^{even}_i\}_{i=0..1} { Rieven}i=0..1即为 Σ 1 \Sigma_1 Σ1函数的输出。

5. Block decomposition

对于每一个block M ∈ { 0 , 1 } 512 M\in\{0,1\}^{512} M{ 0,1}512 of the padded message,其每个 64 64 64 words of 32 32 32 bits的构建方式如下:(注意 W W W word的索引从 0 0 0开始。)

  • 1)前 16 16 16个words 为将 M M M切分为 32 32 32-bit blocks:
    M = W 0 ∣ ∣ W 1 ∣ ∣ ⋯ ∣ ∣ W 14 ∣ ∣ W 15 M = W_0 || W_1 || \cdots || W_{14} || W_{15} M=W0W1W14W15
  • 2)剩下的 48 48 48个words采用如下公式构建,for 16 ≤ i < 64 16\leq i<64 16i<64
    W i = σ 1 ( W i − 2 ) ⊞ W i − 7 ⊞ σ 0 ( W i − 15 ) ⊞ W i − 16 W_i = \sigma_1(W_{i-2}) \boxplus W_{i-7} \boxplus \sigma_0(W_{i-15}) \boxplus W_{i-16} Wi=σ1(Wi2)Wi7σ0(Wi15)Wi16

其中:(注意 ≫ ≫ 为right-shift,而不是rotation。)
σ 0 ( X ) = ( X ⋙ 7 ) ⊕ ( X ⋙ 18 ) ⊕ ( X ≫ 3 ) σ 1 ( X ) = ( X ⋙ 17 ) ⊕ ( X ⋙ 19 ) ⊕ ( X ≫ 10 ) \begin{array}{ccc} \sigma_0(X) &=& (X ⋙ 7) \oplus (X ⋙ 18) \oplus (X ≫ 3) \\ \sigma_1(X) &=& (X ⋙ 17) \oplus (X ⋙ 19) \oplus (X ≫ 10) \\ \end{array} σ0(X)σ1(X)==(X7)(X18)(X3)(X17)(X19)(X10)

5.1 σ_0 function

( X ⋙ 7 ) ⊕ ( X ⋙ 18 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋙ 18) \oplus (X ≫ 3) (X7)(X18)(X3) 等价为
( X ⋙ 7 ) ⊕ ( X ⋘ 14 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋘ 14) \oplus (X ≫ 3) (X7)(X14)(X3)
在这里插入图片描述
如上,具有pieces ( a , b , c , d ) (a,b,c,d) (a,b,c,d) of lengths ( 3 , 4 , 11 , 14 ) (3,4,11,14) (3,4,11,14) counting from the little end。将 b b b切分为2个 2 2 2-bit subpieces。
( 0 [ 3 ] ∣ ∣ d ∣ ∣ c ∣ ∣ b ) ⊕ (        b ∣ ∣ a ∣ ∣ d ∣ ∣ c ) ⊕ (        c ∣ ∣ b ∣ ∣ a ∣ ∣ d ) ⇓ R ′ = 4 15 d + 4 4 c + b    + 4 28 b + 4 25 a + 4 11 d + c    + 4 21 c + 4 17 b + 4 14 a + d    \begin{array}{rcccccccl} & (0^{[3]} &||& d &||& c &||& b) & \oplus \\ & (\;\;\;b &||& a &||& d &||& c) & \oplus \\ & (\;\;\;c &||& b &||& a &||& d) & \\ &&&&\Downarrow \\ R' = & & & 4^{15} d &+& 4^{ 4} c &+& b\;&+ \\ & 4^{28} b &+& 4^{25} a &+& 4^{11} d &+& c\;&+ \\ & 4^{21} c &+& 4^{17} b &+& 4^{14} a &+& d\;& \end{array} R=(0[3](b(c428b421c++dab415d425a417b+++cda44c411d414a+++b)c)d)bcd++

5.2 σ_1 function

( X ⋙ 17 ) ⊕ ( X ⋙ 19 ) ⊕ ( X ≫ 10 ) (X ⋙ 17) \oplus (X ⋙ 19) \oplus (X ≫ 10) (X17)(X19)(X10) 等价为
( X ⋘ 15 ) ⊕ ( X ⋘ 13 ) ⊕ ( X ≫ 10 ) (X ⋘ 15) \oplus (X ⋘ 13) \oplus (X ≫ 10) (X15)(X13)(X10)
在这里插入图片描述
TODO:上图与公式表达不匹配,此处只是为了之前的图片保持一致。

如上,具有pieces ( a , b , c , d ) (a,b,c,d) (a,b,c,d) of lengths ( 10 , 7 , 2 , 13 ) (10,7,2,13) (10,7,2,13) counting from the little end。将 b b b切分为 ( 3 , 2 , 2 ) (3,2,2) (3,2,2)-bit subpieces。
( 0 [ 10 ] ∣ ∣ d ∣ ∣ c ∣ ∣ b ) ⊕ (        b ∣ ∣ a ∣ ∣ d ∣ ∣ c ) ⊕ (        c ∣ ∣ b ∣ ∣ a ∣ ∣ d ) ⇓ R ′ = 4 9 d + 4 7 c + b    + 4 25 b + 4 15 a + 4 2 d + c    + 4 30 c + 4 23 b + 4 13 a + d    \begin{array}{rcccccccl} & (0^{[10]}&||& d &||& c &||& b) & \oplus \\ & (\;\;\;b &||& a &||& d &||& c) & \oplus \\ & (\;\;\;c &||& b &||& a &||& d) & \\ &&&&\Downarrow \\ R' = & & & 4^{ 9} d &+& 4^{ 7} c &+& b\;&+ \\ & 4^{25} b &+& 4^{15} a &+& 4^{ 2} d &+& c\;&+ \\ & 4^{30} c &+& 4^{23} b &+& 4^{13} a &+& d\;& \end{array} R=(0[10](b(c425b430c++dab49d415a423b+++cda47c42d413a+++b)c)d)bcd++

5.3 Message scheduling

σ 0 \sigma_0 σ0用于 W 1..48 W_{1..48} W1..48,将 σ 1 \sigma_1 σ1用于 W 14..61 W_{14..61} W14..61,为了避免重复使用 s p r e a d \mathtt{spread} spread,可将 W 14..48 W_{14..48} W14..48 σ 0 \sigma_0 σ0 σ 1 \sigma_1 σ1合并。将piece lengths ( 3 , 4 , 11 , 14 ) (3,4,11,14) (3,4,11,14) ( 10 , 7 , 2 , 13 ) (10,7,2,13) (10,7,2,13)合并为piece lengths ( 3 , 4 , 3 , 7 , 1 , 1 , 13 ) (3,4,3,7,1,1,13) (3,4,3,7,1,1,13)
在这里插入图片描述
若可将merged结果split 为3行(当分别对 σ 0 \sigma_0 σ0 σ 1 \sigma_1 σ1 split时,则一共需要4行),则可节约35行。
【TODO:甚至可以将结果split为2行。】

当用于计算subsequent words时,可将reduction mod 2 32 2^{32} 232 of W 16..61 W_{16..61} W16..61与splitting 过程 结合,类似于round function 中对 A A A E E E的处理。

由于 W 62..63 W_{62..63} W62..63未split,仍需对于 W 62..63 W_{62..63} W62..63进行split。(技术上,可让于 W 62..63 W_{62..63} W62..63保持为unreduced,因为当稍后用于计算 A n e w A_{new} Anew E n e w E_{new} Enew时会进行reduce,但是,这需要处理的carry将大至 10 10 10而不是 6 6 6,因此不值得采用该方案。)

最终的message schedule cost为:

  • 2 2 2 rows to constrain W 0 W_0 W0 to 32 32 32 bits
    • This is technically optional, but let’s do it for robustness, since the rest of the input is constrained for free.
  • 13 ∗ 2 13*2 132 rows to split W 1..13 W_{1..13} W1..13 into ( 3 , 4 , 11 , 14 ) (3, 4, 11, 14) (3,4,11,14)-bit pieces
  • 35 ∗ 3 35*3 353 rows to split W 14..48 W_{14..48} W14..48 into ( 3 , 4 , 3 , 7 , 1 , 1 , 13 ) (3, 4, 3, 7, 1, 1, 13) (3,4,3,7,1,1,13)-bit pieces (merged with a reduction for W 16..48 W_{16..48} W16..48)
  • 13 ∗ 2 13*2 132 rows to split W 49..61 W_{49..61} W49..61 into ( 10 , 7 , 2 , 13 ) (10, 7, 2, 13) (10,7,2,13)-bit pieces (merged with a reduction)
  • 4 ∗ 48 4*48 448 rows to extract the results of σ 0 \sigma_0 σ0 for W 1..48 W_{1..48} W1..48
  • 4 ∗ 48 4*48 448 rows to extract the results of σ 1 \sigma_1 σ1 for W 14..61 W_{14..61} W14..61
  • 2 ∗ 2 2*2 22 rows to reduce W 62..63 W_{62..63} W62..63
  • = 547 = 547 =547 rows.

6. Overall cost

对于每一轮,有:

  • 8 8 8 rows for C h Ch Ch
  • 4 4 4 rows for M a j Maj Maj
  • 6 6 6 rows for Σ 0 \Sigma_0 Σ0
  • 6 6 6 rows for Σ 1 \Sigma_1 Σ1
  • r e d u c e 6 reduce_6 reduce6 and r e d u c e 7 reduce_7 reduce7 are always free
  • = 24 = 24 =24 per round

This gives 24 ∗ 64 = 1792 24*64 = 1792 2464=1792 rows for all of “step 3”, to which we need to add:

  • 547 547 547 rows for message scheduling
  • 2 ∗ 8 2*8 28 rows for 8 8 8 reductions mod 2 32 2^{32} 232 in “step 4”

giving a total of 2099 2099 2099 rows.

7. Tables

最终仅需要一个table s p r e a d \mathtt{spread} spread——具有 2 16 2^{16} 216行和 3 3 3列。同时需要一个tag列来支持selecting ( 7 , 10 , 11 , 13 , 14 ) (7,10,11,13,14) (7,10,11,13,14)-bit subsets of the table for Σ 0..1 \Sigma_{0..1} Σ0..1 σ 0..1 \sigma_{0..1} σ0..1

7.1 spread table

row tag table (16b) spread (32b)
0 0 0 0 0000000000000000 00000000000000000000000000000000
1 1 1 0 0000000000000001 00000000000000000000000000000001
2 2 2 0 0000000000000010 00000000000000000000000000000100
3 3 3 0 0000000000000011 00000000000000000000000000000101
0
2 7 − 1 2^{7} - 1 271 0 0000000001111111 00000000000000000001010101010101
2 7 2^{7} 27 1 0000000010000000 00000000000000000100000000000000
1
2 10 − 1 2^{10} - 1 2101 1 0000001111111111 00000000000001010101010101010101
2
2 11 − 1 2^{11} - 1 2111 2 0000011111111111 00000000010101010101010101010101
3
2 13 − 1 2^{13} - 1 2131 3 0001111111111111 00000001010101010101010101010101
4
2 14 − 1 2^{14} - 1 2141 4 0011111111111111 00000101010101010101010101010101
5
2 16 − 1 2^{16} - 1 2161 5 1111111111111111 01010101010101010101010101010101

如需实现 an 11 11 11-bit s p r e a d \mathtt{spread} spread lookup,可polynomial-constrain the tag to be in { 0 , 1 , 2 } \{0,1,2\} { 0,1,2}。而对于 16 16 16-bit lookup,可不constrain the tag。
注意,可fill any unused rows beyond 2 16 2^{16} 216 with a duplicate entry,如 all-zeroes。

8. Gates

8.1 Choice gate

来自于之前操作的输入有:

  • E ′ , F ′ , G ′ , E', F', G', E,F,G, 64-bit spread forms of 32-bit words E , F , G E, F, G E,F,G, assumed to be constrained by previous operations
    • 实际上,当分解为 16 16 16-bit subpieces时,将有the spread forms of E ′ , F ′ , G ′ E', F', G' E,F,G
  • e v e n s evens evens 定义为 s p r e a d ( 2 32 − 1 ) \mathtt{spread}(2^{32} - 1) spread(2321)
    • e v e n s 0 = e v e n s 1 = s p r e a d ( 2 16 − 1 ) evens_0 = evens_1 = \mathtt{spread}(2^{16} - 1) evens0=evens1=spread(2161)

8.2 E ∧ F

s_ch a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4
0 {0,1,2,3,4,5} P 0 e v e n P_0^{even} P0even spread ( P 0 e v e n ) \texttt{spread}(P_0^{even}) spread(P0even) s p r e a d ( E l o ) \mathtt{spread}(E^{lo}) spread(Elo) s p r e a d ( E h i ) \mathtt{spread}(E^{hi}) spread(Ehi)
1 {0,1,2,3,4,5} P 0 o d d P_0^{odd} P0odd spread ( P 0 o d d ) \texttt{spread}(P_0^{odd}) spread(P0odd) spread ( P 1 o d d ) \texttt{spread}(P_1^{odd}) spread(P1odd)
0 {0,1,2,3,4,5} P 1 e v e n P_1^{even} P1even spread ( P 1 e v e n ) \texttt{spread}(P_1^{even}) spread(P1even) s p r e a d ( F l o ) \mathtt{spread}(F^{lo}) spread(Flo) s p r e a d ( F h i ) \mathtt{spread}(F^{hi}) spread(Fhi)
0 {0,1,2,3,4,5} P 1 o d d P_1^{odd} P1odd spread ( P 1 o d d ) \texttt{spread}(P_1^{odd}) spread(P1odd)

8.3 ¬E ∧ G

s_ch_neg a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5
0 {0,1,2,3,4,5} Q 0 e v e n Q_0^{even} Q0even spread ( Q 0 e v e n ) \texttt{spread}(Q_0^{even}) spread(Q0even) s p r e a d ( E n e g l o ) \mathtt{spread}(E_{neg}^{lo}) spread(Eneglo) s p r e a d ( E n e g h i ) \mathtt{spread}(E_{neg}^{hi}) spread(Eneghi) s p r e a d ( E l o ) \mathtt{spread}(E^{lo}) spread(Elo)
1 {0,1,2,3,4,5} Q 0 o d d Q_0^{odd} Q0odd spread ( Q 0 o d d ) \texttt{spread}(Q_0^{odd}) spread(Q0odd) spread ( Q 1 o d d ) \texttt{spread}(Q_1^{odd}) spread(Q1odd) s p r e a d ( E h i ) \mathtt{spread}(E^{hi}) spread(Ehi)
0 {0,1,2,3,4,5} Q 1 e v e n Q_1^{even} Q1even spread ( Q 1 e v e n ) \texttt{spread}(Q_1^{even}) spread(Q1even) s p r e a d ( G l o ) \mathtt{spread}(G^{lo}) spread(Glo) s p r e a d ( G h i ) \mathtt{spread}(G^{hi}) spread(Ghi)
0 {0,1,2,3,4,5} Q 1 o d d Q_1^{odd} Q1odd spread ( Q 1 o d d ) \texttt{spread}(Q_1^{odd}) spread(Q1odd)

Constraints有:

  • s_ch (choice): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0
    • L H S = a 3 ω − 1 + a 3 ω + 2 32 ( a 4 ω − 1 + a 4 ω ) LHS = a_3 \omega^{-1} + a_3 \omega + 2^{32}(a_4 \omega^{-1} + a_4 \omega) LHS=a3ω1+a3ω+232(a4ω1+a4ω)
    • R H S = a 2 ω − 1 + 2 ∗ a 2 + 2 32 ( a 2 ω + 2 ∗ a 3 ) RHS = a_2 \omega^{-1} + 2* a_2 + 2^{32}(a_2 \omega + 2* a_3) RHS=a2ω1+2a2+232(a2ω+2a3)
  • s_ch_neg (negation): s_ch with an extra negation check
  • s p r e a d \mathtt{spread} spread lookup on ( a 0 , a 1 , a 2 ) (a_0, a_1, a_2) (a0,a1,a2)
  • permutation between ( a 2 , a 3 ) (a_2, a_3) (a2,a3)

输出为: C h ( E , F , G ) = P o d d + Q o d d = ( P 0 o d d + Q 0 o d d ) + 2 16 ( P 1 o d d + Q 1 o d d ) Ch(E, F, G) = P^{odd} + Q^{odd} = (P_0^{odd} + Q_0^{odd}) + 2^{16} (P_1^{odd} + Q_1^{odd}) Ch(E,F,G)=Podd+Qodd=(P0odd+Q0odd)+216(P1odd+Q1odd)

8.4 Majority gate

来自于之前操作的输入有:

  • A ′ , B ′ , C ′ , A', B', C', A,B,C, 64-bit spread forms of 32-bit words A , B , C A, B, C A,B,C, assumed to be constrained by previous operations
    • 实际上,当分解为 16 16 16-bit subpieces时,有 the spread forms of A ′ , B ′ , C ′ A', B', C' A,B,C
s_maj a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5
0 {0,1,2,3,4,5} M 0 e v e n M_0^{even} M0even spread ( M 0 e v e n ) \texttt{spread}(M_0^{even}) spread(M0even) s p r e a d ( A l o ) \mathtt{spread}(A^{lo}) spread(Alo) s p r e a d ( A h i ) \mathtt{spread}(A^{hi}) spread(Ahi)
1 {0,1,2,3,4,5} M 0 o d d M_0^{odd} M0odd spread ( M 0 o d d ) \texttt{spread}(M_0^{odd}) spread(M0odd) spread ( M 1 o d d ) \texttt{spread}(M_1^{odd}) spread(M1odd) s p r e a d ( B l o ) \mathtt{spread}(B^{lo}) spread(Blo) s p r e a d ( B h i ) \mathtt{spread}(B^{hi}) spread(Bhi)
0 {0,1,2,3,4,5} M 1 e v e n M_1^{even} M1even spread ( M 1 e v e n ) \texttt{spread}(M_1^{even}) spread(M1even) s p r e a d ( C l o ) \mathtt{spread}(C^{lo}) spread(Clo) s p r e a d ( C h i ) \mathtt{spread}(C^{hi}) spread(Chi)
0 {0,1,2,3,4,5} M 1 o d d M_1^{odd} M1odd spread ( M 1 o d d ) \texttt{spread}(M_1^{odd}) spread(M1odd)

Constraints有:

  • s_maj (majority): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0
    • L H S = s p r e a d ( M 0 e v e n ) + 2 ⋅ s p r e a d ( M 0 o d d ) + 2 32 ⋅ s p r e a d ( M 1 e v e n ) + 2 33 ⋅ s p r e a d ( M 1 o d d ) LHS = \mathtt{spread}(M^{even}_0) + 2 \cdot \mathtt{spread}(M^{odd}_0) + 2^{32} \cdot \mathtt{spread}(M^{even}_1) + 2^{33} \cdot \mathtt{spread}(M^{odd}_1) LHS=spread(M0even)+2spread(M0odd)+232spread(M1even)+233spread(M1odd)
    • R H S = A ′ + B ′ + C ′ RHS = A' + B' + C' RHS=A+B+C
  • s p r e a d \mathtt{spread} spread lookup on ( a 0 , a 1 , a 2 ) (a_0, a_1, a_2) (a0,a1,a2)
  • permutation between ( a 2 , a 3 ) (a_2, a_3) (a2,a3)

输出为: M a j ( A , B , C ) = M o d d = M 0 o d d + 2 16 M 1 o d d Maj(A,B,C) = M^{odd} = M_0^{odd} + 2^{16} M_1^{odd} Maj(A,B,C)=Modd=M0odd+216M1odd

8.5 Σ_0 gate

A A A 为 a 32-bit word,可切分为 ( 2 , 11 , 9 , 10 ) (2,11,9,10) (2,11,9,10)-bit chunks,starting from the little end。We refer to these chunks as ( a ( 2 ) , b ( 11 ) , c ( 9 ) , d ( 10 ) ) (a(2), b(11), c(9), d(10)) (a(2),b(11),c(9),d(10)) respectively,可进一步将 c ( 9 ) c(9) c(9) 分解为 three 3-bit chunks c ( 9 ) l o , c ( 9 ) m i d , c ( 9 ) h i c(9)^{lo}, c(9)^{mid}, c(9)^{hi} c(9)lo,c(9)mid,c(9)hi。 We witness the spread versions of the small chunks.

Σ 0 ( A ) = ( A ⋙ 2 ) ⊕ ( A ⋙ 13 ) ⊕ ( A ⋙ 22 ) = ( A ⋙ 2 ) ⊕ ( A ⋙ 13 ) ⊕ ( A ⋘ 10 ) \begin{array}{ccc} \Sigma_0(A) &=& (A ⋙ 2) \oplus (A ⋙ 13) \oplus (A ⋙ 22) \\ &=& (A ⋙ 2) \oplus (A ⋙ 13) \oplus (A ⋘ 10) \end{array} Σ0(A)==(A2)(A13)(A22)(A2)(A13)(A10)

s_upp_sigma_0 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) c ( 9 ) l o c(9)^{lo} c(9)lo spread ( c ( 9 ) l o ) \texttt{spread}(c(9)^{lo}) spread(c(9)lo) c ( 9 ) m i d c(9)^{mid} c(9)mid spread ( c ( 9 ) m i d ) \texttt{spread}(c(9)^{mid}) spread(c(9)mid)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ( 10 ) ) \texttt{spread}(d(10)) spread(d(10)) spread ( b ( 11 ) ) \texttt{spread}(b(11)) spread(b(11)) c ( 9 ) c(9) c(9)
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) a ( 2 ) a(2) a(2) spread ( a ( 2 ) ) \texttt{spread}(a(2)) spread(a(2)) c ( 9 ) h i c(9)^{hi} c(9)hi spread ( c ( 9 ) h i ) \texttt{spread}(c(9)^{hi}) spread(c(9)hi)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_upp_sigma_0 ( Σ 0 \Sigma_0 Σ0 constraint): L H S − R H S + t a g + d e c o m p o s e = 0 LHS - RHS + tag + decompose = 0 LHSRHS+tag+decompose=0

t a g = c o n s t r a i n 1 ( a 0 ω − 1 ) + c o n s t r a i n 2 ( a 0 ω ) d e c o m p o s e = a ( 2 ) + 2 2 b ( 11 ) + 2 13 c ( 9 ) l o + 2 16 c ( 9 ) m i d + 2 19 c ( 9 ) h i + 2 22 d ( 10 ) − A L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} tag &=& constrain_1(a_0\omega^{-1}) + constrain_2(a_0\omega) \\ decompose &=& a(2) + 2^2 b(11) + 2^{13} c(9)^{lo} + 2^{16} c(9)^{mid} + 2^{19} c(9)^{hi} + 2^{22} d(10) - A\\ LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} tagdecomposeLHS===constrain1(a0ω1)+constrain2(a0ω)a(2)+22b(11)+213c(9)lo+216c(9)mid+219c(9)hi+222d(10)Aspread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
R H S = 4 30 spread ( a ( 2 ) ) + 4 20 spread ( d ( 10 ) ) + 4 17 spread ( c ( 9 ) h i ) + 4 14 spread ( c ( 9 ) m i d ) + 4 11 spread ( c ( 9 ) l o ) + spread ( b ( 11 ) )    + 4 21 spread ( b ( 11 ) ) + 4 19 spread ( a ( 2 ) ) + 4 9 spread ( d ( 10 ) ) + 4 6 spread ( c ( 9 ) h i ) + 4 3 spread ( c ( 9 ) m i d ) + spread ( c ( 9 ) l o )    + 4 29 spread ( c ( 9 ) h i ) + 4 26 spread ( c ( 9 ) m i d ) + 4 23 spread ( c ( 9 ) l o ) + 4 12 spread ( b ( 11 ) ) + 4 10 spread ( a ( 2 ) ) + spread ( d ( 10 ) )    \begin{array}{rcccccccccl} RHS = & 4^{30} \texttt{spread}(a(2)) &+& 4^{20} \texttt{spread}(d(10)) &+& 4^{17} \texttt{spread}(c(9)^{hi}) &+& 4^{14} \texttt{spread}(c(9)^{mid}) &+& 4^{11} \texttt{spread}(c(9)^{lo}) &+& \texttt{spread}(b(11))\;&+ \\ & 4^{21} \texttt{spread}(b(11)) &+& 4^{19} \texttt{spread}(a(2)) &+& 4^{9} \texttt{spread}(d(10)) &+& 4^{6} \texttt{spread}(c(9)^{hi}) &+& 4^{3} \texttt{spread}(c(9)^{mid}) &+& \texttt{spread}(c(9)^{lo}) \;&+ \\ & 4^{29} \texttt{spread}(c(9)^{hi}) &+& 4^{26} \texttt{spread}(c(9)^{mid}) &+& 4^{23} \texttt{spread}(c(9)^{lo}) &+& 4^{12} \texttt{spread}(b(11)) &+& 4^{10} \texttt{spread}(a(2)) &+& \texttt{spread}(d(10))\;& \end{array} RHS=430spread(a(2))421spread(b(11))429spread(c(9)hi)+++420spread(d(10))419spread(a(2))426spread(c(9)mid)+++417spread(c(9)hi)49spread(d(10))423spread(c(9)lo)+++414spread(c(9)mid)46spread(c(9)hi)412spread(b(11))+++411spread(c(9)lo)43spread(c(9)mid)410spread(a(2))+++spread(b(11))spread(c(9)lo)spread(d(10))++

  • s p r e a d \mathtt{spread} spread lookup on a 0 , a 1 , a 2 a_0, a_1, a_2 a0,a1,a2
  • 2-bit range check and 2-bit spread check on a ( 2 ) a(2) a(2)
  • 3-bit range check and 3-bit spread check on c ( 9 ) l o , c ( 9 ) m i d , c ( 9 ) h i c(9)^{lo}, c(9)^{mid}, c(9)^{hi} c(9)lo,c(9)mid,c(9)hi

(详细参见Helper gates 章节

输出为: Σ 0 ( A ) = R e v e n = R 0 e v e n + 2 16 R 1 e v e n \Sigma_0(A) = R^{even} = R_0^{even} + 2^{16} R_1^{even} Σ0(A)=Reven=R0even+216R1even

8.6 Σ_1 gate

E E E 为 a 32-bit word 可切分为 ( 6 , 5 , 14 , 7 ) (6,5,14,7) (6,5,14,7)-bit chunks, starting from the little end。We refer to these chunks as ( a ( 6 ) , b ( 5 ) , c ( 14 ) , d ( 7 ) ) (a(6), b(5), c(14), d(7)) (a(6),b(5),c(14),d(7)) respectively, 可进一步将 a ( 6 ) a(6) a(6) 切分为 two 3-bit chunks a ( 6 ) l o , a ( 6 ) h i a(6)^{lo}, a(6)^{hi} a(6)lo,a(6)hi,将 b b b 切分为 (2,3)-bit chunks b ( 5 ) l o , b ( 5 ) h i b(5)^{lo}, b(5)^{hi} b(5)lo,b(5)hi。We witness the spread versions of the small chunks.

Σ 1 ( E ) = ( E ⋙ 6 ) ⊕ ( E ⋙ 11 ) ⊕ ( E ⋙ 25 ) = ( E ⋙ 6 ) ⊕ ( E ⋙ 11 ) ⊕ ( E ⋘ 7 ) \begin{array}{ccc} \Sigma_1(E) &=& (E ⋙ 6) \oplus (E ⋙ 11) \oplus (E ⋙ 25) \\ &=& (E ⋙ 6) \oplus (E ⋙ 11) \oplus (E ⋘ 7) \end{array} Σ1(E)==(E6)(E11)(E25)(E6)(E11)(E7)

s_upp_sigma_1 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) b ( 5 ) l o b(5)^{lo} b(5)lo spread ( b ( 5 ) l o ) \texttt{spread}(b(5)^{lo}) spread(b(5)lo) b ( 5 ) h i b(5)^{hi} b(5)hi spread ( b ( 5 ) h i ) \texttt{spread}(b(5)^{hi}) spread(b(5)hi) b ( 5 ) b(5) b(5)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ( 7 ) ) \texttt{spread}(d(7)) spread(d(7)) spread ( c ( 14 ) ) \texttt{spread}(c(14)) spread(c(14))
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) a ( 6 ) l o a(6)^{lo} a(6)lo spread ( a ( 6 ) l o ) \texttt{spread}(a(6)^{lo}) spread(a(6)lo) a ( 6 ) h i a(6)^{hi} a(6)hi spread ( a ( 6 ) h i ) \texttt{spread}(a(6)^{hi}) spread(a(6)hi) a ( 6 ) a(6) a(6)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_upp_sigma_1 ( Σ 1 \Sigma_1 Σ1 constraint): L H S − R H S + t a g + d e c o m p o s e = 0 LHS - RHS + tag + decompose = 0 LHSRHS+tag+decompose=0

t a g = a 0 ω − 1 + c o n s t r a i n 4 ( a 0 ω ) d e c o m p o s e = a ( 6 ) l o + 2 3 a ( 6 ) h i + 2 6 b ( 5 ) l o + 2 8 b ( 5 ) h i + 2 11 c ( 14 ) + 2 25 d ( 7 ) − E L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} tag &=& a_0\omega^{-1} + constrain_4(a_0\omega) \\ decompose &=& a(6)^{lo} + 2^3 a(6)^{hi} + 2^6 b(5)^{lo} + 2^8 b(5)^{hi} + 2^{11} c(14) + 2^{25} d(7) - E \\ LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} tagdecomposeLHS===a0ω1+constrain4(a0ω)a(6)lo+23a(6)hi+26b(5)lo+28b(5)hi+211c(14)+225d(7)Espread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
R H S = 4 29 spread ( a ( 6 ) h i ) + 4 26 spread ( a ( 6 ) l o ) + 4 19 spread ( d ( 7 ) ) + 4 5 spread ( c ( 14 ) ) + 4 2 spread ( b ( 5 ) h i ) + spread ( b ( 5 ) l o )    + 4 29 spread ( b ( 5 ) h i ) + 4 27 spread ( b ( 5 ) l o ) + 4 24 spread ( a ( 6 ) h i ) + 4 21 spread ( a ( 6 ) l o ) + 4 14 spread ( d ( 7 ) ) + spread ( c ( 14 ) )    + 4 18 spread ( c ( 14 ) ) + 4 15 spread ( b ( 5 ) h i ) + 4 13 spread ( b ( 5 ) l o ) + 4 10 spread ( a ( 6 ) h i ) + 4 7 spread ( a ( 6 ) l o ) + spread ( d ( 7 ) )    \begin{array}{rcccccccccl} RHS = & 4^{29} \texttt{spread}(a(6)^{hi}) &+& 4^{26} \texttt{spread}(a(6)^{lo}) &+& 4^{19} \texttt{spread}(d(7)) &+& 4^{ 5} \texttt{spread}(c(14)) &+& 4^{2} \texttt{spread}(b(5)^{hi}) &+& \texttt{spread}(b(5)^{lo})\;&+ \\ & 4^{29} \texttt{spread}(b(5)^{hi}) &+& 4^{27} \texttt{spread}(b(5)^{lo}) &+& 4^{24} \texttt{spread}(a(6)^{hi}) &+& 4^{21} \texttt{spread}(a(6)^{lo}) &+& 4^{14} \texttt{spread}(d(7)) &+& \texttt{spread}(c(14))\;&+ \\ & 4^{18} \texttt{spread}(c(14)) &+& 4^{15} \texttt{spread}(b(5)^{hi}) &+& 4^{13} \texttt{spread}(b(5)^{lo}) &+& 4^{10} \texttt{spread}(a(6)^{hi}) &+& 4^{7} \texttt{spread}(a(6)^{lo}) &+& \texttt{spread}(d(7))\;& \end{array} RHS=429spread(a(6)hi)429spread(b(5)hi)418spread(c(14))+++426spread(a(6)lo)427spread(b(5)lo)415spread(b(5)hi)+++419spread(d(7))424spread(a(6)hi)413spread(b(5)lo)+++45spread(c(14))421spread(a(6)lo)410spread(a(6)hi)+++42spread(b(5)hi)414spread(d(7))47spread(a(6)lo)+++spread(b(5)lo)spread(c(14))spread(d(7))++

  • s p r e a d \mathtt{spread} spread lookup on a 0 , a 1 , a 2 a_0, a_1, a_2 a0,a1,a2
  • 2-bit range check and 2-bit spread check on b ( 5 ) l o b(5)^{lo} b(5)lo
  • 3-bit range check and 3-bit spread check on a ( 6 ) l o , a ( 6 ) h i , b ( 4 ) h i a(6)^{lo}, a(6)^{hi}, b(4)^{hi} a(6)lo,a(6)hi,b(4)hi

(详细参见Helper gates 章节

输出为: Σ 1 ( E ) = R e v e n = R 0 e v e n + 2 16 R 1 e v e n \Sigma_1(E) = R^{even} = R_0^{even} + 2^{16} R_1^{even} Σ1(E)=Reven=R0even+216R1even

8.7 σ_0 gate

8.7.1 σ_0 gate–v1

σ 0 \sigma_0 σ0 v1的输入为a word,该word可切分为 ( 3 , 4 , 11 , 14 ) (3,4,11,14) (3,4,11,14)-bit chunks(已constrained by message scheduling)。可将这些chunks分别表示为 ( a ( 3 ) , b ( 4 ) , c ( 11 ) , d ( 14 ) ) (a(3), b(4), c(11), d(14)) (a(3),b(4),c(11),d(14)),其中 b ( 4 ) b(4) b(4)可进一步切分为two 2 2 2-bit chunks b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi。witness the spread versions of the small chunks。自 message scheduling已有 s p r e a d ( c ( 11 ) ) \mathtt{spread}(c(11)) spread(c(11)) s p r e a d ( d ( 14 ) ) \mathtt{spread}(d(14)) spread(d(14))
( X ⋙ 7 ) ⊕ ( X ⋙ 18 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋙ 18) \oplus (X ≫ 3) (X7)(X18)(X3) is equivalent to
( X ⋙ 7 ) ⊕ ( X ⋘ 14 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋘ 14) \oplus (X ≫ 3) (X7)(X14)(X3).

s_low_sigma_0 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) b ( 4 ) l o b(4)^{lo} b(4)lo spread ( b ( 4 ) l o ) \texttt{spread}(b(4)^{lo}) spread(b(4)lo) b ( 4 ) h i b(4)^{hi} b(4)hi spread ( b ( 4 ) h i ) \texttt{spread}(b(4)^{hi}) spread(b(4)hi)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( c ) \texttt{spread}(c) spread(c) spread ( d ) \texttt{spread}(d) spread(d) b ( 4 ) b(4) b(4)
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) 0 0 0 0 0 0 a a a spread ( a ) \texttt{spread}(a) spread(a)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_low_sigma_0 ( σ 0 \sigma_0 σ0 v1 constraint): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0

L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} LHS=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
R H S = 4 15 d ( 14 ) + 4 4 c ( 11 ) + 4 2 b ( 4 ) h i + b ( 4 ) l o    + 4 30 b ( 4 ) h i + 4 28 b ( 4 ) l o + 4 25 a ( 3 ) + 4 11 d ( 14 ) + c ( 11 )    + 4 21 c ( 11 ) + 4 19 b ( 4 ) h i + 4 17 b ( 4 ) l o + 4 14 a ( 3 ) + d ( 14 )    \begin{array}{rccccccccl} RHS = & & & 4^{15} d(14) &+& 4^{ 4} c(11) &+& 4^2 b(4)^{hi} &+& b(4)^{lo}\;&+ \\ & 4^{30} b(4)^{hi} &+& 4^{28} b(4)^{lo} &+& 4^{25} a(3) &+& 4^{11} d(14) &+& c(11)\;&+ \\ & 4^{21} c(11) &+& 4^{19} b(4)^{hi} &+& 4^{17} b(4)^{lo} &+& 4^{14} a(3) &+& d(14)\;& \end{array} RHS=430b(4)hi421c(11)++415d(14)428b(4)lo419b(4)hi+++44c(11)425a(3)417b(4)lo+++42b(4)hi411d(14)414a(3)+++b(4)loc(11)d(14)++

  • check that b was properly split into subsections for 4-bit pieces.
    • W b ( 4 ) l o + 2 2 W b ( 4 ) h i − W = 0 W^{b(4)lo} + 2^2 W^{b(4)hi} - W = 0 Wb(4)lo+22Wb(4)hiW=0
  • 2-bit range check and 2-bit spread check on b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi
  • 3-bit range check and 3-bit spread check on a ( 3 ) a(3) a(3)

8.7.2 σ_0 gate–v2

σ 0 \sigma_0 σ0 v2的输入为a word,该word可切分为 ( 3 , 4 , 3 , 7 , 1 , 1 , 13 ) (3,4,3,7,1,1,13) (3,4,3,71,1,13)-bit chunks(已constrained by message scheduling)。可将这些chunks分别表示为 ( a ( 3 ) , b ( 4 ) , c ( 3 ) , d ( 7 ) , e ( 1 ) , f ( 1 ) , g ( 13 ) ) (a(3), b(4), c(3), d(7), e(1), f(1), g(13)) (a(3),b(4),c(3),d(7),e(1),f(1),g(13))。其中 1 1 1-bit e ( 1 ) , f ( 1 ) e(1), f(1) e(1),f(1) remain unchanged by the spread operation and can be used directly。其中 b ( 4 ) b(4) b(4)可进一步切分为two 2 2 2-bit chunks b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi。witness the spread versions of the small chunks。自 message scheduling已有 s p r e a d ( d ( 7 ) ) \mathtt{spread}(d(7)) spread(d(7)) s p r e a d ( g ( 13 ) ) \mathtt{spread}(g(13)) spread(g(13))

( X ⋙ 7 ) ⊕ ( X ⋙ 18 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋙ 18) \oplus (X ≫ 3) (X7)(X18)(X3) is equivalent to
( X ⋙ 7 ) ⊕ ( X ⋘ 14 ) ⊕ ( X ≫ 3 ) (X ⋙ 7) \oplus (X ⋘ 14) \oplus (X ≫ 3) (X7)(X14)(X3).

s_low_sigma_0_v2 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) b ( 4 ) l o b(4)^{lo} b(4)lo spread ( b ( 4 ) l o ) \texttt{spread}(b(4)^{lo}) spread(b(4)lo) b ( 4 ) h i b(4)^{hi} b(4)hi spread ( b ( 4 ) h i ) \texttt{spread}(b(4)^{hi}) spread(b(4)hi)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ( 7 ) ) \texttt{spread}(d(7)) spread(d(7)) spread ( g ( 13 ) ) \texttt{spread}(g(13)) spread(g(13)) b ( 4 ) b(4) b(4) e ( 1 ) e(1) e(1)
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) a ( 3 ) a(3) a(3) spread ( a ( 3 ) ) \texttt{spread}(a(3)) spread(a(3)) c ( 3 ) c(3) c(3) spread ( c ( 3 ) ) \texttt{spread}(c(3)) spread(c(3)) f ( 1 ) f(1) f(1)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_low_sigma_0_v2 ( σ 0 \sigma_0 σ0 v2 constraint): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0

L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} LHS=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
R H S = 4 16 g ( 13 ) + 4 15 f ( 1 ) + 4 14 e ( 1 ) + 4 7 d ( 7 ) + 4 4 c ( 3 ) + 4 2 b ( 4 ) h i + b ( 4 ) l o    + 4 30 b ( 4 ) h i + 4 28 b ( 4 ) l o + 4 25 a ( 3 ) + 4 12 g ( 13 ) + 4 11 f ( 1 ) + 4 10 e ( 1 ) + 4 3 d ( 7 ) + c ( 3 )    + 4 31 e ( 1 ) + 4 24 d ( 7 ) + 4 21 c ( 3 ) + 4 19 b ( 4 ) h i + 4 17 b ( 4 ) l o + 4 14 a ( 3 ) + 4 1 g ( 13 ) + f ( 1 )    \begin{array}{rcccccccccccl} RHS = & & & 4^{16} g(13) &+& 4^{15} f(1) &+& 4^{ 14} e(1) &+& 4^{ 7} d(7) &+& 4^{ 4} c(3) &+& 4^2 b(4)^{hi} &+& b(4)^{lo}\;&+ \\ & 4^{30} b(4)^{hi} &+& 4^{28} b(4)^{lo} &+& 4^{25} a(3) &+& 4^{12} g(13) &+& 4^{11} f(1) &+& 4^{10} e(1) &+& 4^{3} d(7) &+& c(3)\;&+ \\ & 4^{31} e(1) &+& 4^{24} d(7) &+& 4^{21} c(3) &+& 4^{19} b(4)^{hi} &+& 4^{17} b(4)^{lo} &+& 4^{14} a(3) &+& 4^{1} g(13) &+& f(1)\;& \end{array} RHS=430b(4)hi431e(1)++416g(13)428b(4)lo424d(7)+++415f(1)425a(3)421c(3)+++414e(1)412g(13)419b(4)hi+++47d(7)411f(1)417b(4)lo+++44c(3)410e(1)414a(3)+++42b(4)hi43d(7)41g(13)+++b(4)loc(3)f(1)++

  • check that b was properly split into subsections for 4-bit pieces.
    • W b ( 4 ) l o + 2 2 W b ( 4 ) h i − W = 0 W^{b(4)lo} + 2^2 W^{b(4)hi} - W = 0 Wb(4)lo+22Wb(4)hiW=0
  • 2-bit range check and 2-bit spread check on b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi
  • 3-bit range check and 3-bit spread check on a ( 3 ) , c ( 3 ) a(3), c(3) a(3),c(3)

8.8 σ_1 gate

8.8.1 σ_1 gate–v1

σ 1 \sigma_1 σ1 v1的输入为a word,该word可切分为 ( 10 , 7 , 2 , 13 ) (10,7,2,13) (10,7,2,13)-bit chunks(已constrained by message scheduling)。可将这些chunks分别表示为 ( a ( 10 ) , b ( 7 ) , c ( 2 ) , d ( 13 ) ) (a(10), b(7), c(2), d(13)) (a(10),b(7),c(2),d(13)),其中 b ( 7 ) b(7) b(7)可进一步切分为two ( 2 , 2 , 3 ) (2,2,3) (2,2,3)-bit chunks b ( 7 ) l o , b ( 7 ) m i d , b ( 7 ) h i b(7)^{lo},b(7)^{mid}, b(7)^{hi} b(7)lo,b(7)mid,b(7)hi。witness the spread versions of the small chunks。自 message scheduling已有 s p r e a d ( a ( 10 ) ) \mathtt{spread}(a(10)) spread(a(10)) s p r e a d ( d ( 13 ) ) \mathtt{spread}(d(13)) spread(d(13))

( X ⋙ 17 ) ⊕ ( X ⋙ 19 ) ⊕ ( X ≫ 10 ) (X ⋙ 17) \oplus (X ⋙ 19) \oplus (X ≫ 10) (X17)(X19)(X10) is equivalent to
( X ⋘ 15 ) ⊕ ( X ⋘ 13 ) ⊕ ( X ≫ 10 ) (X ⋘ 15) \oplus (X ⋘ 13) \oplus (X ≫ 10) (X15)(X13)(X10).

s_low_sigma_1 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) b ( 7 ) l o b(7)^{lo} b(7)lo spread ( b ( 7 ) l o ) \texttt{spread}(b(7)^{lo}) spread(b(7)lo) b ( 7 ) m i d b(7)^{mid} b(7)mid spread ( b ( 7 ) m i d ) \texttt{spread}(b(7)^{mid}) spread(b(7)mid)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( a ( 10 ) ) \texttt{spread}(a(10)) spread(a(10)) spread ( d ( 13 ) ) \texttt{spread}(d(13)) spread(d(13)) b ( 7 ) b(7) b(7)
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) c ( 2 ) c(2) c(2) spread ( c ( 2 ) ) \texttt{spread}(c(2)) spread(c(2)) b ( 7 ) h i b(7)^{hi} b(7)hi spread ( b ( 7 ) h i ) \texttt{spread}(b(7)^{hi}) spread(b(7)hi)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_low_sigma_1 ( σ 1 \sigma_1 σ1 v1 constraint): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0
    L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} LHS=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
    R H S = 4 9 d ( 13 ) + 4 7 c ( 2 ) + 4 4 b ( 7 ) h i + 4 2 b ( 7 ) m i d + b ( 7 ) l o    + 4 29 b ( 7 ) h i + 4 27 b ( 7 ) m i d + 4 25 b ( 7 ) l o + 4 15 a ( 10 ) + 4 2 d ( 13 ) + c ( 2 )    + 4 30 c ( 2 ) + 4 27 b ( 7 ) h i + 4 25 b ( 7 ) m i d + 4 23 b ( 7 ) l o + 4 13 a ( 10 ) + d ( 13 )    \begin{array}{rcccccccccl} RHS = & & & 4^{ 9} d(13) &+& 4^{ 7} c(2) &+& 4^{4} b(7)^{hi} &+& 4^{2} b(7)^{mid} &+& b(7)^{lo}\;&+ \\ & 4^{29} b(7)^{hi} &+& 4^{27} b(7)^{mid} &+& 4^{25} b(7)^{lo} &+& 4^{15} a(10) &+& 4^{ 2} d(13) &+& c(2)\;&+ \\ & 4^{30} c(2) &+& 4^{27} b(7)^{hi} &+& 4^{25} b(7)^{mid} &+& 4^{23} b(7)^{lo} &+& 4^{13} a(10) &+& d(13)\;& \end{array} RHS=429b(7)hi430c(2)++49d(13)427b(7)mid427b(7)hi+++47c(2)425b(7)lo425b(7)mid+++44b(7)hi415a(10)423b(7)lo+++42b(7)mid42d(13)413a(10)+++b(7)loc(2)d(13)++

  • check that b was properly split into subsections for 7-bit pieces.

    • W b ( 7 ) l o + 2 2 W b ( 7 ) m i d + 2 4 W b ( 7 ) h i − W = 0 W^{b(7)lo} + 2^2 W^{b(7)mid} + 2^4 W^{b(7)hi} - W = 0 Wb(7)lo+22Wb(7)mid+24Wb(7)hiW=0
  • 2-bit range check and 2-bit spread check on b ( 7 ) l o , b ( 7 ) m i d , c ( 2 ) b(7)^{lo}, b(7)^{mid}, c(2) b(7)lo,b(7)mid,c(2)

  • 3-bit range check and 3-bit spread check on b ( 7 ) h i b(7)^{hi} b(7)hi

8.8.2 σ_1 gate–v2

σ 1 \sigma_1 σ1 v2的输入为a word,该word可切分为 ( 3 , 4 , 3 , 7 , 1 , 1 , 13 ) (3,4,3,7,1,1,13) (3,4,3,71,1,13)-bit chunks(已constrained by message scheduling)。可将这些chunks分别表示为 ( a ( 3 ) , b ( 4 ) , c ( 3 ) , d ( 7 ) , e ( 1 ) , f ( 1 ) , g ( 13 ) ) (a(3), b(4), c(3), d(7), e(1), f(1), g(13)) (a(3),b(4),c(3),d(7),e(1),f(1),g(13))。其中 1 1 1-bit e ( 1 ) , f ( 1 ) e(1), f(1) e(1),f(1) remain unchanged by the spread operation and can be used directly。其中 b ( 4 ) b(4) b(4)可进一步切分为two 2 2 2-bit chunks b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi。witness the spread versions of the small chunks。自 message scheduling已有 s p r e a d ( d ( 7 ) ) \mathtt{spread}(d(7)) spread(d(7)) s p r e a d ( g ( 13 ) ) \mathtt{spread}(g(13)) spread(g(13))

( X ⋙ 17 ) ⊕ ( X ⋙ 19 ) ⊕ ( X ≫ 10 ) (X ⋙ 17) \oplus (X ⋙ 19) \oplus (X ≫ 10) (X17)(X19)(X10) is equivalent to
( X ⋘ 15 ) ⊕ ( X ⋘ 13 ) ⊕ ( X ≫ 10 ) (X ⋘ 15) \oplus (X ⋘ 13) \oplus (X ≫ 10) (X15)(X13)(X10).

s_low_sigma_1_v2 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7
0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) b ( 4 ) l o b(4)^{lo} b(4)lo spread ( b ( 4 ) l o ) \texttt{spread}(b(4)^{lo}) spread(b(4)lo) b ( 4 ) h i b(4)^{hi} b(4)hi spread ( b ( 4 ) h i ) \texttt{spread}(b(4)^{hi}) spread(b(4)hi)
1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ( 7 ) ) \texttt{spread}(d(7)) spread(d(7)) spread ( g ( 13 ) ) \texttt{spread}(g(13)) spread(g(13)) b ( 4 ) b(4) b(4) e ( 1 ) e(1) e(1)
0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) a ( 3 ) a(3) a(3) spread ( a ( 3 ) ) \texttt{spread}(a(3)) spread(a(3)) c ( 3 ) c(3) c(3) spread ( c ( 3 ) ) \texttt{spread}(c(3)) spread(c(3)) f ( 1 ) f(1) f(1)
0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)

Constraints有:

  • s_low_sigma_1_v2 ( σ 1 \sigma_1 σ1 v2 constraint): L H S − R H S = 0 LHS - RHS = 0 LHSRHS=0

L H S = s p r e a d ( R 0 e v e n ) + 2 ⋅ s p r e a d ( R 0 o d d ) + 2 32 ⋅ s p r e a d ( R 1 e v e n ) + 2 33 ⋅ s p r e a d ( R 1 o d d ) \begin{array}{ccc} LHS &=& \mathtt{spread}(R^{even}_0) + 2 \cdot \mathtt{spread}(R^{odd}_0) + 2^{32} \cdot \mathtt{spread}(R^{even}_1) + 2^{33} \cdot \mathtt{spread}(R^{odd}_1) \end{array} LHS=spread(R0even)+2spread(R0odd)+232spread(R1even)+233spread(R1odd)
R H S = 4 9 g ( 13 ) + 4 8 f ( 1 ) + 4 7 e ( 1 ) + d ( 7 )    + 4 25 d ( 7 ) + 4 22 c ( 3 ) + 4 20 b ( 4 ) h i + 4 18 b ( 4 ) l o + 4 15 a + 4 2 g ( 13 ) + 4 1 f ( 1 ) + e ( 1 )    + 4 31 f ( 1 ) + 4 30 e ( 1 ) + 4 23 d ( 7 ) + 4 20 c ( 3 ) + 4 18 b ( 4 ) h i + 4 16 b ( 4 ) l o + 4 13 a + g ( 13 )    \begin{array}{rccccccccccccl} RHS = & &&&& & & 4^{ 9} g(13) &+& 4^{ 8} f(1) &+& 4^{ 7} e(1) &+& d(7)\;&+ \\ & 4^{25} d(7) &+& 4^{22} c(3) &+& 4^{20} b(4)^{hi} &+& 4^{18} b(4)^{lo} &+& 4^{15} a &+& 4^{ 2} g(13) &+& 4^{1}f(1) &+& e(1)\;&+ \\ & 4^{31} f(1) &+& 4^{30} e(1) &+& 4^{23} d(7) &+& 4^{20} c(3) &+& 4^{18} b(4)^{hi} &+& 4^{16} b(4)^{lo} &+& 4^{13} a &+& g(13)\;& \end{array} RHS=425d(7)431f(1)++422c(3)430e(1)++420b(4)hi423d(7)++49g(13)418b(4)lo420c(3)+++48f(1)415a418b(4)hi+++47e(1)42g(13)416b(4)lo+++d(7)41f(1)413a+++e(1)g(13)+

  • check that b was properly split into subsections for 4-bit pieces.
    • W b ( 4 ) l o + 2 2 W b ( 4 ) h i − W = 0 W^{b(4)lo} + 2^2 W^{b(4)hi} - W = 0 Wb(4)lo+22Wb(4)hiW=0
  • 2-bit range check and 2-bit spread check on b ( 4 ) l o , b ( 4 ) h i b(4)^{lo}, b(4)^{hi} b(4)lo,b(4)hi
  • 3-bit range check and 3-bit spread check on a ( 3 ) , c ( 3 ) a(3), c(3) a(3),c(3)

8.9 Helper gates

8.9.1 Small range constraints

c o n s t r a i n n ( x ) = ∏ i = 0 n ( x − i ) constrain_n(x) = \prod_{i=0}^n (x-i) constrainn(x)=i=0n(xi)。Constraining this expression to equal zero enforces that x x x is in [ 0.. n ] [0..n] [0..n]

8.9.2 2-bit range check

( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) = 0 (a - 3)(a - 2)(a - 1)(a) = 0 (a3)(a2)(a1)(a)=0

sr2 a 0 a_0 a0
1 a

8.9.3 2-bit spread

l 1 ( a ) + 4 ∗ l 2 ( a ) + 5 ∗ l 3 ( a ) − a ′ = 0 l_1(a) + 4*l_2(a) + 5*l_3(a) - a' = 0 l1(a)+4l2(a)+5l3(a)a=0

ss2 a 0 a_0 a0 a 1 a_1 a1
1 a a’

with interpolation polynomials:

  • l 0 ( a ) = ( a − 3 ) ( a − 2 ) ( a − 1 ) ( − 3 ) ( − 2 ) ( − 1 ) l_0(a) = \frac{(a - 3)(a - 2)(a - 1)}{(-3)(-2)(-1)} l0(a)=(3)(2)(1)(a3)(a2)(a1) ( s p r e a d ( 00 ) = 0000 \mathtt{spread}(00) = 0000 spread(00)=0000)
  • l 1 ( a ) = ( a − 3 ) ( a − 2 ) ( a ) ( − 2 ) ( − 1 ) ( 1 ) l_1(a) = \frac{(a - 3)(a - 2)(a)}{(-2)(-1)(1)} l1(a)=(2)(1)(1)(a3)(a2)(a) ( s p r e a d ( 01 ) = 0001 \mathtt{spread}(01) = 0001 spread(01)=0001)
  • l 2 ( a ) = ( a − 3 ) ( a − 1 ) ( a ) ( − 1 ) ( 1 ) ( 2 ) l_2(a) = \frac{(a - 3)(a - 1)(a)}{(-1)(1)(2)} l2(a)=(1)(1)(2)(a3)(a1)(a) ( s p r e a d ( 10 ) = 0100 \mathtt{spread}(10) = 0100 spread(10)=0100)
  • l 3 ( a ) = ( a − 2 ) ( a − 1 ) ( a ) ( 1 ) ( 2 ) ( 3 ) l_3(a) = \frac{(a - 2)(a - 1)(a)}{(1)(2)(3)} l3(a)=(1)(2)(3)(a2)(a1)(a) ( s p r e a d ( 11 ) = 0101 \mathtt{spread}(11) = 0101 spread(11)=0101)

8.9.4 3-bit range check

( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) = 0 (a - 7)(a - 6)(a - 5)(a - 4)(a - 3)(a - 2)(a - 1)(a) = 0 (a7)(a6)(a5)(a4)(a3)(a2)(a1)(a)=0

sr3 a 0 a_0 a0
1 a

8.9.5 3-bit spread

l 1 ( a ) + 4 ∗ l 2 ( a ) + 5 ∗ l 3 ( a ) + 16 ∗ l 4 ( a ) + 17 ∗ l 5 ( a ) + 20 ∗ l 6 ( a ) + 21 ∗ l 7 ( a ) − a ′ = 0 l_1(a) + 4*l_2(a) + 5*l_3(a) + 16*l_4(a) + 17*l_5(a) + 20*l_6(a) + 21*l_7(a) - a' = 0 l1(a)+4l2(a)+5l3(a)+16l4(a)+17l5(a)+20l6(a)+21l7(a)a=0

ss3 a 0 a_0 a0 a 1 a_1 a1
1 a a’

with interpolation polynomials:

  • l 0 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( − 7 ) ( − 6 ) ( − 5 ) ( − 4 ) ( − 3 ) ( − 2 ) ( − 1 ) l_0(a) = \frac{(a - 7)(a - 6)(a - 5)(a - 4)(a - 3)(a - 2)(a - 1)}{(-7)(-6)(-5)(-4)(-3)(-2)(-1)} l0(a)=(7)(6)(5)(4)(3)(2)(1)(a7)(a6)(a5)(a4)(a3)(a2)(a1) ( s p r e a d ( 000 ) = 000000 \mathtt{spread}(000) = 000000 spread(000)=000000)
  • l 1 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a ) ( − 6 ) ( − 5 ) ( − 4 ) ( − 3 ) ( − 2 ) ( − 1 ) ( 1 ) l_1(a) = \frac{(a - 7)(a - 6)(a - 5)(a - 4)(a - 3)(a - 2)(a)}{(-6)(-5)(-4)(-3)(-2)(-1)(1)} l1(a)=(6)(5)(4)(3)(2)(1)(1)(a7)(a6)(a5)(a4)(a3)(a2)(a) ( s p r e a d ( 001 ) = 000001 \mathtt{spread}(001) = 000001 spread(001)=000001)
  • l 2 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 1 ) ( a ) ( − 5 ) ( − 4 ) ( − 3 ) ( − 2 ) ( − 1 ) ( 1 ) ( 2 ) l_2(a) = \frac{(a - 7)(a - 6)(a - 5)(a - 4)(a - 3)(a - 1)(a)}{(-5)(-4)(-3)(-2)(-1)(1)(2)} l2(a)=(5)(4)(3)(2)(1)(1)(2)(a7)(a6)(a5)(a4)(a3)(a1)(a) ( s p r e a d ( 010 ) = 000100 \mathtt{spread}(010) = 000100 spread(010)=000100)
  • l 3 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) ( − 4 ) ( − 3 ) ( − 2 ) ( − 1 ) ( 1 ) ( 2 ) ( 3 ) l_3(a) = \frac{(a - 7)(a - 6)(a - 5)(a - 3)(a - 2)(a - 1)(a)}{(-4)(-3)(-2)(-1)(1)(2)(3)} l3(a)=(4)(3)(2)(1)(1)(2)(3)(a7)(a6)(a5)(a3)(a2)(a1)(a) ( s p r e a d ( 011 ) = 000101 \mathtt{spread}(011) = 000101 spread(011)=000101)
  • l 4 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 5 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) ( − 3 ) ( − 2 ) ( − 1 ) ( 1 ) ( 2 ) ( 3 ) ( 4 ) l_4(a) = \frac{(a - 7)(a - 6)(a - 5)(a - 3)(a - 2)(a - 1)(a)}{(-3)(-2)(-1)(1)(2)(3)(4)} l4(a)=(3)(2)(1)(1)(2)(3)(4)(a7)(a6)(a5)(a3)(a2)(a1)(a) ( s p r e a d ( 100 ) = 010000 \mathtt{spread}(100) = 010000 spread(100)=010000)
  • l 5 ( a ) = ( a − 7 ) ( a − 6 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) ( − 2 ) ( − 1 ) ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) l_5(a) = \frac{(a - 7)(a - 6)(a - 4)(a - 3)(a - 2)(a - 1)(a)}{(-2)(-1)(1)(2)(3)(4)(5)} l5(a)=(2)(1)(1)(2)(3)(4)(5)(a7)(a6)(a4)(a3)(a2)(a1)(a) ( s p r e a d ( 101 ) = 010001 \mathtt{spread}(101) = 010001 spread(101)=010001)
  • l 6 ( a ) = ( a − 7 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) ( − 1 ) ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) l_6(a) = \frac{(a - 7)(a - 5)(a - 4)(a - 3)(a - 2)(a - 1)(a)}{(-1)(1)(2)(3)(4)(5)(6)} l6(a)=(1)(1)(2)(3)(4)(5)(6)(a7)(a5)(a4)(a3)(a2)(a1)(a) ( s p r e a d ( 110 ) = 010100 \mathtt{spread}(110) = 010100 spread(110)=010100)
  • l 7 ( a ) = ( a − 6 ) ( a − 5 ) ( a − 4 ) ( a − 3 ) ( a − 2 ) ( a − 1 ) ( a ) ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) l_7(a) = \frac{(a - 6)(a - 5)(a - 4)(a - 3)(a - 2)(a - 1)(a)}{(1)(2)(3)(4)(5)(6)(7)} l7(a)=(1)(2)(3)(4)(5)(6)(7)(a6)(a5)(a4)(a3)(a2)(a1)(a) ( s p r e a d ( 111 ) = 010101 \mathtt{spread}(111) = 010101 spread(111)=010101)

8.9.6 reduce_6 gate

Addition ( m o d 2 32 ) \pmod{2^{32}} (mod232) of 6 elements

Input:

  • E E E
  • { e i l o , e i h i } i = 0 5 \{e_i^{lo}, e_i^{hi}\}_{i=0}^5 { eilo,eihi}i=05
  • c a r r y carry carry

Check: E = e 0 + e 1 + e 2 + e 3 + e 4 + e 5 ( m o d 32 ) E = e_0 + e_1 + e_2 + e_3 + e_4 + e_5 \pmod{32} E=e0+e1+e2+e3+e4+e5(mod32)

Assume inputs are constrained to 16 bits.

  • Addition gate (sa):
    • a 0 + a 1 + a 2 + a 3 + a 4 + a 5 + a 6 − a 7 = 0 a_0 + a_1 + a_2 + a_3 + a_4 + a_5 + a_6 - a_7 = 0 a0+a1+a2+a3+a4+a5+a6a7=0
  • Carry gate (sc):
    • 2 16 a 6 ω − 1 + a 6 + [ ( a 6 − 5 ) ( a 6 − 4 ) ( a 6 − 3 ) ( a 6 − 2 ) ( a 6 − 1 ) ( a 6 ) ] = 0 2^{16} a_6 \omega^{-1} + a_6 + [(a_6 - 5)(a_6 - 4)(a_6 -3)(a_6 - 2)(a_6 - 1)(a_6)] = 0 216a6ω1+a6+[(a65)(a64)(a63)(a62)(a61)(a6)]=0
sa sc a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7
1 0 e 0 l o e_0^{lo} e0lo e 1 l o e_1^{lo} e1lo e 2 l o e_2^{lo} e2lo e 3 l o e_3^{lo} e3lo e 4 l o e_4^{lo} e4lo e 5 l o e_5^{lo} e5lo − c a r r y ∗ 2 16 -carry*2^{16} carry216 E l o E^{lo} Elo
1 1 e 0 h i e_0^{hi} e0hi e 1 h i e_1^{hi} e1hi e 2 h i e_2^{hi} e2hi e 3 h i e_3^{hi} e3hi e 4 h i e_4^{hi} e4hi e 5 h i e_5^{hi} e5hi c a r r y carry carry E h i E^{hi} Ehi

Assume inputs are constrained to 16 bits.

  • Addition gate (sa):
    • a 0 ω − 1 + a 1 ω − 1 + a 2 ω − 1 + a 0 + a 1 + a 2 + a 3 ω − 1 − a 3 = 0 a_0 \omega^{-1} + a_1 \omega^{-1} + a_2 \omega^{-1} + a_0 + a_1 + a_2 + a_3 \omega^{-1} - a_3 = 0 a0ω1+a1ω1+a2ω1+a0+a1+a2+a3ω1a3=0
  • Carry gate (sc):
    • 2 16 a 3 ω + a 3 ω − 1 = 0 2^{16} a_3 \omega + a_3 \omega^{-1} = 0 216a3ω+a3ω1=0
sa sc a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3
0 0 e 0 l o e_0^{lo} e0lo e 1 l o e_1^{lo} e1lo e 2 l o e_2^{lo} e2lo − c a r r y ∗ 2 16 -carry*2^{16} carry216
1 1 e 3 l o e_3^{lo} e3lo e 4 l o e_4^{lo} e4lo e 5 l o e_5^{lo} e5lo E l o E^{lo} Elo
0 0 e 0 h i e_0^{hi} e0hi e 1 h i e_1^{hi} e1hi e 2 h i e_2^{hi} e2hi c a r r y carry carry
1 0 e 3 h i e_3^{hi} e3hi e 4 h i e_4^{hi} e4hi e 5 h i e_5^{hi} e5hi E h i E^{hi} Ehi

8.9.7 reduce_7 gate

Addition ( m o d 2 32 ) \pmod{2^{32}} (mod232) of 7 elements

Input:

  • E E E
  • { e i l o , e i h i } i = 0 6 \{e_i^{lo}, e_i^{hi}\}_{i=0}^6 { eilo,eihi}i=06
  • c a r r y carry carry

Check: E = e 0 + e 1 + e 2 + e 3 + e 4 + e 5 + e 6 ( m o d 32 ) E = e_0 + e_1 + e_2 + e_3 + e_4 + e_5 + e_6 \pmod{32} E=e0+e1+e2+e3+e4+e5+e6(mod32)

Assume inputs are constrained to 16 bits.

  • Addition gate (sa):
    • a 0 + a 1 + a 2 + a 3 + a 4 + a 5 + a 6 + a 7 − a 8 = 0 a_0 + a_1 + a_2 + a_3 + a_4 + a_5 + a_6 + a_7 - a_8 = 0 a0+a1+a2+a3+a4+a5+a6+a7a8=0
  • Carry gate (sc):
    • 2 16 a 7 ω − 1 + a 7 + [ ( a 7 − 6 ) ( a 7 − 5 ) ( a 7 − 4 ) ( a 7 − 3 ) ( a 7 − 2 ) ( a 7 − 1 ) ( a 7 ) ] = 0 2^{16} a_7 \omega^{-1} + a_7 + [(a_7 - 6)(a_7 - 5)(a_7 - 4)(a_7 -3)(a_7 - 2)(a_7 - 1)(a_7)] = 0 216a7ω1+a7+[(a76)(a75)(a74)(a73)(a72)(a71)(a7)]=0
sa sc a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7 a 8 a_8 a8
1 0 e 0 l o e_0^{lo} e0lo e 1 l o e_1^{lo} e1lo e 2 l o e_2^{lo} e2lo e 3 l o e_3^{lo} e3lo e 4 l o e_4^{lo} e4lo e 5 l o e_5^{lo} e5lo e 6 l o e_6^{lo} e6lo − c a r r y ∗ 2 16 -carry*2^{16} carry216 E l o E^{lo} Elo
1 1 e 0 h i e_0^{hi} e0hi e 1 h i e_1^{hi} e1hi e 2 h i e_2^{hi} e2hi e 3 h i e_3^{hi} e3hi e 4 h i e_4^{hi} e4hi e 5 h i e_5^{hi} e5hi e 6 h i e_6^{hi} e6hi c a r r y carry carry E h i E^{hi} Ehi

8.10 Message scheduling region

For each block M ∈ { 0 , 1 } 512 M \in \{0,1\}^{512} M{ 0,1}512 of the padded message, 64 64 64 words of 32 32 32 bits each are constructed as follows:

  • the first 16 16 16 are obtained by splitting M M M into 32 32 32-bit blocks M = W 0 ∣ ∣ W 1 ∣ ∣ ⋯ ∣ ∣ W 14 ∣ ∣ W 15 ; M = W_0 || W_1 || \cdots || W_{14} || W_{15}; M=W0W1W14W15;
  • the remaining 48 48 48 words are constructed using the formula:
    W i = σ 1 ( W i − 2 ) ⊞ W i − 7 ⊞ σ 0 ( W i − 15 ) ⊞ W i − 16 , W_i = \sigma_1(W_{i-2}) \boxplus W_{i-7} \boxplus \sigma_0(W_{i-15}) \boxplus W_{i-16}, Wi=σ1(Wi2)Wi7σ0(Wi15)Wi16, for 16 ≤ i < 64 16 \leq i < 64 16i<64.
sw sd0 sd1 sd2 sd3 ss0 ss0_v2 ss1 ss1_v2 a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7 a 8 a_8 a8 a 9 a_9 a9
0 1 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 0 l o W_{0}^{lo} W0lo spread ( W 0 l o ) \texttt{spread}(W_{0}^{lo}) spread(W0lo) W 0 l o W_{0}^{lo} W0lo W 0 h i W_{0}^{hi} W0hi W 0 W_{0} W0 σ 0 ( W 1 ) l o \sigma_0(W_1)^{lo} σ0(W1)lo σ 1 ( W 14 ) l o \sigma_1(W_{14})^{lo} σ1(W14)lo W 9 l o W_{9}^{lo} W9lo
1 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 0 h i W_{0}^{hi} W0hi spread ( W 0 h i ) \texttt{spread}(W_{0}^{hi}) spread(W0hi) W 16 W_{16} W16 σ 0 ( W 1 ) h i \sigma_0(W_1)^{hi} σ0(W1)hi σ 1 ( W 14 ) h i \sigma_1(W_{14})^{hi} σ1(W14)hi W 9 h i W_{9}^{hi} W9hi c a r r y 16 carry_{16} carry16
0 1 1 0 0 0 0 0 0 {0,1,2,3,4} W 1 d ( 14 ) W_{1}^{d(14)} W1d(14) spread ( W 1 d ( 14 ) ) \texttt{spread}(W_{1}^{d(14)}) spread(W1d(14)) W 1 l o W_{1}^{lo} W1lo W 1 h i W_{1}^{hi} W1hi W 1 W_{1} W1 σ 0 ( W 2 ) l o \sigma_0(W_2)^{lo} σ0(W2)lo σ 1 ( W 15 ) l o \sigma_1(W_{15})^{lo} σ1(W15)lo W 10 l o W_{10}^{lo} W10lo
1 0 0 0 0 0 0 0 0 {0,1,2} W 1 c ( 11 ) W_{1}^{c(11)} W1c(11) spread ( W 1 c ( 11 ) ) \texttt{spread}(W_{1}^{c(11)}) spread(W1c(11)) W 1 a ( 3 ) W_{1}^{a(3)} W1a(3) W 1 b ( 4 ) W_{1}^{b(4)} W1b(4) W 17 W_{17} W17 σ 0 ( W 2 ) h i \sigma_0(W_2)^{hi} σ0(W2)hi σ 1 ( W 15 ) h i \sigma_1(W_{15})^{hi} σ1(W15)hi W 10 h i W_{10}^{hi} W10hi c a r r y 17 carry_{17} carry17
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) W 1 b ( 4 ) l o W_{1}^{b(4)lo} W1b(4)lo spread ( W 1 b ( 4 ) l o ) \texttt{spread}(W_{1}^{b(4)lo}) spread(W1b(4)lo) W 1 b ( 4 ) h i W_{1}^{b(4)hi} W1b(4)hi spread ( W 1 b ( 4 ) h i ) \texttt{spread}(W_{1}^{b(4)hi}) spread(W1b(4)hi)
0 0 0 0 0 1 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( W 1 c ( 11 ) ) \texttt{spread}(W_{1}^{c(11)}) spread(W1c(11)) spread ( W 1 d ( 14 ) ) \texttt{spread}(W_{1}^{d(14)}) spread(W1d(14)) W 1 b ( 4 ) W_{1}^{b(4)} W1b(4)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) 0 0 0 0 0 0 W 1 a ( 3 ) W_{1}^{a(3)} W1a(3) spread ( W 1 a ( 3 ) ) \texttt{spread}(W_{1}^{a(3)}) spread(W1a(3))
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) σ 0 v 1 R 0 \sigma_0 v1 R_0 σ0v1R0 σ 0 v 1 R 1 \sigma_0 v1 R_1 σ0v1R1 σ 0 v 1 R 0 e v e n \sigma_0 v1 R_0^{even} σ0v1R0even σ 0 v 1 R 0 o d d \sigma_0 v1 R_0^{odd} σ0v1R0odd
0 0 0 0 0 0 0 0 0 {0,1,2,3} W 14 g ( 13 ) W_{14}^{g(13)} W14g(13) spread ( W 14 g ( 13 ) ) \texttt{spread}(W_{14}^{g(13)}) spread(W14g(13)) W 14 a ( 3 ) W_{14}^{a(3)} W14a(3) W 14 c ( 3 ) W_{14}^{c(3)} W14c(3)
0 1 0 1 0 0 0 0 0 0 W 14 d ( 7 ) W_{14}^{d(7)} W14d(7) spread ( W 14 d ( 7 ) ) \texttt{spread}(W_{14}^{d(7)}) spread(W14d(7)) W 14 l o W_{14}^{lo} W14lo W 14 h i W_{14}^{hi} W14hi W 14 W_{14} W14 σ 0 ( W 15 ) l o \sigma_0(W_{15})^{lo} σ0(W15)lo σ 1 ( W 28 ) l o \sigma_1(W_{28})^{lo} σ1(W28)lo W 23 l o W_{23}^{lo} W23lo
1 0 0 0 0 0 0 0 0 0 W 14 b ( 4 ) W_{14}^{b(4)} W14b(4) spread ( W 14 b ( 4 ) ) \texttt{spread}(W_{14}^{b(4)}) spread(W14b(4)) W 14 e ( 1 ) W_{14}^{e(1)} W14e(1) W 14 f ( 1 ) W_{14}^{f(1)} W14f(1) W 30 W_{30} W30 σ 0 ( W 15 ) h i \sigma_0(W_{15})^{hi} σ0(W15)hi σ 1 ( W 28 ) h i \sigma_1(W_{28})^{hi} σ1(W28)hi W 23 h i W_{23}^{hi} W23hi c a r r y 30 carry_{30} carry30
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) W 14 b ( 4 ) l o W_{14}^{b(4)lo} W14b(4)lo spread ( W 14 b ( 4 ) l o ) \texttt{spread}(W_{14}^{b(4)lo}) spread(W14b(4)lo) W 14 b ( 4 ) h i W_{14}^{b(4) hi} W14b(4)hi spread ( W 14 b ( 4 ) h i ) \texttt{spread}(W_{14}^{b(4)hi}) spread(W14b(4)hi)
0 0 0 0 0 0 1 0 0 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( W 14 d ( 7 ) ) \texttt{spread}(W_{14}^{d(7)}) spread(W14d(7)) spread ( W 14 g ( 13 ) ) \texttt{spread}(W_{14}^{g(13)}) spread(W14g(13)) W 1 b ( 14 ) W_{1}^{b(14)} W1b(14) W 14 e ( 1 ) W_{14}^{e(1)} W14e(1)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) W 14 a ( 3 ) W_{14}^{a(3)} W14a(3) spread ( W 14 a ( 3 ) ) \texttt{spread}(W_{14}^{a(3)}) spread(W14a(3)) W 14 c ( 3 ) W_{14}^{c(3)} W14c(3) spread ( W 14 c ( 3 ) ) \texttt{spread}(W_{14}^{c(3)}) spread(W14c(3)) W 14 f ( 1 ) W_{14}^{f(1)} W14f(1)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) σ 0 v 2 R 0 \sigma_0 v2 R_0 σ0v2R0 σ 0 v 2 R 1 \sigma_0 v2 R_1 σ0v2R1 σ 0 v 2 R 0 e v e n \sigma_0 v2 R_0^{even} σ0v2R0even σ 0 v 2 R 0 o d d \sigma_0 v2 R_0^{odd} σ0v2R0odd
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) W 14 b ( 4 ) l o W_{14}^{b(4)lo} W14b(4)lo spread ( W 14 b ( 4 ) l o ) \texttt{spread}(W_{14}^{b(4)lo}) spread(W14b(4)lo) W 14 b ( 4 ) h i W_{14}^{b(4) hi} W14b(4)hi spread ( W 14 b ( 4 ) h i ) \texttt{spread}(W_{14}^{b(4)hi}) spread(W14b(4)hi)
0 0 0 0 0 0 0 0 1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ) \texttt{spread}(d) spread(d) spread ( g ) \texttt{spread}(g) spread(g) W 14 e ( 1 ) W_{14}^{e(1)} W14e(1)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) W 14 a ( 3 ) W_{14}^{a(3)} W14a(3) spread ( W 14 a ( 3 ) ) \texttt{spread}(W_{14}^{a(3)}) spread(W14a(3)) W 14 c ( 3 ) W_{14}^{c(3)} W14c(3) spread ( W 14 c ( 3 ) ) \texttt{spread}(W_{14}^{c(3)}) spread(W14c(3)) W 14 f ( 1 ) W_{14}^{f(1)} W14f(1)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) σ 1 v 2 R 0 \sigma_1 v2 R_0 σ1v2R0 σ 1 v 2 R 1 \sigma_1 v2 R_1 σ1v2R1 σ 1 v 2 R 0 e v e n \sigma_1 v2 R_0^{even} σ1v2R0even σ 1 v 2 R 0 o d d \sigma_1 v2 R_0^{odd} σ1v2R0odd
0 1 0 0 1 0 0 0 0 {0,1,2,3} W 49 d ( 13 ) W_{49}^{d(13)} W49d(13) spread ( W 49 d ( 13 ) ) \texttt{spread}(W_{49}^{d(13)}) spread(W49d(13)) W 49 l o W_{49}^{lo} W49lo W 49 h i W_{49}^{hi} W49hi W 49 W_{49} W49
0 0 0 0 0 0 0 0 0 {0,1} W 49 a ( 10 ) W_{49}^{a(10)} W49a(10) spread ( W 49 a ( 10 ) ) \texttt{spread}(W_{49}^{a(10)}) spread(W49a(10)) W 49 c ( 2 ) W_{49}^{c(2)} W49c(2) W 49 b ( 7 ) W_{49}^{b(7)} W49b(7)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) W 49 b ( 7 ) l o W_{49}^{b(7)lo} W49b(7)lo spread ( W 49 b ( 7 ) l o ) \texttt{spread}(W_{49}^{b(7)lo}) spread(W49b(7)lo) W 49 b ( 7 ) m i d W_{49}^{b(7)mid} W49b(7)mid spread ( W 49 b ( 7 ) m i d ) \texttt{spread}(W_{49}^{b(7)mid}) spread(W49b(7)mid)
0 0 0 0 0 0 0 0 1 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( a ) \texttt{spread}(a) spread(a) spread ( d ) \texttt{spread}(d) spread(d) W 1 b ( 49 ) W_{1}^{b(49)} W1b(49)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) W 49 c ( 2 ) W_{49}^{c(2)} W49c(2) spread ( W 49 c ( 2 ) ) \texttt{spread}(W_{49}^{c(2)}) spread(W49c(2)) W 49 b ( 7 ) h i W_{49}^{b(7)hi} W49b(7)hi spread ( W 49 b ( 7 ) h i ) \texttt{spread}(W_{49}^{b(7)hi}) spread(W49b(7)hi)
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) σ 1 v 1 R 0 \sigma_1 v1 R_0 σ1v1R0 σ 1 v 1 R 1 \sigma_1 v1 R_1 σ1v1R1 σ 1 v 1 R 0 e v e n \sigma_1 v1 R_0^{even} σ1v1R0even σ 1 v 1 R 0 o d d \sigma_1 v1 R_0^{odd} σ1v1R0odd
0 1 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 62 l o W_{62}^{lo} W62lo spread ( W 62 l o ) \texttt{spread}(W_{62}^{lo}) spread(W62lo) W 62 l o W_{62}^{lo} W62lo W 62 h i W_{62}^{hi} W62hi W 62 W_{62} W62
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 62 h i W_{62}^{hi} W62hi spread ( W 62 h i ) \texttt{spread}(W_{62}^{hi}) spread(W62hi)
0 1 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 63 l o W_{63}^{lo} W63lo spread ( W 63 l o ) \texttt{spread}(W_{63}^{lo}) spread(W63lo) W 63 l o W_{63}^{lo} W63lo W 63 h i W_{63}^{hi} W63hi W 63 W_{63} W63
0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} W 63 h i W_{63}^{hi} W63hi spread ( W 63 h i ) \texttt{spread}(W_{63}^{hi}) spread(W63hi)

Constraints有:

  • sw: construct word using r e d u c e 4 reduce_4 reduce4
  • sd0: decomposition gate for W 0 , W 62 , W 63 W_0, W_{62}, W_{63} W0,W62,W63
    • W l o + 2 16 W h i − W = 0 W^{lo} + 2^{16} W^{hi} - W = 0 Wlo+216WhiW=0
  • sd1: decomposition gate for W 1..13 W_{1..13} W1..13 (split into ( 3 , 4 , 11 , 14 ) (3,4,11,14) (3,4,11,14)-bit pieces)
    • W a ( 3 ) + 2 3 W b ( 4 ) l o + 2 5 W b ( 4 ) h i + 2 7 W c ( 11 ) + 2 18 W d ( 14 ) − W = 0 W^{a(3)} + 2^3 W^{b(4) lo} + 2^5 W^{b(4) hi} + 2^7 W^{c(11)} + 2^{18} W^{d(14)} - W = 0 Wa(3)+23Wb(4)lo+25Wb(4)hi+27Wc(11)+218Wd(14)W=0
  • sd2: decomposition gate for W 14..48 W_{14..48} W14..48 (split into ( 3 , 4 , 3 , 7 , 1 , 1 , 13 ) (3,4,3,7,1,1,13) (3,4,3,7,1,1,13)-bit pieces)
    • W a ( 3 ) + 2 3 W b ( 4 ) l o + 2 5 W b ( 4 ) h i + 2 7 W c ( 11 ) + 2 10 W d ( 14 ) + 2 17 W e ( 1 ) + 2 18 W f ( 1 ) + 2 19 W g ( 13 ) − W = 0 W^{a(3)} + 2^3 W^{b(4) lo} + 2^5 W^{b(4) hi} + 2^7 W^{c(11)} + 2^{10} W^{d(14)} + 2^{17} W^{e(1)} + 2^{18} W^{f(1)} + 2^{19} W^{g(13)} - W = 0 Wa(3)+23Wb(4)lo+25Wb(4)hi+27Wc(11)+210Wd(14)+217We(1)+218Wf(1)+219Wg(13)W=0
  • sd3: decomposition gate for W 49..61 W_{49..61} W49..61 (split into ( 10 , 7 , 2 , 13 ) (10,7,2,13) (10,7,2,13)-bit pieces)
    • W a ( 10 ) + 2 10 W b ( 7 ) l o + 2 12 W b ( 7 ) m i d + 2 15 W b ( 7 ) h i + 2 17 W c ( 2 ) + 2 19 W d ( 13 ) − W = 0 W^{a(10)} + 2^{10} W^{b(7) lo} + 2^{12} W^{b(7) mid} + 2^{15} W^{b(7) hi} + 2^{17} W^{c(2)} + 2^{19} W^{d(13)} - W = 0 Wa(10)+210Wb(7)lo+212Wb(7)mid+215Wb(7)hi+217Wc(2)+219Wd(13)W=0

8.11 Compression region

+----------------------------------------------------------+
|                                                          |
|          decompose E,                                    |
|          Σ_1(E)                                          |
|                                                          |
|                  +---------------------------------------+
|                  |                                       |
|                  |        reduce_5() to get H'           |
|                  |                                       |
+----------------------------------------------------------+
|          decompose F, decompose G                        |
|                                                          |
|                        Ch(E,F,G)                         |
|                                                          |
+----------------------------------------------------------+
|                                                          |
|          decompose A,                                    |
|          Σ_0(A)                                          |
|                                                          |
|                                                          |
|                  +---------------------------------------+
|                  |                                       |
|                  |        reduce_7() to get A_new,       |
|                  |              using H'                 |
|                  |                                       |
+------------------+---------------------------------------+
|          decompose B, decompose C                        |
|                                                          |
|          Maj(A,B,C)                                      |
|                                                          |
|                  +---------------------------------------+
|                  |        reduce_6() to get E_new,       |
|                  |              using H'                 |
+------------------+---------------------------------------+

8.11.1 Initial round:

s_digest sd_abcd sd_efgh ss0 ss1 s_maj s_ch_neg s_ch s_a_new s_e_new s_h_prime a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7 a 8 a_8 a8 a 9 a_9 a9
0 0 1 0 0 0 0 0 0 0 0 {0,1,2} F 0 d ( 7 ) F_0 d(7) F0d(7) $\texttt{spread}(E_0 d(7)) $ E 0 b ( 5 ) l o E_0 b(5)^{lo} E0b(5)lo spread ( E 0 b ( 5 ) l o ) \texttt{spread}(E_0 b(5)^{lo}) spread(E0b(5)lo) E 0 b ( 5 ) h i E_0 b(5)^{hi} E0b(5)hi $\texttt{spread}(E_0 b(5)^{hi}) $ E 0 l o E_0^{lo} E0lo s p r e a d ( E 0 l o ) \mathtt{spread}(E_0^{lo}) spread(E0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} E 0 c ( 14 ) E_0 c(14) E0c(14) spread ( E 0 c ( 14 ) ) \texttt{spread}(E_0 c(14)) spread(E0c(14)) E 0 a ( 6 ) l o E_0 a(6)^{lo} E0a(6)lo spread ( E 0 a ( 6 ) l o ) \texttt{spread}(E_0 a(6)^{lo}) spread(E0a(6)lo) E 0 a ( 6 ) h i E_0 a(6)^{hi} E0a(6)hi $\texttt{spread}(E_0 a(6)^{hi}) $ E 0 h i E_0^{hi} E0hi s p r e a d ( E 0 h i ) \mathtt{spread}(E_0^{hi}) spread(E0hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) spread ( E 0 b ( 5 ) l o ) \texttt{spread}(E_0 b(5)^{lo}) spread(E0b(5)lo) spread ( E 0 b ( 5 ) h i ) \texttt{spread}(E_0 b(5)^{hi}) spread(E0b(5)hi)
0 0 0 0 1 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( E 0 d ( 7 ) ) \texttt{spread}(E_0 d(7)) spread(E0d(7)) spread ( E 0 c ( 14 ) ) \texttt{spread}(E_0 c(14)) spread(E0c(14))
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) spread ( E 0 a ( 6 ) l o ) \texttt{spread}(E_0 a(6)^{lo}) spread(E0a(6)lo) spread ( E 0 a ( 6 ) h i ) \texttt{spread}(E_0 a(6)^{hi}) spread(E0a(6)hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)
0 0 1 0 0 0 0 0 0 0 0 {0,1,2} F 0 d ( 7 ) F_0 d(7) F0d(7) $\texttt{spread}(F_0 d(7)) $ F 0 b ( 5 ) l o F_0 b(5)^{lo} F0b(5)lo spread ( F 0 b ( 5 ) l o ) \texttt{spread}(F_0 b(5)^{lo}) spread(F0b(5)lo) F 0 b ( 5 ) h i F_0 b(5)^{hi} F0b(5)hi $\texttt{spread}(F_0 b(5)^{hi}) $ F 0 l o F_0^{lo} F0lo s p r e a d ( F 0 l o ) \mathtt{spread}(F_0^{lo}) spread(F0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} F 0 c ( 14 ) F_0 c(14) F0c(14) spread ( F 0 c ( 14 ) ) \texttt{spread}(F_0 c(14)) spread(F0c(14)) F 0 a ( 6 ) l o F_0 a(6)^{lo} F0a(6)lo spread ( F 0 a ( 6 ) l o ) \texttt{spread}(F_0 a(6)^{lo}) spread(F0a(6)lo) F 0 a ( 6 ) h i F_0 a(6)^{hi} F0a(6)hi $\texttt{spread}(F_0 a(6)^{hi}) $ F 0 h i F_0^{hi} F0hi s p r e a d ( F 0 h i ) \mathtt{spread}(F_0^{hi}) spread(F0hi)
0 0 1 0 0 0 0 0 0 0 0 {0,1,2} G 0 d ( 7 ) G_0 d(7) G0d(7) $\texttt{spread}(G_0 d(7)) $ G 0 b ( 5 ) l o G_0 b(5)^{lo} G0b(5)lo spread ( G 0 b ( 5 ) l o ) \texttt{spread}(G_0 b(5)^{lo}) spread(G0b(5)lo) G 0 b ( 5 ) h i G_0 b(5)^{hi} G0b(5)hi $\texttt{spread}(G_0 b(5)^{hi}) $ G 0 l o G_0^{lo} G0lo s p r e a d ( G 0 l o ) \mathtt{spread}(G_0^{lo}) spread(G0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} G 0 c ( 14 ) G_0 c(14) G0c(14) spread ( G 0 c ( 14 ) ) \texttt{spread}(G_0 c(14)) spread(G0c(14)) G 0 a ( 6 ) l o G_0 a(6)^{lo} G0a(6)lo spread ( G 0 a ( 6 ) l o ) \texttt{spread}(G_0 a(6)^{lo}) spread(G0a(6)lo) G 0 a ( 6 ) h i G_0 a(6)^{hi} G0a(6)hi $\texttt{spread}(G_0 a(6)^{hi}) $ G 0 h i G_0^{hi} G0hi s p r e a d ( G 0 h i ) \mathtt{spread}(G_0^{hi}) spread(G0hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} P 0 e v e n P_0^{even} P0even spread ( P 0 e v e n ) \texttt{spread}(P_0^{even}) spread(P0even) s p r e a d ( E l o ) \mathtt{spread}(E^{lo}) spread(Elo) s p r e a d ( E h i ) \mathtt{spread}(E^{hi}) spread(Ehi) Q 0 o d d Q_0^{odd} Q0odd K 0 l o K_0^{lo} K0lo H 0 l o H_0^{lo} H0lo W 0 l o W_0^{lo} W0lo
0 0 0 0 0 0 0 1 0 0 1 {0,1,2,3,4,5} P 0 o d d P_0^{odd} P0odd spread ( P 0 o d d ) \texttt{spread}(P_0^{odd}) spread(P0odd) spread ( P 1 o d d ) \texttt{spread}(P_1^{odd}) spread(P1odd) Σ 1 ( E 0 ) l o \Sigma_1(E_0)^{lo} Σ1(E0)lo Σ 1 ( E 0 ) h i \Sigma_1(E_0)^{hi} Σ1(E0)hi K 0 h i K_0^{hi} K0hi H 0 h i H_0^{hi} H0hi W 0 h i W_0^{hi} W0hi
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} P 1 e v e n P_1^{even} P1even spread ( P 1 e v e n ) \texttt{spread}(P_1^{even}) spread(P1even) s p r e a d ( F l o ) \mathtt{spread}(F^{lo}) spread(Flo) s p r e a d ( F h i ) \mathtt{spread}(F^{hi}) spread(Fhi) Q 1 o d d Q_1^{odd} Q1odd P 1 o d d P_1^{odd} P1odd H p r i m e 0 l o Hprime_0^{lo} Hprime0lo H p r i m e 0 h i Hprime_0^{hi} Hprime0hi H p r i m e 0 c a r r y Hprime_0 carry Hprime0carry
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} P 1 o d d P_1^{odd} P1odd spread ( P 1 o d d ) \texttt{spread}(P_1^{odd}) spread(P1odd) D 0 l o D_0^{lo} D0lo E 1 l o E_1^{lo} E1lo
0 0 0 0 0 0 0 0 0 1 0 {0,1,2,3,4,5} Q 0 e v e n Q_0^{even} Q0even spread ( Q 0 e v e n ) \texttt{spread}(Q_0^{even}) spread(Q0even) s p r e a d ( E n e g l o ) \mathtt{spread}(E_{neg}^{lo}) spread(Eneglo) s p r e a d ( E n e g h i ) \mathtt{spread}(E_{neg}^{hi}) spread(Eneghi) s p r e a d ( E l o ) \mathtt{spread}(E^{lo}) spread(Elo) D 0 h i D_0^{hi} D0hi E 1 h i E_1^{hi} E1hi E 1 c a r r y E_1 carry E1carry
0 0 0 0 0 0 1 0 0 0 0 {0,1,2,3,4,5} Q 0 o d d Q_0^{odd} Q0odd spread ( Q 0 o d d ) \texttt{spread}(Q_0^{odd}) spread(Q0odd) spread ( Q 1 o d d ) \texttt{spread}(Q_1^{odd}) spread(Q1odd) s p r e a d ( E h i ) \mathtt{spread}(E^{hi}) spread(Ehi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} Q 1 e v e n Q_1^{even} Q1even spread ( Q 1 e v e n ) \texttt{spread}(Q_1^{even}) spread(Q1even) s p r e a d ( G l o ) \mathtt{spread}(G^{lo}) spread(Glo) s p r e a d ( G h i ) \mathtt{spread}(G^{hi}) spread(Ghi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} Q 1 o d d Q_1^{odd} Q1odd spread ( Q 1 o d d ) \texttt{spread}(Q_1^{odd}) spread(Q1odd)
0 1 0 0 0 0 0 0 0 0 0 {0,1,2} A 0 b ( 11 ) A_0 b(11) A0b(11) spread ( A 0 b ( 11 ) ) \texttt{spread}(A_0 b(11)) spread(A0b(11)) A 0 c ( 9 ) l o A_0 c(9)^{lo} A0c(9)lo spread ( A 0 c ( 9 ) l o ) \texttt{spread}(A_0 c(9)^{lo}) spread(A0c(9)lo) A 0 c ( 9 ) m i d A_0 c(9)^{mid} A0c(9)mid spread ( A 0 c ( 9 ) m i d ) \texttt{spread}(A_0 c(9)^{mid}) spread(A0c(9)mid) A 0 l o A_0^{lo} A0lo s p r e a d ( A 0 l o ) \mathtt{spread}(A_0^{lo}) spread(A0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} A 0 d ( 10 ) A_0 d(10) A0d(10) spread ( A 0 d ( 10 ) ) \texttt{spread}(A_0 d(10)) spread(A0d(10)) A 0 a ( 2 ) A_0 a(2) A0a(2) spread ( A 0 a ( 2 ) ) \texttt{spread}(A_0 a(2)) spread(A0a(2)) A 0 c ( 9 ) h i A_0 c(9)^{hi} A0c(9)hi spread ( A 0 c ( 9 ) h i ) \texttt{spread}(A_0 c(9)^{hi}) spread(A0c(9)hi) A 0 h i A_0^{hi} A0hi s p r e a d ( A 0 h i ) \mathtt{spread}(A_0^{hi}) spread(A0hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 e v e n R_0^{even} R0even spread ( R 0 e v e n ) \texttt{spread}(R_0^{even}) spread(R0even) spread ( c ( 9 ) l o ) \texttt{spread}(c(9)^{lo}) spread(c(9)lo) spread ( c ( 9 ) m i d ) \texttt{spread}(c(9)^{mid}) spread(c(9)mid)
0 0 0 1 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 0 o d d R_0^{odd} R0odd spread ( R 0 o d d ) \texttt{spread}(R_0^{odd}) spread(R0odd) spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd) spread ( d ( 10 ) ) \texttt{spread}(d(10)) spread(d(10)) spread ( b ( 11 ) ) \texttt{spread}(b(11)) spread(b(11))
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 e v e n R_1^{even} R1even spread ( R 1 e v e n ) \texttt{spread}(R_1^{even}) spread(R1even) spread ( a ( 2 ) ) \texttt{spread}(a(2)) spread(a(2)) spread ( c ( 9 ) h i ) \texttt{spread}(c(9)^{hi}) spread(c(9)hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} R 1 o d d R_1^{odd} R1odd spread ( R 1 o d d ) \texttt{spread}(R_1^{odd}) spread(R1odd)
0 1 0 0 0 0 0 0 0 0 0 {0,1,2} B 0 b ( 11 ) B_0 b(11) B0b(11) spread ( B 0 b ( 11 ) ) \texttt{spread}(B_0 b(11)) spread(B0b(11)) B 0 c ( 9 ) l o B_0 c(9)^{lo} B0c(9)lo spread ( B 0 c ( 9 ) l o ) \texttt{spread}(B_0 c(9)^{lo}) spread(B0c(9)lo) B 0 c ( 9 ) m i d B_0 c(9)^{mid} B0c(9)mid spread ( B 0 c ( 9 ) m i d ) \texttt{spread}(B_0 c(9)^{mid}) spread(B0c(9)mid) B 0 l o B_0^{lo} B0lo s p r e a d ( B 0 l o ) \mathtt{spread}(B_0^{lo}) spread(B0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} B 0 d ( 10 ) B_0 d(10) B0d(10) spread ( B 0 d ( 10 ) ) \texttt{spread}(B_0 d(10)) spread(B0d(10)) B 0 a ( 2 ) B_0 a(2) B0a(2) spread ( B 0 a ( 2 ) ) \texttt{spread}(B_0 a(2)) spread(B0a(2)) B 0 c ( 9 ) h i B_0 c(9)^{hi} B0c(9)hi spread ( B 0 c ( 9 ) h i ) \texttt{spread}(B_0 c(9)^{hi}) spread(B0c(9)hi) B 0 h i B_0^{hi} B0hi s p r e a d ( B 0 h i ) \mathtt{spread}(B_0^{hi}) spread(B0hi)
0 1 0 0 0 0 0 0 0 0 0 {0,1,2} C 0 b ( 11 ) C_0 b(11) C0b(11) spread ( C 0 b ( 11 ) ) \texttt{spread}(C_0 b(11)) spread(C0b(11)) C 0 c ( 9 ) l o C_0 c(9)^{lo} C0c(9)lo spread ( C 0 c ( 9 ) l o ) \texttt{spread}(C_0 c(9)^{lo}) spread(C0c(9)lo) C 0 c ( 9 ) m i d C_0 c(9)^{mid} C0c(9)mid spread ( C 0 c ( 9 ) m i d ) \texttt{spread}(C_0 c(9)^{mid}) spread(C0c(9)mid) C 0 l o C_0^{lo} C0lo s p r e a d ( C 0 l o ) \mathtt{spread}(C_0^{lo}) spread(C0lo)
0 0 0 0 0 0 0 0 0 0 0 {0,1} C 0 d ( 10 ) C_0 d(10) C0d(10) spread ( C 0 d ( 10 ) ) \texttt{spread}(C_0 d(10)) spread(C0d(10)) C 0 a ( 2 ) C_0 a(2) C0a(2) spread ( C 0 a ( 2 ) ) \texttt{spread}(C_0 a(2)) spread(C0a(2)) C 0 c ( 9 ) h i C_0 c(9)^{hi} C0c(9)hi spread ( C 0 c ( 9 ) h i ) \texttt{spread}(C_0 c(9)^{hi}) spread(C0c(9)hi) C 0 h i C_0^{hi} C0hi s p r e a d ( C 0 h i ) \mathtt{spread}(C_0^{hi}) spread(C0hi)
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} M 0 e v e n M_0^{even} M0even spread ( M 0 e v e n ) \texttt{spread}(M_0^{even}) spread(M0even) M 1 o d d M_1^{odd} M1odd s p r e a d ( A 0 l o ) \mathtt{spread}(A_0^{lo}) spread(A0lo) s p r e a d ( A 0 h i ) \mathtt{spread}(A_0^{hi}) spread(A0hi) H p r i m e 0 l o Hprime_0^{lo} Hprime0lo H p r i m e 0 h i Hprime_0^{hi} Hprime0hi
0 0 0 0 0 1 0 0 1 0 0 {0,1,2,3,4,5} M 0 o d d M_0^{odd} M0odd spread ( M 0 o d d ) \texttt{spread}(M_0^{odd}) spread(M0odd) spread ( M 1 o d d ) \texttt{spread}(M_1^{odd}) spread(M1odd) s p r e a d ( B 0 l o ) \mathtt{spread}(B_0^{lo}) spread(B0lo) s p r e a d ( B 0 h i ) \mathtt{spread}(B_0^{hi}) spread(B0hi) Σ 0 ( A 0 ) l o \Sigma_0(A_0)^{lo} Σ0(A0)lo A 1 l o A_1^{lo} A1lo A 1 c a r r y A_1 carry A1carry
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} M 1 e v e n M_1^{even} M1even spread ( M 1 e v e n ) \texttt{spread}(M_1^{even}) spread(M1even) s p r e a d ( C 0 l o ) \mathtt{spread}(C_0^{lo}) spread(C0lo) s p r e a d ( C 0 h i ) \mathtt{spread}(C_0^{hi}) spread(C0hi) Σ 0 ( A 0 ) h i \Sigma_0(A_0)^{hi} Σ0(A0)hi A 1 h i A_1^{hi} A1hi
0 0 0 0 0 0 0 0 0 0 0 {0,1,2,3,4,5} M 1 o d d M_1^{odd} M1odd spread ( M 1 o d d ) \texttt{spread}(M_1^{odd}) spread(M1odd)

8.11.2 Steady-state:

s_digest sd_abcd sd_efgh ss0 ss1 s_maj s_ch_neg s_ch s_a_new s_e_new s_h_prime a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7 a 8 a_8 a8 a 9 a_9 a9
0   |   0   |   1   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |   {0,1,2}   |$F_0 d(7)$  |$\texttt{spread}(E_0 d(7)) $ |          $E_0 b(5)^{lo}$            | $\texttt{spread}(E_0 b(5)^{lo})$    |           $E_0 b(5)^{hi}$              |  $\texttt{spread}(E_0 b(5)^{hi}) $ |             $E_0^{lo}$             |  $\mathtt{spread}(E_0^{lo})$       |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |    {0,1}    |$E_0 c(14)$ |$\texttt{spread}(E_0 c(14))$ |          $E_0 a(6)^{lo}$            | $\texttt{spread}(E_0 a(6)^{lo})$    |           $E_0 a(6)^{hi}$              |  $\texttt{spread}(E_0 a(6)^{hi}) $ |             $E_0^{hi}$             |  $\mathtt{spread}(E_0^{hi})$       |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_0^{even}$|$\texttt{spread}(R_0^{even})$|   $\texttt{spread}(E_0 b(5)^{lo})$  |   $\texttt{spread}(E_0 b(5)^{hi})$  |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 1 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_0^{odd}$ |$\texttt{spread}(R_0^{odd})$ |        $\texttt{spread}(R_1^{odd})$ |    $\texttt{spread}(E_0 d(7))$      |     $\texttt{spread}(E_0 c(14))$       |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_1^{even}$|$\texttt{spread}(R_1^{even})$|   $\texttt{spread}(E_0 a(6)^{lo})$  |   $\texttt{spread}(E_0 a(6)^{hi})$  |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_1^{odd}$ |$\texttt{spread}(R_1^{odd})$ |                                     |                                     |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$P_0^{even}$|$\texttt{spread}(P_0^{even})$|  $\mathtt{spread}(E^{lo})$          |      $\mathtt{spread}(E^{hi})$      |           $Q_0^{odd}$                  |             $K_0^{lo}$             |             $H_0^{lo}$             |             $W_0^{lo}$             |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 1  |    0   |    0   |    1    |{0,1,2,3,4,5}|$P_0^{odd}$ |$\texttt{spread}(P_0^{odd})$ | $\texttt{spread}(P_1^{odd})$        |        $\Sigma_1(E_0)^{lo}$         |       $\Sigma_1(E_0)^{hi}$             |             $K_0^{hi}$             |             $H_0^{hi}$             |             $W_0^{hi}$             |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$P_1^{even}$|$\texttt{spread}(P_1^{even})$|  $\mathtt{spread}(F^{lo})$          |      $\mathtt{spread}(F^{hi})$      |           $Q_1^{odd}$                  |            $P_1^{odd}$             |           $Hprime_0^{lo}$          |           $Hprime_0^{hi}$          |          $Hprime_0 carry$          |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$P_1^{odd}$ |$\texttt{spread}(P_1^{odd})$ |                                     |                                     |                                        |                                    |             $D_0^{lo}$             |             $E_1^{lo}$             |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    1   |    0    |{0,1,2,3,4,5}|$Q_0^{even}$|$\texttt{spread}(Q_0^{even})$| $\mathtt{spread}(E_{neg}^{lo})$     |    $\mathtt{spread}(E_{neg}^{hi})$  |     $\mathtt{spread}(E^{lo})$          |                                    |             $D_0^{hi}$             |             $E_1^{hi}$             |             $E_1 carry$            |
0   |   0   |   0   | 0 | 0 | 0   |    1   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$Q_0^{odd}$ |$\texttt{spread}(Q_0^{odd})$ | $\texttt{spread}(Q_1^{odd})$        |                                     |     $\mathtt{spread}(E^{hi})$          |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$Q_1^{even}$|$\texttt{spread}(Q_1^{even})$| $\mathtt{spread}(G^{lo})$           |       $\mathtt{spread}(G^{hi})$     |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$Q_1^{odd}$ |$\texttt{spread}(Q_1^{odd})$ |                                     |                                     |                                        |                                    |                                    |                                    |                                    |
0   |   1   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |   {0,1,2}   |$A_0 b(11)$ |$\texttt{spread}(A_0 b(11))$ |          $A_0 c(9)^{lo}$            | $\texttt{spread}(A_0 c(9)^{lo})$    |          $A_0 c(9)^{mid}$              | $\texttt{spread}(A_0 c(9)^{mid})$  |             $A_0^{lo}$             |  $\mathtt{spread}(A_0^{lo})$       |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |    {0,1}    |$A_0 d(10)$ |$\texttt{spread}(A_0 d(10))$ |              $A_0 a(2)$             | $\texttt{spread}(A_0 a(2))$         |          $A_0 c(9)^{hi}$               | $\texttt{spread}(A_0 c(9)^{hi})$   |             $A_0^{hi}$             |  $\mathtt{spread}(A_0^{hi})$       |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_0^{even}$|$\texttt{spread}(R_0^{even})$|    $\texttt{spread}(c(9)^{lo})$     |    $\texttt{spread}(c(9)^{mid})$    |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 1 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_0^{odd}$ |$\texttt{spread}(R_0^{odd})$ |        $\texttt{spread}(R_1^{odd})$ |     $\texttt{spread}(d(10))$        |         $\texttt{spread}(b(11))$       |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_1^{even}$|$\texttt{spread}(R_1^{even})$|    $\texttt{spread}(a(2))$          |      $\texttt{spread}(c(9)^{hi})$   |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$R_1^{odd}$ |$\texttt{spread}(R_1^{odd})$ |                                     |                                     |                                        |                                    |                                    |                                    |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$M_0^{even}$|$\texttt{spread}(M_0^{even})$|              $M_1^{odd}$            |     $\mathtt{spread}(A_0^{lo})$     |     $\mathtt{spread}(A_0^{hi})$        |                                    |           $Hprime_0^{lo}$          |           $Hprime_0^{hi}$          |                                    |
0   |   0   |   0   | 0 | 0 | 1   |    0   | 0  |    1   |    0   |    0    |{0,1,2,3,4,5}|$M_0^{odd}$ |$\texttt{spread}(M_0^{odd})$ |    $\texttt{spread}(M_1^{odd})$     |     $\mathtt{spread}(B_0^{lo})$     |     $\mathtt{spread}(B_0^{hi})$        |        $\Sigma_0(A_0)^{lo}$        |                                    |             $A_1^{lo}$             |              $A_1 carry$           |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$M_1^{even}$|$\texttt{spread}(M_1^{even})$|                                     |     $\mathtt{spread}(C_0^{lo})$     |     $\mathtt{spread}(C_0^{hi})$        |        $\Sigma_0(A_0)^{hi}$        |                                    |             $A_1^{hi}$             |                                    |
0   |   0   |   0   | 0 | 0 | 0   |    0   | 0  |    0   |    0   |    0    |{0,1,2,3,4,5}|$M_1^{odd}$ |$\texttt{spread}(M_1^{odd})$ |                                     |                                     |                                        |                                    |                                    |                                    |                                    |

8.11.3 Final digest:

s_digest sd_abcd sd_efgh ss0 ss1 s_maj s_ch_neg s_ch s_a_new s_e_new s_h_prime a 0 a_0 a0 a 1 a_1 a1 a 2 a_2 a2 a 3 a_3 a3 a 4 a_4 a4 a 5 a_5 a5 a 6 a_6 a6 a 7 a_7 a7 a 8 a_8 a8 a 9 a_9 a9
1 0 0 0 0 0 0 0 0 0 0 0 0 0 A 63 l o A_{63}^{lo} A63lo A 63 h i A_{63}^{hi} A63hi A 63 A_{63} A63 B 63 l o B_{63}^{lo} B63lo B 63 h i B_{63}^{hi} B63hi B 63 B_{63} B63
0 0 0 0 0 0 0 0 0 0 0 0 0 0 C 63 l o C_{63}^{lo} C63lo C 63 h i C_{63}^{hi} C63hi C 63 C_{63} C63 C 63 l o C_{63}^{lo} C63lo C 63 h i C_{63}^{hi} C63hi C 63 C_{63} C63
1 0 0 0 0 0 0 0 0 0 0 0 0 0 E 63 l o E_{63}^{lo} E63lo E 63 h i E_{63}^{hi} E63hi E 63 E_{63} E63 G 63 l o G_{63}^{lo} G63lo G 63 h i G_{63}^{hi} G63hi G 63 G_{63} G63
0 0 0 0 0 0 0 0 0 0 0 0 0 0 F 63 l o F_{63}^{lo} F63lo F 63 h i F_{63}^{hi} F63hi F 63 F_{63} F63 H 63 l o H_{63}^{lo} H63lo H 63 h i H_{63}^{hi} H63hi H 63 H_{63} H63

参考资料

[1] Halo2中的SHA-256 Gadget

猜你喜欢

转载自blog.csdn.net/mutourend/article/details/120592526