aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory/make_prm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 16:19:56 +0000
committerlloyd <[email protected]>2010-10-12 16:19:56 +0000
commit4a6fd8c70d40f88c8b51127bfa055b66b18e0f7a (patch)
treed8c5697f8de1fff74c5b813fd83c08d310fa8ac0 /src/math/numbertheory/make_prm.cpp
parentc46a5e8d3dd8f07a92fc90027e6f7f70b989ea47 (diff)
Use size_t in all of math, remove to_u32bit
Diffstat (limited to 'src/math/numbertheory/make_prm.cpp')
-rw-r--r--src/math/numbertheory/make_prm.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/math/numbertheory/make_prm.cpp b/src/math/numbertheory/make_prm.cpp
index 59a5c2635..4fb3f908c 100644
--- a/src/math/numbertheory/make_prm.cpp
+++ b/src/math/numbertheory/make_prm.cpp
@@ -15,8 +15,8 @@ namespace Botan {
* Generate a random prime
*/
BigInt random_prime(RandomNumberGenerator& rng,
- u32bit bits, const BigInt& coprime,
- u32bit equiv, u32bit modulo)
+ size_t bits, const BigInt& coprime,
+ size_t equiv, size_t modulo)
{
if(bits <= 1)
throw Invalid_Argument("random_prime: Can't make a prime of " +
@@ -47,13 +47,13 @@ BigInt random_prime(RandomNumberGenerator& rng,
if(p % modulo != equiv)
p += (modulo - p % modulo) + equiv;
- const u32bit sieve_size = std::min(bits / 2, PRIME_TABLE_SIZE);
- SecureVector<u32bit> sieve(sieve_size);
+ const size_t sieve_size = std::min(bits / 2, PRIME_TABLE_SIZE);
+ SecureVector<size_t> sieve(sieve_size);
- for(u32bit j = 0; j != sieve.size(); ++j)
+ for(size_t j = 0; j != sieve.size(); ++j)
sieve[j] = p % PRIMES[j];
- u32bit counter = 0;
+ size_t counter = 0;
while(true)
{
if(counter == 4096 || p.bits() > bits)
@@ -66,7 +66,7 @@ BigInt random_prime(RandomNumberGenerator& rng,
if(p.bits() > bits)
break;
- for(u32bit j = 0; j != sieve.size(); ++j)
+ for(size_t j = 0; j != sieve.size(); ++j)
{
sieve[j] = (sieve[j] + modulo) % PRIMES[j];
if(sieve[j] == 0)
@@ -84,7 +84,7 @@ BigInt random_prime(RandomNumberGenerator& rng,
/*
* Generate a random safe prime
*/
-BigInt random_safe_prime(RandomNumberGenerator& rng, u32bit bits)
+BigInt random_safe_prime(RandomNumberGenerator& rng, size_t bits)
{
if(bits <= 64)
throw Invalid_Argument("random_safe_prime: Can't make a prime of " +