November 4, 2026
Hands-On Cryptography with Python: 18 Practical Implementations from Classical Encryption to…
An Academic Practical Portfolio | Integrated M.Sc. in Cyber Security & Forensics

By Opurba Sarkar
5 min read
Introduction
Cryptography is one of the fundamental pillars of cybersecurity. It helps protect information through encryption, decryption, hashing, authentication, and digital signatures.
As part of my Semester VII academic coursework in Advanced Cryptography, I completed 18 practical implementations using Python. These practicals cover a range of cryptographic concepts, starting from classical encryption techniques and progressing to modern cryptographic systems, Public Key Infrastructure (PKI), secure communication, and post-quantum cryptography.
The purpose of this practical portfolio is to understand how cryptographic algorithms work through hands-on Python implementations and to explore their applications in cybersecurity.
This article provides an overview of all 18 practicals. The corresponding source code and practical output screenshots are available in my GitHub repository.
Academic Information
- Student: Opurba Sarkar
- Programme: Integrated M.Sc. in Cyber Security & Forensics
- Semester: VII
- Department: Department of Biochemistry and Forensic Science
- Institution: Gujarat University, Ahmedabad, Gujarat, India
- Course: DSC-C-ICSF-472P — Advanced Cryptography
- Implementation Language: Python
Practical Implementations
1. Classical Cryptographic Techniques
This practical explores classical encryption methods, including the Caesar Cipher, Monoalphabetic Substitution Cipher, and Rail Fence Cipher.
The objective is to understand the basic principles of substitution and transposition techniques and how plaintext can be transformed into ciphertext.
2. Data Encryption Standard (DES)
This practical focuses on the DES symmetric-key encryption algorithm. It demonstrates the basic process of encrypting and decrypting data using a shared secret key.
DES is an important historical algorithm for understanding block cipher design, although it is no longer considered secure for modern applications.
3. AES Encryption Modes
This practical explores the Advanced Encryption Standard (AES) and its different operating modes:
- ECB
- CBC
- CFB
- OFB
- CTR
The implementation helps demonstrate how different modes process data during encryption and decryption.
4. RSA Encryption Using OAEP
This practical demonstrates RSA public-key encryption with Optimal Asymmetric Encryption Padding (OAEP).
It introduces public and private key generation and shows how data can be encrypted using a public key and decrypted using the corresponding private key.
5. RC4 Stream Cipher
This practical demonstrates the RC4 stream cipher and its encryption and decryption process.
RC4 is included for educational understanding of stream ciphers. It is considered insecure and should not be used in modern security systems.
6. ElGamal Cryptosystem
This practical explores the ElGamal public-key cryptosystem.
It demonstrates the concepts of key generation, encryption, and decryption using mathematical operations based on modular arithmetic.
7. ECC-Based Secure Communication
This practical demonstrates Elliptic Curve Cryptography (ECC) for secure communication.
It explores the establishment of a shared secret and the use of AES-GCM for authenticated encryption.
8. Diffie-Hellman and Elliptic Curve Diffie-Hellman
This practical covers two key exchange approaches:
- Diffie-Hellman (DH)
- Elliptic Curve Diffie-Hellman (ECDH)
The objective is to understand how two parties can establish a shared secret over an insecure communication channel.
9. RSA and ECDSA Digital Signatures
This practical explores digital signature mechanisms using RSA and Elliptic Curve Digital Signature Algorithm (ECDSA).
It demonstrates how digital signatures can help verify message authenticity and integrity.
10. Cryptographic Hash Functions and HMAC
This practical explores several cryptographic hash and message authentication techniques:
- MD5
- SHA-256
- SHA-512
- HMAC
It introduces the role of hashing in data integrity and the use of HMAC for message authentication. MD5 is included for educational comparison and is not recommended for security-sensitive applications.
11. Simplified Schnorr Zero-Knowledge Proof
This practical introduces the basic concept of a zero-knowledge proof through a simplified Schnorr protocol demonstration.
It explores how a prover can demonstrate knowledge of a secret without directly revealing that secret.
12. Blockchain and Cryptocurrency Simulation
This practical demonstrates a simplified blockchain and cryptocurrency model.
It explores concepts such as blocks, hashing, transaction representation, and the linking of blocks to form a chain.
13. Timing Side-Channel Demonstration and Caesar Cipher Brute Force
This practical introduces two security concepts:
- Timing side-channel demonstration
- Caesar cipher brute-force analysis
The timing demonstration illustrates how execution-time differences may reveal information. The Caesar cipher exercise demonstrates how a simple substitution cipher can be attacked by testing possible keys.
14. SSL/TLS Client-Server Communication
This practical explores client-server communication using Python's SSL/TLS capabilities.
It introduces the role of TLS in protecting data exchanged between communicating systems.
Security note: The demonstration code disables certificate verification. This is suitable only for a controlled educational demonstration and must not be used in real-world applications. Proper certificate verification is essential for secure TLS communication.
15. Public Key Infrastructure and Digital Certificates
This practical explores Public Key Infrastructure (PKI) and digital certificates.
It introduces the role of certificates, Certificate Authorities (CAs), and public-key-based trust mechanisms in secure communication.
16. Secure API Using HMAC-SHA256
This practical demonstrates message authentication for API communication using HMAC-SHA256.
It explores how message authentication can help detect unauthorized modification or tampering of data.
17. IoT and Cloud Data Security
This practical demonstrates a basic data protection workflow for an IoT and cloud security scenario using AES-CBC encryption and SHA-256 hashing.
It introduces the importance of protecting transmitted or stored data and checking data integrity.
Security note: An unkeyed SHA-256 hash alongside AES-CBC does not provide authenticated encryption. A production system should use an appropriate authenticated encryption design.
18. Post-Quantum Cryptography
This practical introduces post-quantum cryptography through two algorithms:
- ML-KEM-768
- ML-DSA-65
The implementation uses the pqcrypto library to explore post-quantum key encapsulation and digital signature concepts.
It provides an introduction to cryptographic approaches designed to address potential threats from future quantum computers.
Technologies and Tools
The practical implementations use the following technology and tools, depending on the individual exercise:
- Python
- Python cryptographic libraries
- PyCryptodome
- pqcrypto
- Hashing and authentication techniques
- Public-key cryptography
- Digital signatures
- SSL/TLS concepts
- Git and GitHub
Source Code and Practical Outputs
All 18 practical implementations, along with their source code and available output screenshots, are organised in my GitHub repository.
GitHub Repository: [ https://github.com/Opurba10/Advance-Cryptography-18-Practicals ]
Readers can visit the repository to explore the Python files, review the implementation structure, and view the practical outputs.
Key Learning Outcomes
Through these practical exercises, I developed a better understanding of:
- Classical and modern cryptographic algorithms.
- Symmetric-key and public-key encryption.
- AES encryption modes and RSA-based encryption.
- Key exchange using DH and ECDH.
- Elliptic Curve Cryptography and digital signatures.
- Cryptographic hashing and message authentication.
- Zero-knowledge proof fundamentals.
- Blockchain concepts and basic cryptanalysis.
- Secure communication using SSL/TLS.
- PKI and digital certificate concepts.
- API integrity verification and IoT data security.
- The fundamentals of post-quantum cryptography.
Security and Educational Disclaimer
This article documents academic practical implementations intended for learning and experimentation.
Some exercises intentionally demonstrate legacy or simplified cryptographic techniques. DES, RC4, MD5, and AES-ECB are not suitable for modern security-sensitive applications. Some other demonstrations use simplified parameters or constructions and should not be considered production-ready.
The examples are not intended to provide real-world security without appropriate security review, secure parameter selection, correct key management, and implementation hardening.
Conclusion
Completing these 18 practical implementations helped me explore a broad range of cryptographic concepts through Python programming.
From classical ciphers to post-quantum cryptography, the exercises provided an opportunity to understand the principles behind different security mechanisms and their relevance to cybersecurity.
I hope this academic practical portfolio can also be useful to students and beginners who are learning cryptography and exploring its implementation using Python.
Thank you for reading!
About the Author
Opurba Sarkar Integrated M.Sc. in Cyber Security & Forensics Department of Biochemistry and Forensic Science Gujarat University, Ahmedabad, Gujarat, India
Interested in Cybersecurity, Digital Forensics, IOT, Cryptography, Security Operations, and Governance, Risk & Compliance (GRC), Malware Analysis….!