aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp')
-rw-r--r--src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp b/src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp
deleted file mode 100644
index 284fc2b204..0000000000
--- a/src/libs/3rdparty/botan/src/lib/math/numbertheory/jacobi.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* Jacobi Function
-* (C) 1999-2007 Jack Lloyd
-*
-* Botan is released under the Simplified BSD License (see license.txt)
-*/
-
-#include <botan/numthry.h>
-
-namespace Botan {
-
-/*
-* Calculate the Jacobi symbol
-*/
-int32_t jacobi(const BigInt& a, const BigInt& n)
- {
- if(n.is_even() || n < 2)
- throw Invalid_Argument("jacobi: second argument must be odd and > 1");
-
- BigInt x = a % n;
- BigInt y = n;
- int32_t J = 1;
-
- while(y > 1)
- {
- x %= y;
- if(x > y / 2)
- {
- x = y - x;
- if(y % 4 == 3)
- J = -J;
- }
- if(x.is_zero())
- return 0;
-
- size_t shifts = low_zero_bits(x);
- x >>= shifts;
- if(shifts % 2)
- {
- word y_mod_8 = y % 8;
- if(y_mod_8 == 3 || y_mod_8 == 5)
- J = -J;
- }
-
- if(x % 4 == 3 && y % 4 == 3)
- J = -J;
- std::swap(x, y);
- }
- return J;
- }
-
-}