aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-07-07 02:06:03 +0000
committerlloyd <[email protected]>2008-07-07 02:06:03 +0000
commit45558407b8d28c8f6099239f16c87034917b4a61 (patch)
treefaa0850cf59b490b859c62369d8cd11fdd3bf14d /include
parent879343baccf98c23d3b3f9a3faba64b65df31eac (diff)
Add an implementation of the Shanks-Tonelli algorithm, which is used to
find square roots modulo a prime. Contributed by FlexSecure GmbH
Diffstat (limited to 'include')
-rw-r--r--include/numthry.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/numthry.h b/include/numthry.h
index c6313bdb7..371621c2d 100644
--- a/include/numthry.h
+++ b/include/numthry.h
@@ -36,6 +36,12 @@ s32bit BOTAN_DLL jacobi(const BigInt&, const BigInt&);
BigInt BOTAN_DLL power_mod(const BigInt&, const BigInt&, const BigInt&);
/*************************************************
+* Compute the square root of x modulo a prime *
+* using the Shanks-Tonnelli algorithm *
+*************************************************/
+BigInt ressol(const BigInt& x, const BigInt& p);
+
+/*************************************************
* Utility Functions *
*************************************************/
u32bit BOTAN_DLL low_zero_bits(const BigInt&);
@@ -62,8 +68,8 @@ BigInt BOTAN_DLL random_integer(RandomNumberGenerator&,
const BigInt&, const BigInt&);
BigInt BOTAN_DLL random_prime(RandomNumberGenerator&,
- u32bit n, const BigInt& = 1,
- u32bit = 1, u32bit = 2);
+ u32bit bits, const BigInt& coprime = 1,
+ u32bit equiv = 1, u32bit equiv_mod = 2);
BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator&,
u32bit);