Module lib_gistit::encrypt [−][src]
Expand description
The encryption module
Hashing
Md5 digestion algorithm was used to implement the Gistit payload hashing procedure since we just need a fast hash algorithm to uniquely identify our Gistits and here security is not an concern. Also, 128bits is fine and doesn’t look too long of a hex-string when copying and sharing.
Secrets
Scrypt algorithm was used to hash the provided secret. The params values choosen
N = 2^2
, R = 8
, and P = 1
as discussed here.
Encryption
The encryption/decryption process relies on AesGcm
algorithm with 256-bit key and 96-bit
nounce. See aes_gcm
for more info.
Structs
The hashed secret
The data structure to hold the provided secret
Functions
Decrypts encrypted_data
given the magic
and a Md5 hash of the provided secret.
Expects the same nounce
(magic
) and secret
as given in the encryption process.
Digests a single byte array into Md5
and outputs the resulting string
Digests a slice of byte arrays into Md5
and outputs the resulting string
Encrypts raw_data
with a randomly generated nounce
and a Md5 hash of the provided secret