method aead.sealChaCha
ChaCha20-Poly1305.
Example:
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 randComplexity. O(n) in the size of the message.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
key | bytes |
plain | bytes |
aad | bytes = b"" |
Returns
bytes
Errors
CryptoError@error- `CryptoError` when the key is not 32 bytes.
Effects
rand
Defined in: std/crypto/crypto.oxl:497