def rekey
import bend-collections@1.0.0.0/src/math/random/chacha8.bend as Chacha8import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
import bend-collections@1.0.0.0/src/math/random/chacha8/block.bend as B
45# the key of the next iteration: the last four words of the last group
46def rekey(l: List<&2, W.U64>) -> B.Key:
47 match l:
48 case [W.U64{k0, k1}, W.U64{k2, k3}, W.U64{k4, k5}, W.U64{k6, k7}]:
49 B.K{k0, k1, k2, k3, k4, k5, k6, k7}
50 case _:
51 B.K{0, 0, 0, 0, 0, 0, 0, 0}