cryptoPWHashScryptSalsa208SHA256 :: Ptr CUCharA pointer to the computed key.
-> CULLongThe length of the computed key. Should be between cryptoPWHashScryptSalsa208SHA256BytesMin and cryptoPWHashScryptSalsa208SHA256BytesMax (~127 GB).
-> Ptr CCharA pointer to the password from which the key is derived
-> CULLongThe length of the password. Should be between cryptoPWHashScryptSalsa208SHA256PasswdMin and cryptoPWHashScryptSalsa208SHA256PasswdMax.
-> Ptr CUCharThe salt, of length cryptoPWHashScryptSalsa208SHA256SaltBytes.
-> CULLongopslimit: The maximum amount of computations to perform. Must be between cryptoPWHashScryptSalsa208SHA256OpsLimitMin and cryptoPWHashScryptSalsa208SHA256OpsLimitMax.
-> CSizememlimit: The maximum amount of RAM in bytes that the function will use. It is highly recommended to allow the function to use at least 16 MiB. This number must be between cryptoPWHashScryptSalsa208SHA256MemLimitMin and cryptoPWHashScryptSalsa208SHA256MemLimitMax.
-> IO CIntReturns 0 on success, -1 if the computation didn't complete, usually because the operating system refused to allocate the amount of requested memory.
Derive a key from a password.
For interactive, online operations, cryptoPWHashScryptSalsa208SHA256OpsLimitInteractive and cryptoPWHashScryptSalsa208SHA256MemLimitInteractive provide a safe baseline to be used. However, using higher values may improve security.
For highly sensitive data, cryptoPWHashScryptSalsa208SHA256OpsLimitSensitive and cryptoPWHashScryptSalsa208SHA256MemLimitSensitive can be used as an alternative. However, with these parameters, deriving a key takes about 2 seconds on a 2.8 GHz Core i7 CPU and requires up to 1 GiB of dedicated RAM.
The salt should be unpredictable. randombytesBuf is the easiest way to fill the cryptoPWHashScryptSalsa208SHA256SaltBytes bytes of the salt.
Keep in mind that to produce the same key from the same password, the same salt, opslimit, and memlimit values must be used. Therefore, these parameters must be stored for each user.