def seal

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

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

38# 2.8 chacha20_aead_encrypt: ciphertext = chacha20_encrypt(key, 1, nonce,
39# plaintext), then the tag over aad and ciphertext.
40def seal(+key: List<&2, U32>, +nonce: List<&2, U32>, +aad: List<&2, U32>, +pt: List<&2, U32>) -> List<&2, U32>:
41  +ct = CH.encrypt(key, 1, nonce, pt)
42  List.append(&2, U32, ct, tag(key, nonce, aad, ct))

Uses (5)

Used by (10)