OxL Справочник OxL
РусскийEnglish

method aead.sealChaCha

ChaCha20-Poly1305.

Example:

oxl✓ проверяется в 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)!)!}")
}
Вывод
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

Параметры

ИмяТип
keybytes
plainbytes
aadbytes = b""

Возвращает

bytes

Ошибки

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

Эффекты

rand

Определено в: std/crypto/crypto.oxl:497

См. также