summaryrefslogtreecommitdiff
path: root/math/discreteLogarithm.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 01:24:14 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 01:24:14 +0100
commit98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (patch)
tree5113d5cc24d1ad5f93810b6442ce584a36950dc8 /math/discreteLogarithm.cpp
parentad3856a6b766087df0036de0b556f4700a6498c9 (diff)
parent8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff)
mzuenni tests
Diffstat (limited to 'math/discreteLogarithm.cpp')
-rw-r--r--math/discreteLogarithm.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/math/discreteLogarithm.cpp b/math/discreteLogarithm.cpp
deleted file mode 100644
index d9227b9..0000000
--- a/math/discreteLogarithm.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-ll dlog(ll a, ll b, ll m) {
- ll bound = sqrtl(m) + 1; //memory usage bound
- map<ll, ll> vals;
- for (ll i = 0, e = 1; i < bound; i++, e = (e * a) % m) {
- vals[e] = i;
- }
- ll fact = powMod(a, m - bound - 1, m);
-
- for (ll i = 0; i < m; i += bound, b = (b * fact) % m) {
- if (vals.count(b)) {
- return i + vals[b];
- }}
- return -1;
-}