Commit Graph

88 Commits

Author SHA1 Message Date
Vincent Hanquez
20b194fc97
fix byteswap32 to work on Word32# instead of Word# (with compat for ghc < 9.2) 2022-03-13 20:49:11 +08:00
Olivier Chéron
981b97a132 Protect against negative argument 2020-02-24 06:54:23 +01:00
Olivier Chéron
2e0a60f7f7 Use Semigroup API 2020-02-24 06:54:23 +01:00
Olivier Chéron
b01f610aa2 Add and use Builder module
Avoids intermediate allocations and conversions when concatenating
byte arrays of different types.
2020-02-24 06:54:23 +01:00
Olivier Chéron
3c41966b9a Add module Crypto.Number.Nat
This new module exposes type constraints required by some hash
algorithms and provides functions to check whether the constraints are
satisfied with runtime values.

Resolves #256.
2019-02-28 07:07:48 +01:00
Olivier Chéron
eccbc11824 Remove Crypto.Internal.Proxy
Data.Proxy can be used instead now that GHC >= 8.0.  In Data.Proxy the
Proxy type is poly-kinded.
2019-02-28 07:07:48 +01:00
Crockett
0fb8a73d3b Fixed compiler warnings 2019-02-03 16:06:05 -08:00
Olivier Chéron
455504b8e2 Implement SHAKE output not divisible by 8 bits 2018-10-23 06:59:07 +02:00
Chris Martin
f77994a729 Various documentation copy editing 2017-11-18 14:27:44 -05:00
Olivier Chéron
bb2363eea7 Add CAST5 aka CAST-128
Haskell translation of RFC 2144.
2017-09-17 11:28:56 +02:00
Vincent Hanquez
d13ce585ab add further unrolling of Div8 to match Mod8 2017-07-07 21:44:29 +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
Olivier Chéron
adc192ac17 Add constAllZero 2017-07-05 22:24:22 +02:00
Sergei Trofimovich
d911a34258 fix build failure with -f-support_deepseq disabled
How to reproduce:

```
$ cabal configure -f-support_deepseq
Resolving dependencies...
Configuring cryptonite-0.23...

$ cabal build
Building cryptonite-0.23...
Preprocessing library cryptonite-0.23...
[114 of 120] Compiling Crypto.PubKey.RSA.Types ( Crypto/PubKey/RSA/Types.hs, dist/build/Crypto/PubKey/RSA/Types

Crypto/PubKey/RSA/Types.hs:48:30: error:
    • No instance for (NFData Integer) arising from a use of ‘rnf’
    • In the first argument of ‘seq’, namely ‘rnf n’
      In the expression: rnf n `seq` rnf e `seq` sz `seq` ()
      In an equation for ‘rnf’:
          rnf (PublicKey sz n e) = rnf n `seq` rnf e `seq` sz `seq` ()
```

The fix is to inctoruce 'NFData Integer' instance to `Crypto/Internal/DeepSeq`.

Closes: https://github.com/haskell-crypto/cryptonite/issues/171
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-06-19 10:37:23 +01:00
Nicolas DI PRIMA
f0286281fb add new constraints 2017-03-13 18:52:24 +00:00
Nicolas DI PRIMA
cd552ae5f6 move Nat specific to Cryptonite's insternal module 2017-03-13 00:22:53 +00:00
Vincent Hanquez
10d72c8779 remove unneeded extensions 2017-02-19 17:17:35 +00:00
Vincent Hanquez
c342d28436 Compatibility with older version 2017-02-14 23:01:18 +00:00
Vincent Hanquez
343b7593b5 add Constraint for divisibility 2017-02-14 23:01:18 +00:00
Vincent Hanquez
955f010bff add internal proxy type to create witnesses 2016-12-02 15:00:05 +00:00
Vincent Hanquez
71fe77da68 [endianess] fix some issues on non supported arches 2015-08-28 17:10:27 +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
92343f856a add comments and description 2015-05-20 06:07:31 +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
c5f9ab2d35 [internal] update memory to latest 2015-05-14 10:04:16 +01:00
Vincent Hanquez
9ae9e38ce2 move to memory stuff 2015-05-09 14:23:32 +01:00
Vincent Hanquez
ac16029f07 [internal] update convert4To32 to prevent an issue on ghc 7.0 and 7.4 2015-05-07 13:54:05 +01:00
Vincent Hanquez
d18900c2e0 [internal] random little changes to keep faster toHex from cryptohash as compiled code for later use 2015-05-06 11:39:46 +01:00
Vincent Hanquez
cd0b2bfe64 [internal] fix build by making primitive binding stricter as required by older ghc 2015-05-02 08:10:07 +01:00
Vincent Hanquez
cc26ce8ce4 fix hexadecimal string generation to be hopefully (much) safer. 2015-05-02 05:40:14 +01:00
Vincent Hanquez
12ddffe4df [Internal] add a function to convert bytearray and apply a hexadecimal transformation 2015-04-30 06:15:06 +01:00
Vincent Hanquez
a3b444e36f [Internal] Add buffer function to xor with a specific value 2015-04-30 06:13:14 +01:00
Vincent Hanquez
84c05617a3 [internal] add a way to convert bytearray to hexadecimal bytearray 2015-04-30 06:08:21 +01:00
Vincent Hanquez
9dd17fc0c4 use byte array in more places 2015-04-24 17:22:13 +01:00
Vincent Hanquez
ec4e0c4ed9 remove all the byteArray prefix from byteArray function.
instead expect module import to be qualified for functions.
2015-04-24 06:54:33 +01:00
Vincent Hanquez
c06edc9591 add a byteArrayConvert which copy and returns potentially a different output type 2015-04-22 06:25:33 +01:00
Vincent Hanquez
61ee498643 remove further deprecated modules and such 2015-04-20 10:56:39 +01:00
Vincent Hanquez
b487aef898 cleanup module imports 2015-04-20 07:36:51 +01:00
Vincent Hanquez
f86b493e32 remove warnings 2015-04-20 06:02:12 +01:00
Vincent Hanquez
d7c8835068 Merge branch 'ed25519' 2015-04-19 09:25:00 +01:00
Vincent Hanquez
6e79d33e9f [Internal] Improve Bytes
define Show and Eq instances, and add bytesIndex
2015-04-19 09:23:34 +01:00
Vincent Hanquez
3713c585fe [Internal] add a utility to dump byte array in hexadecimal 2015-04-19 09:22:41 +01:00
Vincent Hanquez
be42fec6e5 [Internal] properly define ByteArrayCopy functions to only requires ByteArrayAccess from the source 2015-04-19 09:21:48 +01:00
Vincent Hanquez
da52607d41 [internal] make some binding stricter 2015-04-19 06:16:31 +01:00
Vincent Hanquez
d4213ca731 [Internal] Expose first and second over the whole codebase 2015-04-18 06:53:23 +01:00
Vincent Hanquez
38b7f6ad73 [Internal] Add a function to create a initialized to 0 bytearray 2015-04-18 06:52:57 +01:00
Vincent Hanquez
09365a745f [Internal] add a function to set buffer's bytes (i.e. memset) 2015-04-18 06:52:27 +01:00
Vincent Hanquez
cd216f5ee9 [internal] add some new function to copy and alloc + ret 2015-04-15 11:24:23 +01:00
Vincent Hanquez
4247520e91 [Internal] add a way to index bytestring 2015-04-11 16:02:31 +01:00