4 Commits
Author SHA1 Message Date
Piotr Dyraga 12b3dadef7 Make sure public key bit length is an even number
For an odd n-bit number, we can't find two n-1-bit numbers which
multiplied gives an n-bit number. That's why public key length n must be
an even number.

I have also renamed AreSafePrimes to IsSafePrime since only the first
function argument is considered to be a safe prime according to a safe
prime definition.
2018-08-08 11:11:05 +02:00
Piotr Dyraga ca756b481b Removed deprecated GenerateSafePrimes function
The new function should be now called directly.
2018-07-27 17:42:05 +02:00
Piotr Dyraga ee7e96eaf6 Fixed bit lenght assertions for safe prime generator tests 2018-07-27 16:45:29 +02:00
Piotr Dyraga e0b836a4bc Generate safe prime concurrently
How fast we generate a prime number is mostly a matter of luck. It
varies from miliseconds to seconds and depends how lucky we are with
drawing bytes.

With today's multicore processors, we can execute the process on
multiple cores concurrently, accept the first valid result and cancel
the rest of work. This way, with the same algorithm, we get the result
faster.
2018-07-26 08:53:23 +02:00