def state

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/chacha.bend:98

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/chacha.bend as Chacha
import Base

98# The initial state: constants, key (eight words), block counter, nonce
99# (three words). Missing key or nonce words read as 0 (the public API
100# rejects other lengths before this is reached).
101def state(+k: List<&2, U32>, counter: U32, +n: List<&2, U32>) -> List<&2, U32>:
102  List.append(&2, U32, constants(),
103    [get(k, 0n), get(k, 1n), get(k, 2n), get(k, 3n), get(k, 4n), get(k, 5n), get(k, 6n), get(k, 7n),
104     counter, get(n, 0n), get(n, 1n), get(n, 2n)])

Uses (5)

Used by (4)