- Notifications
You must be signed in to change notification settings - Fork0
joeylemon/python-aes
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An implementation of the Advanced Encryption Standard (AES/Rijndael) algorithm in Python, following the Federal Information Processing Standards Publication 197 (FIPS-197) specification sheet.
As students in COSC483: Applied Cryptography at theUniversity of Tennessee Knoxville, we were tasked with implementing the AES algorithm from scratch in any programming language of our choice. This involved implementing finite field arithmetic, key expansion routines, the cipher (encrypt) function, and the inverse cipher (decrypt) function. The only resources behind the algorithm which we were allowed to use was theFIPS Publication 197, ananimation, astick figure guide, andWikipedia's write-up for AES. I followed these instructions and only used the given resources, with almost 98% of my time spent looking over FIPS-197.
FIPS-197 provides a plethora of information to assist in implementing the AES algorithm. Among the provided information is the test output in Appendix C, which provides step-by-step values for each round of the cipher and inverse cipher routines. This program matches the output from Appendix C exactly.
This program requiresPython3. It was specifically tested with Python v3.9.0.
To run the program with default output similar to Appendix C of FIPS-197, simply run the command:
> python aes.pyDepending on your Python installation, you might have to explicity specify Python3:
> python3 aes.pyThis program is accompanied by a suite of unit tests designed to ensure the correct functionality of every routine involved in the AES algorithm. To run the unit tests, simply run the command:
> python -m unittest test.py -vYou should see an output similar to:
test_ff_add (test.TestArithmetic) ... oktest_ff_multiply (test.TestArithmetic) ... oktest_xtime (test.TestArithmetic) ... oktest_decrypt (test.TestCipher) ... oktest_encrypt (test.TestCipher) ... oktest_inverses (test.TestCipher) ... oktest_rounds (test.TestCipher) ... oktest_key_expansion (test.TestExpansion) ... oktest_rot_word (test.TestExpansion) ... oktest_sub_word (test.TestExpansion) ... oktest_matrix_to_text (test.TestUtilities) ... oktest_text_to_bytes (test.TestUtilities) ... oktest_text_to_matrix (test.TestUtilities) ... ok----------------------------------------------------------------------Ran 13 tests in 0.018sOKAbout
an implementation of the AES (Rijndael) algorithm in Python
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.