def pad16

bend-collections@1.0.0.0 · spec/crypto/chacha20poly1305.bend:18

import bend-collections@1.0.0.0/spec/crypto/chacha20poly1305.bend as Chacha20poly1305
import Base

18# pad16(x): zero bytes up to a multiple of 16, i.e. (16 - len(x) % 16) % 16
19# of them ("if (len(x) % 16) == 0 then NULL else copies(0, 16 - len % 16)").
20def pad16(+xs: List<&2, U32>) -> List<&2, U32>:
21  List.replicate(U32, Nat.mod(Nat.sub(16n, Nat.mod(List.length(&2, U32, xs), 16n)), 16n), 0)

Uses (6)

Used by (1)