kryptools
Gerald Teschl Gerald.Teschl@univie.ac.at
This package was written for my course on cryptography. Consequently its intention is mainly educational, that is, to show how basic algorithms are implemented. In particular, you are welcome to read (and modify) the source. Any suggestions on how to make the code more readable or make it better are welcome. However, my main goal is to keep it simple and readability will be preferred over small speed improvements.
Warning These tools are intended for experimenting with cryptographic algorithms. They are not intended for use in real applications.
It does not require any external libraries.
The tools contained are:
-
number theory: sqrt modulo primes, Jacobi/Legendre symbol, Chinese Remainder Theorem, continued fractions, etc.
-
primes: Sieve of Erathostenes, primality tests, generation of random safe/strong primes
-
solvers for discrete logarithms (naive, Pollard rho, Shanks baby step/giant step, index calculus, quadratic sieve)
-
integer factorization (Fermat, Pollard p-1, Pollard rho, Lenstra's ECM, Dixon, basic quadratic sieve)
-
elliptic curves (Weierstrass form), group operations, order, discrete logarithms
-
linear algebra: Hermite normal form, Smith normal form, Gram-Schmidt
-
lattices: Hadamard ratio, Babai rounding/nearest plane algorithm, lattice reduction (Hermite, Lenstra-Lenstra-Lovasz, BKZ), SIS, ISIS, LWE
-
linear codes: Hamming distance, left standard form, parity check matrix
-
Matrix: a class for Matrices (inverse, det, reduced echelon form, kernel, solving linear systems, etc.)
-
BinaryMatrix: a class for Matrices with binary entries (for much faster row operations)
-
Lattice: a class for lattices (SVP, CVP, LLL, BKZ, HKZ)
-
Poly: a class for polynomials (division, modulo, factoring and irreducibility test over finite fields, Lagrange interpolation)
-
Zmod: a class for the ring of integers modulo an integer
-
GF2: a class for Galois fields GF(2^n)
-
BinaryCode: a class for encoding and decoding binary linear codes
-
GoppaCode: a class for encoding and decoding binary Goppa codes
-
CyclicCode: a class for encoding and decoding cyclic codes
-
ReedSolomonCode: a class for encoding and decoding Reed-Solomon codes
-
BCHCode: a class for encoding and decoding primitive narrow sense BCH codes
-
BlockCipher: a class implementing the usual modes of operation (ECB, CBC, GCM, etc.)
-
AESCipher: individual AES operations
-
DESCipher: individual DES operations
-
SHA1: custom initial state, padding function
-
Keccak: individual sponge operations, SHA3, SHAKE
Documentation can be found in the jupyter notebook (mostly done, but might not contain everything: use the force, read the source).
Metadata
Release files for kryptools 1.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kryptools-1.9.6.tar.gz | 95.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kryptools-1.9.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 187.3 kB
Release files / kryptools-1.9.6.tar.gz
| Download URL | kryptools-1.9.6.tar.gz |
|---|---|
| Size | 95.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c8d77acd28207aa1f01155e8a8f57727850f1d175c09f69b2a33201cf3009d3
|
|
BLAKE2b-256 checksum How to use checksums |
d4c06afadd04ad9ef24b1b50c36de0375794111202fa31bd05c16ffa3827c4ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / kryptools-1.9.6-py3-none-any.whl
| Download URL | kryptools-1.9.6-py3-none-any.whl |
|---|---|
| Size | 92.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51462bb6e7bc8a30064cdd93a84151b8edb97b5a9e405471cdcc8bc3f201eb00
|
|
BLAKE2b-256 checksum How to use checksums |
96685ec2b31fbfac1bfb092fec8d0d6666d546288b65dc81350e184eed4552fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency log