This project provides clean and minimal implementations of key lattice-based cryptographic algorithms, including:
- 2D Basis Reduction
- LLL Algorithm
- NTRU Public-Key Cryptosystem
It includes well-documented Jupyter notebooks with visualizations, usage examples, correctness tests, and exercises adapted from cryptography literature.
This project relies on external Python libraries listed in the requirements.txt
file.
To install them, use the following command:
pip install -r requirements.txt
🛠️ Core Implementations: See lattice_methods
This directory contains the core Python implementations for:
reduce_2d_basis
— basic 2D lattice reductionlll_reduce
— LLL lattice basis reduction algorithmntru_*
— NTRU cryptosystem (keygen, encryption, decryption)- utility functions for validation and formatting and etc
📘 Usage Examples: See notebooks/usage_examples.ipynb
for practical demonstrations of lattice reduction functions (reduce_2d_basis
, lll_reduce
, etc.).
✅ Test Cases: See notebooks/tests.ipynb
for automated tests validating correctness of the algorithms.
📝 Exercises from Literature: See notebooks/Exercises.ipynb
contains solved exercises from Introduction to Cryptography with Coding Theory (Trappe & Washington).
-
Introduction to Cryptography with Coding Theory
Trappe, W., & Washington, L. C. — 2nd Edition, Pearson, 2006. -
NTRU: A Ring-Based Public Key Cryptosystem
Hoffstein, J., Pipher, J., & Silverman, J. H., 1998.
https://ntru.org -
Lenstra–Lenstra–Lovász lattice basis reduction algorithm
Wikipedia Article.
https://en.wikipedia.org/wiki/Lenstra%E2%80%93Lenstra%E2%80%93Lov%C3%A1sz_lattice_basis_reduction_algorithm -
Public Key Cryptography – NTRU
Tengely, Sz. — Example values used in this notebook are based on:
https://shrek.unideb.hu/~tengely/crypto/section-8.html) -
Applied Cryptanalysis: Breaking Ciphers in the Real World
Mark Stamp, Richard M. Low — Wiley-IEEE Press, 2007.
Chapter 6.7