module

Crypto

Constants

MUCH_MB = 50
OVERHEAD_SYMMETRIC = MAC.size + Nonce.size

Class methods

blake2b(data : Bytes, *, hash_size : Int32 = 64, key : Bytes | Nil = nil) : Bytes

Calculate BLAKE2b hash of data, result will have hash_size bytes.

hash_size - Length of hash, in bytes. Must be between 1 and 64. Anything below 16 is discouraged when using BLAKE2b as a message authentication code. Anything below 32 is discouraged when using BLAKE2b as a key derivation function (KDF).

key - Some secret key. When uniformly random, one cannot predict the final hash without it.

Source
decrypt(*, output : Bytes, additional : Bytes | Nil = nil, key : SymmetricKey, input : Bytes) : Bool
Source
encrypt(*, output : Bytes, key : SymmetricKey, input : Bytes, additional : Bytes | Nil = nil) : Nil

adds nonce and mac to the packet

Source
generate_ed25519_keys
Source
generate_signing_keys
Source
sha512(data : Bytes) : Bytes

Calculate SHA-512 hash of data

Source
sha512_hmac(data : Bytes, key : Bytes) : Bytes

Calculate HMAC with SHA-512, that can be used for message authentication codes or as a random oracle.

Source

Nested types