def open_len
bend-collections@1.0.0.0 · spec/crypto/chacha20poly1305.bend:54
import bend-collections@1.0.0.0/spec/crypto/chacha20poly1305.bend as Chacha20poly1305
import Base
import bend-collections@1.0.0.0/spec/crypto/chacha.bend as CH
54def open_len(short: Bool, +key: List<&2, U32>, +nonce: List<&2, U32>, +aad: List<&2, U32>, +data: List<&2, U32>) -> Maybe<&2, List<&2, U32>>:
55 match short:
56 case True{}: None{}
57 case False{}:
58 +n = Nat.sub(List.length(&2, U32, data), 16n)
59 open_split(key, nonce, aad, CH.prefix(n, data), CH.suffix(n, data))