crypton
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.KDF.Scrypt

Description

Scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" http://www.tarsnap.com/scrypt/scrypt.pdf.

Synopsis

Documentation

data Parameters Source #

Parameters for Scrypt

Constructors

Parameters 

Fields

  • n :: Word64

    Cpu/Memory cost ratio. must be a power of 2 greater than 1. also known as N.

  • r :: Int

    Must be positive, below 2^26, and satisfy r * p < 2^30

  • p :: Int

    Must be positive and satisfy r * p < 2^30

  • outputLength :: Int

    the number of bytes to generate out of Scrypt

generate :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray output) => Parameters -> password -> salt -> output Source #

Generate the scrypt key derivation data

Parameters the implementation refuses raise a CryptoError; tryGenerate reports the same condition as CryptoFailed.

tryGenerate :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray output) => Parameters -> password -> salt -> CryptoFailable output Source #

Generate the scrypt key derivation data, reporting parameters the implementation refuses rather than raising.

n has to be a power of two greater than 1, r and p positive, r times p below 2^30, and the 128 * r * n bytes of working memory addressable.