kryptools 1.3.3__tar.gz → 1.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kryptools-1.3.3 → kryptools-1.3.4}/PKG-INFO +1 -1
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/__init__.py +1 -1
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/intfuncs.py +10 -11
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools.egg-info/PKG-INFO +1 -1
- {kryptools-1.3.3 → kryptools-1.3.4}/pyproject.toml +1 -1
- {kryptools-1.3.3 → kryptools-1.3.4}/LICENSE +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/README.md +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/GF2.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/Zmod.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/aes.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/blockcipher.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/code.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/conway_polynomials.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/des.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/dlp.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/dlp_bsgs.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/dlp_ic.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/dlp_qs.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/dlp_rho.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/ec.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_dix.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_ecm.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_fmt.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_pm1.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_qs.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/factor_rho.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/keccak.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/la.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/lat.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/nt.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/poly.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/primes.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools/sha1.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools.egg-info/SOURCES.txt +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools.egg-info/dependency_links.txt +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/kryptools.egg-info/top_level.txt +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/setup.cfg +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_GF2.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_Zmod.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_aes.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_code.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_des.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_dlog.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_ec.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_factor.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_factor_fmt.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_factor_pm1.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_factor_qs.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_intfuncs.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_keccak.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_la.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_lat.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_nt.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_poly.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_primes.py +0 -0
- {kryptools-1.3.3 → kryptools-1.3.4}/tests/test_sha1.py +0 -0
|
@@ -5,7 +5,7 @@ Implemenation of same basic algorithms used in cryptography.
|
|
|
5
5
|
__author__ = "Gerald Teschl"
|
|
6
6
|
__copyright__ = "Copyright 2024-2025, Gerald Teschl"
|
|
7
7
|
__license__ = "MIT License"
|
|
8
|
-
__version__ = "1.3.
|
|
8
|
+
__version__ = "1.3.4"
|
|
9
9
|
__email__ = "Gerald.Teschl@univie.ac.at"
|
|
10
10
|
|
|
11
11
|
from .nt import egcd, cf, convergents, legendre_symbol, jacobi_symbol, sqrt_mod, euler_phi, carmichael_lambda, moebius_mu, is_carmichael_number, order, crt
|
|
@@ -18,19 +18,18 @@ def iroot(k: int, n: int) -> int:
|
|
|
18
18
|
raise ValueError(f"n={n} must be a nonegative integer.")
|
|
19
19
|
if n <= 1 or k == 1:
|
|
20
20
|
return n
|
|
21
|
-
if k == 2:
|
|
21
|
+
if k == 2: # use the faster internal function
|
|
22
22
|
return isqrt(n)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
l = n.bit_length()
|
|
24
|
+
if k >= l:
|
|
25
|
+
return 1
|
|
26
|
+
r = 1 << ((l-1)//k + 1) # use 2^ceil(l/k) as starting value
|
|
27
|
+
k1 = k - 1
|
|
28
|
+
while True:
|
|
29
|
+
rr = (k1 * r + n // r ** k1) // k # Newton iteration
|
|
30
|
+
if rr >= r:
|
|
31
|
+
return r
|
|
31
32
|
r = rr
|
|
32
|
-
rr = (k1 * rr + n // rr ** k1) // k # Newton iteration
|
|
33
|
-
return r
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
def ilog(b: int, n: int) -> int:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|