OxL Reference

method aead.sealChaCha

ChaCha20-Poly1305.

Example:

oxl✓ checked in CI
use std.crypto { aead }
use std.ser { bytesOf, textOf }

fn main() io, rand {
  let key = bytesOf(&"0123456789abcdef0123456789abcdef")
  let sealed = aead.sealChaCha(key, bytesOf(&"hi"))!
  print("{sealed.len()} {textOf(&aead.unsealChaCha(key, sealed)!)!}")
}
Output
30 hi
pub(api) static fn sealChaCha(key: bytes, plain: bytes, aad: bytes = b"") -> bytes | CryptoError  rand

Complexity. O(n) in the size of the message.

Since. 1.0.0-beta

Parameters

NameType
keybytes
plainbytes
aadbytes = b""

Returns

bytes

Errors

  • CryptoError @error
  • `CryptoError` when the key is not 32 bytes.

Effects

rand

Defined in: std/crypto/crypto.oxl:497

See also