There are two arbitrary consants of sufficient length (46 bytes) used as fixed salts.
One of them is a “public const” named “MAGIC”, while the other is
a private constant used within this module named “ENCHA”.
Generate key material with two rounds of Argon2id.
The first round is based on the password and supplied salt.
The second round is the output of the first round and the “ENCHA” salt.
Decrypt a file to STDOUT with AES-256 in GCM mode.
The output is any UTF-8 data. If the data is non-UTF-8,
decrypt to a file instead with the aead_decrypt_file function.
This “checks” function is a string comparison function to ensure that the ciphertext hasn’t been
tampered with and that the key material is correct. Supply the function with two hashes
generated from the ciphertext_hash function.
This function generates a SHA3 XOF with SHAKE 256.
The XOF (hash) has input of the password and the ciphertext so
that if either the password is incorrect or the ciphertext has been
modified, the value will change.
Decrypt a file to STDOUT in AES-256 in CTR mode.
The output is any UTF-8 data. If the data is non-UTF-8,
decrypt to a file instead with the decrypt_file function.
Encrypt a file with AES-256 in CTR mode. The function takes an input file, and output, and key to use for
the encryption. A nonce is generated using the generate_nonce function. With the nonce generation
built in, this function ensures that a nonce is not used twice.