sha256-0.1.0.2: A modern binding to SHA256, HMAC, HKDF, and PBKDF2
Copyright(c) 2024 Auth Global
LicenseApache2
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Sha256.Pbkdf2

Description

An implementation of PBKDF2-HMAC-SHA256

Synopsis

Documentation

pbkdf2 Source #

Arguments

:: ByteString

nominally the "password"

-> ByteString

nominally the "salt"

-> Word64

number of rounds

-> Int

desired length of output

-> HashString 

Simple interface to PBKDF2. Reusing computations via partial application is not (yet!) supported. TODO: write pbkdf2 and pbkdf2_index functions in a point-free style.

pbkdf2_index Source #

Arguments

:: ByteString

nominally the "password"

-> ByteString

nominally the "salt"

-> Word32

the "index", returns the i-th block of output. The first index is 1, thus the result consists of bytes starting at 32*(i-1) and ending before 32*i. This is appended as 4 more bytes after the salt.

-> Word64

number of rounds

-> HashString

32-byte output"

pbkdf2Ctx_feed :: ByteString -> Pbkdf2Ctx -> Pbkdf2Ctx Source #

Append some bytes to the end of the salt. Flipped version of pbkdf2Ctx_update.

pbkdf2Ctx_feeds :: Foldable f => f ByteString -> Pbkdf2Ctx -> Pbkdf2Ctx Source #

Append zero or more bytestrings to the end of the salt. Flipped version of pbkdf2Ctx_updates.

pbkdf2Ctx_update :: Pbkdf2Ctx -> ByteString -> Pbkdf2Ctx Source #

Append some bytes to the end of the salt. Flipped version of pbkdf2Ctx_feed.

pbkdf2Ctx_updates :: Foldable f => Pbkdf2Ctx -> f ByteString -> Pbkdf2Ctx Source #

Append zero or more bytestrings to the end of the salt. Flipped version of pbkdf2Ctx_feeds

pbkdf2Ctx_finalize Source #

Arguments

:: Word32

index of output block

-> Pbkdf2Ctx 
-> Pbkdf2Gen 

Append the index to the end of the salt, and then initialize a Pbkdf2Gen with one round applied.

pbkdf2Gen_iterate Source #

Arguments

:: Word64

number of key-stretching rounds to perform

-> Pbkdf2Gen 
-> Pbkdf2Gen 

Apply zero or more rounds to a pbkdf2 computation.