Commit Graph

55 Commits

Author SHA1 Message Date
Vincent Hanquez
9d43c332de fix digest size for nat-typed blake2 2017-07-08 07:58:09 +01:00
Vincent Hanquez
b18ec653b8 rename bitLen -> bitlen. GHC 8.2 is stricted about name of type variables 2017-07-07 19:26:59 +01:00
Vincent Hanquez
0dc0f30b86 Add HashBlockSize & HashDigestSize & HashInternalContextSize type family for all Hash algorithms
supercedes PR #158
2017-07-07 18:28:06 +01:00
Vincent Hanquez
67dd8ed7fc [Hash] change Digest to use a foundation UArray that have configurable pinnable memory setting 2017-04-25 14:23:13 +01:00
Vincent Hanquez
a9fd1f079d [Hash] update part of Crypto.Hash.IO to ScopeTypeVariable 2017-04-25 14:22:20 +01:00
Nicolas DI PRIMA
8b6bd1ed5e check for at least one byte and at most 256 or 512 (blake2s or blake2b) 2017-03-13 18:53:07 +00:00
Nicolas DI PRIMA
c0c33c5254 Use Nat for the Blake2's digest sizes 2017-03-13 00:24:17 +00:00
Nicolas DI PRIMA
cd552ae5f6 move Nat specific to Cryptonite's insternal module 2017-03-13 00:22:53 +00:00
Vincent Hanquez
26237c5c6d remove spurious header modification 2017-02-19 17:17:49 +00:00
Vincent Hanquez
343b7593b5 add Constraint for divisibility 2017-02-14 23:01:18 +00:00
Vincent Hanquez
eb661e653e add Typeable for SHAKE 2017-02-14 23:01:18 +00:00
Olivier Chéron
d8ed5ce9f1 Add SHAKE128 and SHAKE256 as HashAlgorithm instances
Generalizes SHA-3 code for SHAKE support and uses GHC type-level literals
to keep the output length variable.
2017-02-14 23:01:18 +00:00
Vincent Hanquez
7378fe3f45 add some missing blake2 modes 2017-02-14 16:26:44 +00:00
Vincent Hanquez
634768b2fa add Data also to Hash algorithms 2017-02-14 12:02:26 +00:00
Vincent Hanquez
7c33fcedb4 add Typeable to hash algorithm 2017-02-14 10:19:44 +00:00
Vincent Hanquez
93fad940e4 Improve context memory usage of Keccak and SHA3
saves up to 72 bytes per context for SHA3-512
2016-03-26 10:29:33 +00:00
Vincent Hanquez
50631d3150 Add support for blake2s(p) 224 bits 2016-01-09 10:09:35 +00:00
John Galt
26976b1583 [blake2] Added reference implementation
This commit allows the user to select either the portable reference
implementation or the optimized (SSE) implementation.
2015-12-16 07:49:30 -06:00
Maciej Pietrzak
6020bde0e2 Add support_blake2 flag. 2015-11-30 22:17:21 +01:00
Vincent Hanquez
812b5d1aed [blake2] uncapitalize the modules and types as it's not abbreviation. 2015-11-19 14:24:54 +00:00
Vincent Hanquez
fae5f084cf [Blake2] define the algorithm as a multiple algorithm so that the output digest size is explicit in the digest types. 2015-11-19 12:10:14 +00:00
Vincent Hanquez
69f9d225eb [hash] trim hash algorithm with multiple output size.
The output size is now passed by parameter to the finalize function
instead of being stored in the context. that simplify quite a
bit the passing of this parameter
2015-11-19 11:52:21 +00:00
Vincent Hanquez
ad285be68c [Hash] tweak internal C API to have the hashlen 2015-11-19 11:37:38 +00:00
Vincent Hanquez
093f1af8e4 Merge pull request #41 from kinoru/master
Fix typo: Kekkak -> Keccak
2015-11-18 15:38:19 +00:00
John Galt
880dfae098 Added BLAKE2 support 2015-11-12 12:33:20 -05:00
kinoru
558c21491e Fix typo: Kekkak -> Keccak
The SHA-3 winning algorithm's name is Keccak (pronounced "catch-ack"),
not Kekkak.

- <http://keccak.noekeon.org/>
- <http://www.nist.gov/itl/csd/sha-100212.cfm>
- <https://en.wikipedia.org/wiki/SHA-3>
2015-10-27 14:56:42 +00:00
Vincent Hanquez
35bad8c241 [hash] properly display Digest just like cryptohash.
fix #8
2015-06-09 14:35:23 +01:00
Nicolas DI PRIMA
57c814f20b add Ord instance on Digest 2015-05-26 19:10:26 +01:00
Vincent Hanquez
a0009bf713 [hash] remove redundant module 2015-05-22 18:43:35 +01:00
Vincent Hanquez
8eaaa06e1e add optional support for deepseq 2015-05-22 18:35:46 +01:00
Vincent Hanquez
881d167cb5 more fixing up description and comments 2015-05-20 06:22:00 +01:00
Vincent Hanquez
393b159d5f [hash] add haddock documentation 2015-05-19 11:51:18 +01:00
Vincent Hanquez
9794e2132b [hash] replace scrub by reset
reset make more sense as it leave the mutable context in a state where
it can be re-used by further update, whereas scrub doesn't.
2015-05-19 11:50:56 +01:00
Vincent Hanquez
987f9e7bb6 [internal] update to latest memory, and remove builtin support as memory is now available 2015-05-18 18:33:14 +01:00
Vincent Hanquez
761574a65f [internal] remove old cryptohash modules 2015-05-11 09:34:01 +01:00
Vincent Hanquez
81e335cfff [HASH] re-enable SHA512t 2015-05-06 07:53:51 +01:00
Vincent Hanquez
c5189a03c6 [hash] remove unnecessary import 2015-05-02 15:44:09 +01:00
Vincent Hanquez
5d3e825f2e remove / comment stuff 2015-05-01 07:36:28 +01:00
Vincent Hanquez
db7c3bbb4f [hash] massive overhaul of the hash interface
use the typeclass for the lowest IO impure C bindings definitions,
and define the pure interface as generic on top of this.

At the same time define an Hash.IO interface to allow mutable manipulations
of hash contextes when necessary.

Use HashAlgorithm instead of HashFunction in the [PubKey] sections

Tweak the HMAC, PBKDF2 functions to be more efficient and use the new interface
2015-04-30 06:18:07 +01:00
Vincent Hanquez
87e2862eaa remove stale file 2015-04-28 11:39:23 +01:00
Vincent Hanquez
1c8d966d71 [Hash] remove unnecessary modules and not used template 2015-04-28 11:37:42 +01:00
Vincent Hanquez
6722a02a74 move lowlevel implementation of hashes to byteArrays 2015-04-24 13:30:58 +01:00
Vincent Hanquez
abacea200d further fix 2015-04-05 12:32:40 +01:00
Vincent Hanquez
3308ec0d92 cleanup extensions in modules 2015-04-05 07:47:16 +01:00
Vincent Hanquez
95160dee56 update modules to use more efficient byte array memory allocation and representation for contextes 2015-03-08 15:18:28 +08:00
Vincent Hanquez
bbbbdc4b39 use directly compat module instead of Crypto.Hash.Internal 2015-02-15 00:39:34 +00:00
Vincent Hanquez
b5dbc9caae add internalUpdateUnsafe to process data more efficiently at the expense of threads.
internalUpdateUnsafe, just like internalUpdate update the context, but
does it using the unsafe key word for the ffi binding
2015-02-14 23:39:06 +00:00
Vincent Hanquez
09e8670b70 add bang for unlifted bindings 2015-02-08 13:25:04 +00:00
Vincent Hanquez
70e2321d95 update architectures of modules to separate IO and mutable parts from the immutable part 2015-02-08 12:03:00 +00:00
Vincent Hanquez
bc75680084 fix Kekkak 2015-02-08 11:14:20 +00:00