Skip to main content

Pypi PyVersion License Pylint Pytest

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).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kryptools-1.9.4.tar.gz (94.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kryptools-1.9.4-py3-none-any.whl (91.4 kB view details)

Uploaded Python 3

File details

Details for the file kryptools-1.9.4.tar.gz.

File metadata

  • Download URL: kryptools-1.9.4.tar.gz
  • Upload date:
  • Size: 94.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kryptools-1.9.4.tar.gz
Algorithm Hash digest
SHA256 b0bdcf9831275c8f4f94dc516d9cf6ae277398f6c507c564504246a068ff3ebb
MD5 7d69ccf6b3f8b49584d4ac3711bf0485
BLAKE2b-256 2b681f25075bd5025e238ae310392ec04ad1b6225838cf7b3a9995227a704183

See more details on using hashes here.

Provenance

The following attestation bundles were made for kryptools-1.9.4.tar.gz:

Publisher: python-publish.yml on teschlg/kryptools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kryptools-1.9.4-py3-none-any.whl.

File metadata

  • Download URL: kryptools-1.9.4-py3-none-any.whl
  • Upload date:
  • Size: 91.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kryptools-1.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 daef98793a6cd107ef1b1a8ae4c7130081b4a786afd4afaa4bca75d8a3e43e28
MD5 74438446ab9b48609a696d10ab9e0f41
BLAKE2b-256 ad4c7b4fbae940eccf422206409e0bca31be60aa188e987c9b402457f82fb8b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for kryptools-1.9.4-py3-none-any.whl:

Publisher: python-publish.yml on teschlg/kryptools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page