Skip to content

About

Ciphers, hash functions, and public-key cryptography in Python, with the attacks that break their weak uses: brute force, frequency analysis, key reuse, and malleability. Executed and verified in CI.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

92 Commits

Folders and files

Repository files navigation

🔑🔒 Cryptography in Python

Notebooks Python cryptography Google Colab

Hands-on notebooks on ciphers, hashes, and public-key cryptography, and the attacks that break their weak uses, each executed and verified automatically.


📓 Notebooks

All notebooks are in the Algorithms/ folder. Each one opens in Google Colab from the badge at its top, or you can browse them all in Colab. Runtime > Run all works with no setup.

Area What is covered
Number theory GCD, modular inverse, primality tests
Classical ciphers Substitution, polyalphabetic, one-time pad
Block ciphers Feistel networks, DES, AES, modes of operation
Hash functions SHA-2, birthday attack, password hashing
Public-key Factoring, discrete logarithm, elliptic curves
Attacks Brute force, frequency analysis, key reuse

✅ Quality

Check How
Every notebook runs CI executes all notebooks on each push and weekly
Results are verified Each notebook asserts round trips and attack outcomes
Standard compliance Known-answer tests (DES, secp256k1)
Secure randomness Tests forbid random for key material

To add a notebook, save it in Algorithms/: the CI finds and runs it automatically, with no list to update.
To run locally: pip install -r requirements.txt, then pytest --nbmake Algorithms/.

Warning

The implementations are for learning. To protect real data, use a vetted library such as cryptography with authenticated encryption.


📚 References

Reference Topic
NIST SP 800-38A Block cipher modes (ECB, CBC)
NIST SP 800-38D AES-GCM
OWASP Password Storage PBKDF2 iterations
Handbook of Applied Cryptography ElGamal, Rabin, primality

⚖️ Intellectual Property (IP) Notice

All source code, documentation, and research methodologies contained in this repository are the exclusive Intellectual Property of the author. All rights reserved. Use of this content for academic or professional purposes must include proper citation and attribution (see CITATION.cff).

Copyright © 2026 João Rafael.

About

Ciphers, hash functions, and public-key cryptography in Python, with the attacks that break their weak uses: brute force, frequency analysis, key reuse, and malleability. Executed and verified in CI.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages