This repository contains materials for the Cryptography and Computer Security course at the Faculty of Computer Science and Informatics, University of Ljubljana.
Currently, the following Jupyter notebooks for Python/Sage are available:
VigenereCipher.ipynb
: Vigenère cipher in PythonLFSR.ipynb
: LFSR in SageCoppersmith.ipynb
: Coppersmith’s attack on a small exponentCommonModulus.ipynb
: Common modulus attackRSA-ECB.ipynb
: RSA in ECB modeJacobi.ipynb
: Computing Jacobi symbolsFactorization.ipynb
: Integer factorizationBabyStepGiantStep.ipynb
: Shanks’s baby-step/giant-step algorithmPohligHellman.ipynb
: The Pohlig-Hellman algorithmIndexCalculus.ipynb
: The Index calculus algorithmReblockingProblem.ipynb
: The reblocking problem for RSAEllipticCurves.ipynb
: Elliptic curvesGroupSignature.ipynb
: The ACJT2000 group signature schemealgorithms
To use the algorithms in Python, make sure that the root of the repository is visible to Python. Then you may import them with
import algorithms
or
from algorithms import *
Currently, the following functions are available:
gcd
(from euclidean.py
)inverse
(from euclidean.py
)eea
(from euclidean.py
)crt
(from modular.py
)jacobi
(from modular.py
)solovayStrassen
(from primality.py
)millerRabin
(from primality.py
)pollardP1
(from factorization.py
)pollardRho
(from factorization.py
)totalFactorization
(from factorization.py
)factorizeByBase
(from factorization.py
)babyStepGiantStep
(from discreteLogarithm.py
)pohligHellman
(from discreteLogarithm.py
)logarithmTable
(from discreteLogarithm.py
)indexCalculus
(from discreteLogarithm.py
)points
(from ellipticCurves.py
)pointSum
(from ellipticCurves.py
)pointMultiply
(from ellipticCurves.py
)See sources for the documentation.
Note that logarithmTable
requires Sage and will therefore not work with plain Python. indexCalculus
calls logarithmTable
if a table of logarithms is not specified. If it is given, the function can be used with plain Python.