Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

an implementation of the AES (Rijndael) algorithm in Python

NotificationsYou must be signed in to change notification settings

joeylemon/python-aes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test

An implementation of the Advanced Encryption Standard (AES/Rijndael) algorithm in Python, following the Federal Information Processing Standards Publication 197 (FIPS-197) specification sheet.

Motivation

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.

How to Use

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.py

Depending on your Python installation, you might have to explicity specify Python3:

> python3 aes.py

How to Test

This 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 -v

You 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.018sOK

About

an implementation of the AES (Rijndael) algorithm in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp