Opened 12 years ago

Last modified 11 years ago

#8937 needs_info enhancement

Implementation of AES with different key sizes

Reported by: Alasdair McAndrew Owned by: Alasdair McAndrew
Priority: minor Milestone: sage-feature
Component: cryptography Keywords: AES
Cc: Merged in:
Authors: Alasdair McAndrew Reviewers:
Report Upstream: N/A Work issues: Currently there are a lot of doctest fails, I don't know why.
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This class implements the full Advanced Encryption Standard, as described in

http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

It includes encryption with a 128 bit plaintext block, and keys of either 128, 196 or 256 bits, which are the only block and key sizes allowed by the standard. It includes decryption by either the Inverse Cipher method, or the Equivalent Inverse Cipher method. There are also methods to print out all the intermediate steps in either an encryption or decryption.

The various "layers": mixcolumns, shiftrows, subbytes and their inverses, are available to the user for experimentation.

Attachments (1)

aes.sage (43.0 KB) - added by Alasdair McAndrew 12 years ago.
Implementation of AES with different key sizes

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by Alasdair McAndrew

Attachment: aes.sage added

Implementation of AES with different key sizes

comment:1 Changed 12 years ago by Alasdair McAndrew

Owner: changed from Minh Van Nguyen to Alasdair McAndrew

comment:2 Changed 11 years ago by Keshav Kini

Status: newneeds_info

On lines 12 and 13 of your file, you say that this is already implemented in Sage. May I ask what the benefit of your code is over the current implementation, then?

By the way, if you would like to contribute code to Sage, please generate a patch file against the Mercurial repository in $SAGE_ROOT/devel/sage/ . The code should be either added to an existing .py or .pyx file, or in a new .py or .pyx file, somewhere in $SAGE_ROOT/devel/sage, rather than in a .sage file.

I also notice that there is another version of aes.sage that you uploaded to the wiki page TracTickets (in fact that's how I came across this ticket). Can that one be ignored/deleted? It's older than the one you've uploaded to this ticket.

comment:3 in reply to:  2 Changed 11 years ago by Alasdair McAndrew

Replying to kini:

On lines 12 and 13 of your file, you say that this is already implemented in Sage. May I ask what the benefit of your code is over the current implementation, then?

By the way, if you would like to contribute code to Sage, please generate a patch file against the Mercurial repository in $SAGE_ROOT/devel/sage/ . The code should be either added to an existing .py or .pyx file, or in a new .py or .pyx file, somewhere in $SAGE_ROOT/devel/sage, rather than in a .sage file.

I also notice that there is another version of aes.sage that you uploaded to the wiki page TracTickets (in fact that's how I came across this ticket). Can that one be ignored/deleted? It's older than the one you've uploaded to this ticket.

The main difference is that AES, as currently implemented in Martin Albrecht's SR class, is that AES is there treated as one of a number of cryptosystems with different parameters. My implementation is much closer to the ISO standard in design, and allows the user to experiment with all aspects of the AES.

Note: See TracTickets for help on using tickets.