Scrypt is a sequential memory-hard key derivation function. This module provides bindings to a fast C implementation of scrypt, written by Colin Percival. For more information see http://www.tarsnap.com/scrypt.html.
- data ScryptParams
- params :: Integer -> Integer -> Integer -> Maybe ScryptParams
- newtype Pass = Pass {
- unPass :: ByteString
- newtype Salt = Salt {
- unSalt :: ByteString
- newtype PassHash = PassHash {
- unHash :: ByteString
- scrypt :: ScryptParams -> Salt -> Pass -> PassHash
- scrypt' :: Salt -> Pass -> PassHash
- getSalt :: IO Salt
Parameters to the scrypt
function
data ScryptParams Source
Encapsulates the three tuning parameters to the scrypt
function: N
,
r
and p
. The parameters affect running time and memory usage:
Memory usage is approximately 128*r*N
bytes. Note that the
params
function takes log_2(N)
as a parameter. As an example, the
default parameters used by scrypt'
log_2(N) = 14, r = 8 and p = 1
lead to scrypt
using 128 * 8 * 2^14 = 16M
bytes of memory.
Running time is proportional to all of N
, r
and p
. However
p
only as an insignificant influence on memory usage an can thus be
used to tune the running time of scrypt
.
:: Integer |
|
-> Integer | The parameter |
-> Integer | The parameter |
-> Maybe ScryptParams | Returns |
Constructor function for the ScryptParams
data type
The scrypt
key derivation function
scrypt :: ScryptParams -> Salt -> Pass -> PassHashSource
Calculates a 64-byte hash from the given password, salt and parameters.