def blocks

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

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

143# The plaintext cut into 64-byte blocks; the last one may be shorter (and
144# there is none for the empty plaintext). fuel bounds the number of blocks
145# (the length of the plaintext is enough).
146def blocks(fuel: Nat, +xs: List<&2, U32>) -> List<&2, List<&2, U32>>:
147  match fuel xs:
148    case 0n _: Nil{}
149    case 1n+p Nil{}: Nil{}
150    case 1n+p x <> rest: prefix(64n, x <> rest) <> blocks(p, suffix(64n, x <> rest))

Uses (5)

Used by (1)