Crate enchanter

Source

Constants§

TUR
There are three arbitrary consants of sufficient length (46 bytes) used as fixed salts. One of them is a “public const” named “TUR”, while the other two are a private constants used within this module named “MAH” and “DEP”.

Functions§

a3
Generate key material with three 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 “MAH” salt. The third round is the output of the second round and the “DEP” salt.
checks
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.
ciphertext_hash
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_file
Decrypt a file with XChaCha20Poly1305.
decrypt_stdout
Decrypt a file to STDOUT. 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_file
Encrypt a file with XChaCha20Poly1305. The function takes an input file, and output, and key to use for the encryption. A nonce is generated using 8 bytes of time data and 16 random bytes.