method aead.seal
AES-256-GCM.
Example:
use std.crypto { aead, rand }
use std.ser { bytesOf, textOf }
fn main() io, rand {
let key = rand.secure(32)
let sealed = aead.seal(key, bytesOf(&"secret"))!
print(textOf(&aead.unseal(key, sealed)!)!)
}Вывод
secret
pub(api) static fn seal(key: bytes, plain: bytes, aad: bytes = b"") -> bytes | CryptoError randС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
key | bytes |
plain | bytes |
aad | bytes = b"" |
Возвращает
bytes
Ошибки
CryptoError@error
Эффекты
rand
Определено в: std/crypto/crypto.oxl:451