This repository contains my personal implementations and practice exercises of fundamental cryptographic algorithms and protocols in Python. The code is based on concepts from the book Crypto101 and other resources, aimed at deepening my understanding of cryptography for my thesis work in cybersecurity.
N.B.: All implementations are done manually from scratch without relying on external cryptographic libraries, to deepen understanding of the underlying algorithms and mathematics.
| File | Description |
|---|---|
rsa.py |
Implementation of RSA encryption and decryption. |
rsa_signature.py |
RSA digital signature scheme implementation. |
sha256.py |
SHA-256 cryptographic hash function (custom implementation). |
h_mac.py |
HMAC (Hash-based Message Authentication Code) using SHA-256. |
diffie_hellman.py |
DH key exchange with safe prime generation and simulation. |
aes.py |
AES block cipher implementation with block-level encryption and decryption functions. |
dh_aes_sha256.py |
Demonstration of Diffie-Hellman key exchange, custom SHA-256 hashing, and AES encryption/decryption working together. |
ecc.py |
Elliptic Curve Cryptography implementation including point operations, key generation, encryption, and decryption. |
ecdsa.py |
Implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA), including key pair generation, signing, and signature verification using custom elliptic curve parameters. |
elgamal.py |
Implementation of ElGamal public-key encryption scheme including key generation, encryption, and decryption. |
utils.py |
Utility functions. |
This repo serves as my hands-on playground to:
- Implement my cryptographic knowledge practically on python.
- Develop a clear understanding of both the mathematical concepts and the coding.
- Keep track of my learning progress(and enjoy the GitHub green boxes for a dopamine rush🤩)
-
Clone the repository:
git clone https://github.com/ayiman29/crypto101.git cd crypto101 -
Run individual scripts to test implementations. For example:
python sha256.py python h_mac.py
-
Study the source code for detailed comments and explanations.
- Learned the basics of cryptography from the book Crypto101 — an introductory guide to cryptography.
- Asked ChatGPT to provide Python skeletons with step-by-step outlines, without explicit code.
- Solved the coding problems myself, using online resources or ChatGPT for help when stuck.
- Author: Me, duh!
- Inspired by the book Crypto101 — an introductory cryptography book freely available online.
- Field of study: Cybersecurity (Thesis research focus)
Feel free to reach out or open issues if you find bugs or want to suggest improvements!
Unhappy cryptography learning! 🔐🚀