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
Vincent Hanquez
92343f856a
add comments and description
2015-05-20 06:07:31 +01:00
Vincent Hanquez
d035e3a3bc
[number] properly handle gmp
2015-05-11 11:39:09 +01:00
Vincent Hanquez
b3ebf3f3b8
[number] fix import
2015-05-11 10:07:15 +01:00
Vincent Hanquez
9567fa2526
[number] almost rewrite all serialization to be faster and less depends on random versions
2015-05-11 09:28:48 +01:00
Vincent Hanquez
228f1ab938
[number] further push the compat cleanup
2015-05-11 07:32:13 +01:00
Vincent Hanquez
8c07305deb
[number] fix compat with a missing do.
2015-05-11 07:31:52 +01:00
Vincent Hanquez
ee3e5e69bf
[number] move some number primitive to use compat without CPP
2015-05-11 07:11:38 +01:00
Vincent Hanquez
03fe63b05a
[number] further remove gcde_binary
2015-05-11 07:10:52 +01:00
Vincent Hanquez
4bcf193a12
[number] further remove gcde_binary
2015-05-11 07:10:38 +01:00
Vincent Hanquez
47afc1720d
[number] remove gcde_binary
2015-05-11 07:10:15 +01:00
Vincent Hanquez
5c0daae88c
[number] add simple combinator
2015-05-11 07:09:44 +01:00
Vincent Hanquez
427541064d
[number] add further gmp optional compat
2015-05-11 07:09:30 +01:00
Vincent Hanquez
ed8fbe8f69
[Number] add module to cleanup CPP around
2015-05-10 15:27:52 +01:00
Vincent Hanquez
28a4fa1503
remove unnecessary CPP
2015-05-03 14:31:07 +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
b487aef898
cleanup module imports
2015-04-20 07:36:51 +01:00
Vincent Hanquez
6eae9b0557
fix warnings
2015-04-05 12:19:26 +01:00
Vincent Hanquez
827407fbed
use BinaryPolynomial when it is one in F2m
2015-04-03 08:17:47 +01:00
Vincent Hanquez
c3d9570881
re-add the primitives to generate primes and test for prime.
2015-03-29 10:55:46 +01:00
Vincent Hanquez
d9b16a529e
re-enable number generation
2015-03-29 10:43:45 +01:00
Vincent Hanquez
90d02607ba
merge crypto-numbers minus all the random parts
2015-02-09 05:47:11 +00:00