def g

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/blake/blake3.bend:83

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/blake/blake3.bend as Blake3
import Base

83# The quarter-round G on state positions a, b, c, d with message words mx, my.
84def g(+v: List<&2,U32>, +a: Nat, +b: Nat, +c: Nat, +d: Nat, +mx: U32, +my: U32) -> List<&2,U32>:
85  +va = U32.add(U32.add(at(v,a),at(v,b)),mx)
86  +vd = rotr(U32.xor(at(v,d),va),16n)
87  +vc = U32.add(at(v,c),vd)
88  +vb = rotr(U32.xor(at(v,b),vc),12n)
89  +va2 = U32.add(U32.add(va,vb),my)
90  +vd2 = rotr(U32.xor(vd,va2),8n)
91  +vc2 = U32.add(vc,vd2)
92  +vb2 = rotr(U32.xor(vb,vc2),7n)
93  put(put(put(put(v,a,va2),b,vb2),c,vc2),d,vd2)

Uses (8)

Used by (2)