https://github.com/adrianklessa/aes
A simple, educational implementation of AES w/ CBC mode of operation
https://github.com/adrianklessa/aes
aes aes-encryption cbc-mode cryptography pkcs7 polynomials toy-project
Last synced: 9 months ago
JSON representation
A simple, educational implementation of AES w/ CBC mode of operation
- Host: GitHub
- URL: https://github.com/adrianklessa/aes
- Owner: AdrianKlessa
- Created: 2024-12-20T17:05:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-17T15:02:50.000Z (over 1 year ago)
- Last Synced: 2025-06-23T03:44:32.882Z (about 1 year ago)
- Topics: aes, aes-encryption, cbc-mode, cryptography, pkcs7, polynomials, toy-project
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### A simple, naive implementation of AES

Includes implementation of:
* AES-128, AES-192, AES-256
* CBC mode of operation for encrypting arbitrarily large data
* PKCS#7 padding for unambiguous message padding to a multiple of block size
* Unit tests comparing the program's output to official test vectors
* Helper `encrypt_string`, `decrypt_string` methods for easy encryption of data without converting to bytes
### Disclaimer:
### This code is not safe for real-world usage
*The implementations are for educational purposes*
*They are slow and surely vulnerable to timing and various other attacks*
## Resources used:
* [NIST FIPS 197](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197-upd1.pdf) for implementation details and test vectors for intermediate stages of encryption
* [NIST SP 800-38a](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf) for test vectors for CBC mode
* [AES lecture slides](https://tratliff.webspace.wheatoncollege.edu/2016_Fall/math202/inclass/sep21_inclass.pdf) by T. Ratliff at Wheaton College for verifying the multiplicative inverse in GF(2^8)
* [The Wikipedia article](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) for a high-level explanation of the algorithm and information about equivalent implementation methods