Commit Graph

71 Commits

Author SHA1 Message Date
Olivier Chéron
5f657fda2e Remove powF2m'
We keep only the function providing the base service, negative
exponents can be still computed with invF2m.
2020-06-12 18:54:37 +02:00
Will Song
f64efafbad update sqrtF2m 2020-06-08 10:16:42 -05:00
Will Song
17336857c5 implement square roots in f2m 2020-06-01 20:56:42 -05:00
Olivier Chéron
9e0dbb3231 Modular square root 2019-12-07 08:35:14 +01:00
Olivier Chéron
0a1aa3517c Fix warnings and whitespace 2019-12-03 21:06:17 +01:00
Olivier Chéron
18c6e37ef1 Merge pull request #300 from ocheron/tc-ecdsa
ECDSA with a type class
2019-12-01 08:47:33 +01:00
Brian Wignall
78684bc62b Fix typos 2019-11-30 18:22:26 -05:00
Olivier Chéron
19b7ab375a Time-constant modular inverse 2019-11-11 17:46:16 +01:00
Olivier Chéron
af98a837d1 Add missing INLINABLE pragma 2019-05-16 06:33:35 +02:00
Olivier Chéron
7ecb259aae Fix LE.i2osp 0
Little-endian bytes are stored at the beginning of the buffer.
2019-05-16 06:33:35 +02:00
Olivier Chéron
6893eae70a Make os2ip loop argument strict 2019-05-16 06:33:35 +02:00
Olivier Chéron
6e1b6fdb90 Little-endian integer serialization 2019-05-16 06:33:35 +02: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
Crockett
133c6e1b2d Added some redundant constraints for documentation/consistency. Added an INLINABLE pragma to i2ospOf to hopefully increase specializations. 2019-02-24 17:04:10 -08:00
Crockett
0fb8a73d3b Fixed compiler warnings 2019-02-03 16:06:05 -08:00
Carlos Rodriguez
cc18bf41ee
Corrected value boundaries in description of function. 2018-11-11 17:14:23 +01:00
Carlos Rodriguez
314a9caba7 Merge branch 'master' of https://github.com/haskell-crypto/cryptonite
# Conflicts:
#	cryptonite.cabal
#	tests/KAT_PubKey.hs
2018-11-03 20:23:25 +01:00
Olivier Chéron
9847554392 Fixed comment about expSafe 2018-11-01 09:08:39 +01:00
Carlos Rodriguez
c285d7f527 Added OAEP scheme and created test vectors for Rabin cryptosystem. 2018-10-06 16:53:22 +02:00
Carlos Rodriguez
e7b3abebf8 Implemented Rabin cryptosystem and some of its variations (including Rabin-Williams). 2018-09-06 20:27:32 +02:00
Olivier Chéron
15f63fd849 Enable powModSecInteger with integer-gmp >= 1.0.2.0 2018-04-20 20:40:53 +02:00
Chris Martin
d2da00445d fix spelling of "exponent" 2018-04-05 21:44:40 -04:00
Chris Martin
f77994a729 Various documentation copy editing 2017-11-18 14:27:44 -05:00
Dimitri DeFigueiredo
4aec5fc98e Fix issue #154 2017-04-21 13:51:52 -06:00
Colin Atkinson
345f4cd141 Fix bug in isProbablyPrime for small numbers
Fix bug in isProbablyPrime where too many iterations were specified for numbers less than 100

Add clause to isProbablyPrime to use hardcoded values <= 2903
2017-01-19 00:11:39 -05:00
Colin Atkinson
0cec622ddf Fix generate(Safe)Prime to guarantee prime size
Add check for size in generatePrime

Add size test in generateSafePrime

Require only that top bit is set, instead of top 2

This is the general standard, see e.g. OpenSSL

Add an error for too few bits being supplied to prime generator, and add documentation

Add some documentation and require highest two bits set

Simplify return syntax in generatePrime and generateSafePrime

Switch exponent to bit-shift for small performance boost
2017-01-19 00:10:50 -05:00
Bodigrim
2dec05f48b Restore import of <$> 2016-07-24 14:54:22 +02:00
Bodigrim
b25df69e26 Speed up squaring 3x (now 10% faster than mul) 2016-07-24 11:00:54 +02:00
Bodigrim
66ae77e805 Fix tests and provide documentation for Crypto.Number.F2m 2016-07-24 11:00:54 +02:00
Bodigrim
e80eaa56f3 Tests for Crypto.Number.F2m 2016-07-24 10:58:50 +02:00
Vincent Hanquez
d80a499582 removed bounded names for useless parameter 2016-02-04 07:28:42 +00:00
Vincent Hanquez
2785a50228 Merge pull request #42 from Rufflewind/master
Document the arguments for DH.generateParams
2015-11-18 21:51:53 +00:00
Vincent Hanquez
7928198923 [doc] Add missing documentation call 2015-11-04 15:18:05 +00:00
Phil Ruffwind
fba0565d78 Document the arguments for DH.generateParams
Also fix the formatting in the docs of Serialize.i2ospOf
2015-11-03 20:20:53 +08:00
Vincent Hanquez
daff858fe1 [number] cleanup in serialization 2015-06-01 13:03:21 +01:00
Vincent Hanquez
453e9a6f35 [number] internal serialize, unconditionally zero the buffer. 2015-06-01 13:02:53 +01:00
Vincent Hanquez
6028e95805 [number] cleanup 2015-06-01 11:50:24 +01:00
Vincent Hanquez
d873564c54 [number] split the serialization to support a more bit banging direct approach 2015-06-01 05:59:54 +01:00
Vincent Hanquez
0e048b77c4 [number] correct tweak function to mask things properly 2015-05-23 17:09:07 +01:00
Vincent Hanquez
e14d9cafc9 [number] add debugging in case of error 2015-05-23 16:28:50 +01:00
Vincent Hanquez
bc4a55ff74 [number] further cleanup random generation 2015-05-23 13:44:26 +01:00
Vincent Hanquez
c0e50547ad [number] remove the need for a random generator for testing primality
a DRG is implicitely created when calling the non gmp primality test
2015-05-23 12:55:29 +01:00
Vincent Hanquez
23b5146f0f [number] remove unnecessary random number generator 2015-05-23 12:02:05 +01:00
Vincent Hanquez
2153e5690f [number] generate number with bounds more effectively 2015-05-23 11:59:10 +01:00
Vincent Hanquez
05e0e1a587 [number] add helpers to get bits size ond bytes size
the later is already available as 'lengthBytes' in Serialize module
2015-05-23 09:16:36 +01:00
Vincent Hanquez
cddac096cd [number] rename generate into generateParams 2015-05-23 09:15:42 +01:00
Vincent Hanquez
27dacbfb21 add gmpSizeInBits 2015-05-23 09:15:15 +01:00
Vincent Hanquez
efedb38570 [number] add a new routine to generate random number 2015-05-22 21:36:13 +01:00
Vincent Hanquez
16839d3a43 [number] remove the ByteString from generation of high bits 2015-05-21 14:48:26 +01:00
Vincent Hanquez
881d167cb5 more fixing up description and comments 2015-05-20 06:22:00 +01:00