Crypto.KDF.PBKDF2

crypton-1.0.1: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.KDF.PBKDF2

Description

Password Based Key Derivation Function 2

Synopsis

- type PRF password = password -> Bytes -> Bytes
- prfHMAC :: (HashAlgorithm a, ByteArrayAccess password) => a -> PRF password
- data Parameters = Parameters {
  - iterCounts :: Int
  - outputLength :: Int
  }
- generate :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray ba) => PRF password -> Parameters -> password -> salt -> ba
- fastPBKDF2_SHA1 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out
- fastPBKDF2_SHA256 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out
- fastPBKDF2_SHA512 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out

# Documentation

type PRF password #

Arguments

= password | the password parameters
-> Bytes | the content
-> Bytes | prf(password,content)

The PRF used for PBKDF2

prfHMAC :: (HashAlgorithm a, ByteArrayAccess password) => a -> PRF password #

PRF for PBKDF2 using HMAC with the hash algorithm as parameter

data Parameters #

Parameters for PBKDF2

Constructors

Parameters |
Fields iterCounts :: Int the number of user-defined iterations for the algorithms. e.g. WPA2 uses 4000. outputLength :: Int the number of bytes to generate out of PBKDF2

generate :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray ba) => PRF password -> Parameters -> password -> salt -> ba #

generate the pbkdf2 key derivation function from the output

fastPBKDF2_SHA1 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out #

fastPBKDF2_SHA256 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out #

fastPBKDF2_SHA512 :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) => Parameters -> password -> salt -> out #