Import std.crypto.ciphers
ChaCha20Poly1305
struct
Public Struct ChaCha20Poly1305
ChaCha20 and Poly1305 (RFC 8439), fast on any CPU, with or without AES instructions.
Examples
Local key = ChaCha20Poly1305.NewKey()
Local header = "message 1".Bytes
Local sealed = ChaCha20Poly1305.Seal(key, "secret", header)
Expect(ChaCha20Poly1305.Open(key, sealed, header) == "secret".Bytes)
Expect(ChaCha20Poly1305.Open(key, sealed, "message 2".Bytes) == Null)std/crypto/ciphers.fb, line 78
-
A new random key, 32 bytes.
-
@PanicsAtCaller Public Static Method Seal(key: UInt8[], message: UInt8[], associated: UInt8[] = []): UInt8[]static method #As Aes256Gcm's Seal.
-
@PanicsAtCaller Public Static Method Seal(key: UInt8[], text: String, associated: UInt8[] = []): UInt8[]static method #text's UTF-8 bytes, encrypted withkey, as the Seal that takes bytes does. -
@PanicsAtCaller Public Static Method Open(key: UInt8[], sealed: UInt8[], associated: UInt8[] = []): UInt8[]?static method #As Aes256Gcm's Open.
Report an issue with this page or with FutureBlitz on GitHub.