-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Stronger password hashing via sequential memory-hard functions. -- -- This package provides bindings to Colin Percival's scrypt -- implementation (http://www.tarsnap.com/scrypt.html). Scrypt is -- a key derivation function designed to be far more secure against -- hardware brute-force attacks than alternative functions such as PBKDF2 -- or bcrypt. -- -- Details of the scrypt key derivation function are given in a paper by -- Colin Percival, Stronger Key Derivation via Sequential Memory-Hard -- Functions: http://www.tarsnap.com/scrypt/scrypt.pdf. @package scrypt @version 0.3.4 -- | Scrypt is a sequential memory-hard key derivation function. This -- module provides low-level bindings to the scrypt key derivation -- function as well as a higher-level password-storage API. It is based -- on a fast C implementation of scrypt, written by Colin Percival. For -- further information see http://www.tarsnap.com/scrypt.html. module Crypto.Scrypt -- | Encapsulates the three tuning parameters to the scrypt -- function: N, r and p (see above). data ScryptParams -- | Constructor function for the ScryptParams data type scryptParams :: Integer -> Integer -> Integer -> Maybe ScryptParams -- | Default parameters as recommended in the scrypt paper: -- --
-- N = 2^14, r = 8, p = 1 ---- -- Equivalent to fromJust (scryptParams 14 8 1). defaultParams :: ScryptParams newtype EncryptedPass EncryptedPass :: ByteString -> EncryptedPass unEncryptedPass :: EncryptedPass -> ByteString -- | Encrypt the password with the given parameters and a random 32-byte -- salt. The salt is read from /dev/urandom on Unix systems or -- CryptoAPI on Windows. encryptPass :: ScryptParams -> Pass -> IO EncryptedPass -- | Equivalent to encryptPass defaultParams. encryptPass' :: Pass -> IO EncryptedPass -- | Verify a Pass against an EncryptedPass. The function -- also takes ScryptParams meeting your current security -- requirements. In case the EncryptedPass was generated with -- different parameters, the function returns an updated -- EncryptedPass, generated with the given ScryptParams. -- The Salt is kept from the given EncryptedPass. verifyPass :: ScryptParams -> Pass -> EncryptedPass -> (Bool, Maybe EncryptedPass) -- | Check the Pass against the EncryptedPass, using the -- ScryptParams encapsulated in the EncryptedPass. verifyPass' :: Pass -> EncryptedPass -> Bool newtype Pass Pass :: ByteString -> Pass unPass :: Pass -> ByteString newtype Salt Salt :: ByteString -> Salt unSalt :: Salt -> ByteString newtype PassHash PassHash :: ByteString -> PassHash unHash :: PassHash -> ByteString -- | Calculates a 64-byte hash from the given password, salt and -- parameters. scrypt :: ScryptParams -> Salt -> Pass -> PassHash -- | Note the prime symbol ('). Calls scrypt with -- defaultParams. scrypt' :: Salt -> Pass -> PassHash instance Show Pass instance Eq Pass instance Show Salt instance Eq Salt instance Show PassHash instance Eq PassHash instance Show EncryptedPass instance Eq EncryptedPass instance Eq ScryptParams instance Show ScryptParams