Import std.crypto.ciphers
std.crypto.ciphers
Aes256Gcm and ChaCha20Poly1305, over mbedTLS: authenticated encryption, which keeps a message secret and tells whether it was changed. Seal takes a new random nonce for each message and puts it first in what it gives, so a nonce is never given, and never reused but by a chance of about 1 in 2^33 after 2^32 messages under one key, which is as many as a key should seal. Open gives Null for anything Seal didn't make with that key and associated data.
std/crypto/ciphers.fb
Types
Aes256Gcm
struct
Public Struct Aes256Gcm
AES-256 in GCM (NIST SP 800-38D), fast where the CPU has AES instructions.
std/crypto/ciphers.fb, line 22
-
A new random key, 32 bytes.
-
@PanicsAtCaller Public Static Method Seal(key: UInt8[], message: UInt8[], associated: UInt8[] = []): UInt8[]static method #message, encrypted withkey, 32 bytes: the nonce, 12 bytes, the ciphertext, as long asmessage, and the tag, 16 bytes, which authenticates them andassociated, data that isn't encrypted but has to be the same to open it. Panics unlesskeyis 32 bytes. -
@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 #The message Seal sealed into
sealed, or Null whensealedisn't what Seal gave forkeyandassociated, or was changed. Panics unlesskeyis 32 bytes.
ChaCha20Poly1305
struct
Public Struct ChaCha20Poly1305
ChaCha20 and Poly1305 (RFC 8439), fast on any CPU, with or without AES instructions.
std/crypto/ciphers.fb, line 54
-
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.