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)!)!}")
}Вывод
30 hi
pub(api) static fn sealChaCha(key: bytes, plain: bytes, aad: bytes = b"") -> bytes | CryptoError randСложность. O(n) in the size of the message.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
key | bytes |
plain | bytes |
aad | bytes = b"" |
Возвращает
bytes
Ошибки
CryptoError@error- `CryptoError` when the key is not 32 bytes.
Эффекты
rand
Определено в: std/crypto/crypto.oxl:497