Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- pbkdf2 :: (ByteString -> ByteString -> ByteString) -> ByteString -> ByteString -> Integer -> ByteString
- pbkdf2_iterative :: (ByteString -> ByteString -> ByteString) -> ByteString -> ByteString -> Integer -> ByteString
Documentation
:: (ByteString -> ByteString -> ByteString) |
|
-> ByteString |
|
-> ByteString |
|
-> Integer |
|
-> ByteString |
|
:: (ByteString -> ByteString -> ByteString) |
|
-> ByteString |
|
-> ByteString |
|
-> Integer |
|
-> ByteString |
|
This is a non standard variation of PBKDF2 which recursively uses the last generated value to improve the salt. In difference to pbkdf2 the salt can not be precalculated for every iteration (with a simple append of 4 bytes), but has to be calculated for every single iteration. This also creates a function where you cannot jump in the stream without calculating everything before it. Compared to the standard this function only changes the salt for the initial PBKDF2 value of each iteration to include a salt iterated from earlier parts of the PBKDF2 stream. This can be verified by removing the i from (hash $ B.concat [blockSalt, salt, B.pack $ octetsBE c]).
The added salt for the first iteration will be "", and all following will be calculated as (PRF output input), where output is the output of the previous block and input is the added salt for the previous block. Notice that the output from the previous block is put in the password filed of the PRF.