cryptonite/Crypto/Cipher
Lars Petersen ff8a1c524d Extend the internal interface of the Blowfish module.
In preparation of an implementation of the bcrypt_pbkdf (a
variant of PBKDF2 used by OpenSSH) algorithm,
certain low-level operations of the Blowfish algorithm need to
be generalized and exposed.

The Blowfish.Primitive module has already been extended to
account for the requirements imposed by the BCrypt algorithm,
but the salt length was limited to 16 bytes and the BCrypt
specific key schedule setup has been hard-coded into the Blowfish
module.

This commit makes a clear distintion between the expandKey and
expandKeyWithSalt operation. Both take arbitrary sized salts
and keys now. The specialized operation for 16 byte salts as used
by BCrypt has been preserved and is selected automatically.
Also, the BCrypt specific parts have been move to the BCrypt
module with regard to separation of concern.

A benchmark for generating BCrypt hashes with cost 10 shows a
performance improvement from 158 to 141ms on average (Intel i5-6500)
after this refactoring.
Further experiments suggest that the specialized expandKeyWithSalt128
does not have any advantage over the generalized version
and might be removed in favour of less branches and exceptional
behaviour.
2018-05-08 22:08:20 +02:00
..
AES Use pattern matching 2018-02-04 14:35:43 +01:00
Blowfish Extend the internal interface of the Blowfish module. 2018-05-08 22:08:20 +02:00
Camellia Various documentation copy editing 2017-11-18 14:27:44 -05:00
CAST5 Add CAST5 aka CAST-128 2017-09-17 11:28:56 +02:00
DES add comments and description 2015-05-20 06:07:31 +01:00
Twofish Twofish 192 and 256 bit key support 2017-04-10 00:33:54 -04:00
Types add aes ccm support 2018-02-03 09:31:36 +01:00
AES.hs Improve types and indentation, fix typo 2018-02-03 19:05:20 +01:00
Blowfish.hs add optional support for deepseq 2015-05-22 18:35:46 +01:00
Camellia.hs start cleaning up Camellia 2015-04-09 07:41:15 +01:00
CAST5.hs Add CAST5 aka CAST-128 2017-09-17 11:28:56 +02:00
ChaCha.hs Various documentation copy editing 2017-11-18 14:27:44 -05:00
ChaChaPoly1305.hs [ChaChaPoly1305] fix type error of example code 2015-12-03 18:05:04 +00:00
DES.hs move to memory stuff 2015-05-09 14:23:32 +01:00
RC4.hs add optional support for deepseq 2015-05-22 18:35:46 +01:00
Salsa.hs Implement the XSalsa20 stream cipher 2016-10-09 15:25:31 +02:00
TripleDES.hs move to memory stuff 2015-05-09 14:23:32 +01:00
Twofish.hs Add import to fix backwards compatibility 2017-04-10 00:57:49 -04:00
Types.hs add aes ccm support 2018-02-03 09:31:36 +01:00
Utils.hs Twofish 192 and 256 bit key support 2017-04-10 00:33:54 -04:00
XSalsa.hs Implement the XSalsa20 stream cipher 2016-10-09 15:25:31 +02:00