AES cipher internals in Excel

Here you can encrypt a block of bytes with a key using the popular Advanced Encryption Standard cipher. All the internal steps of the computation are shown, which can be helpful for anyone debugging their own AES implementation. In each of the 10/12/14 rounds, the sub-steps of SubBytes, ShiftRows, MixColumns, AddRoundKey, and key schedule are shown.

Keep in mind that AES data squares are serialized in columns – bytes go down the leftmost column, then the next column to the right, and so on. Only the two 4×4 squares with blue background are for user input; they are labelled “Plaintext” and “Key”. When you modify the input values, the intermediate steps and output will be recomputed automatically. The other cells should not be directly modified by the user.

The algorithm is implemented as a Microsoft Excel / OpenDocument Spreadsheet file, using only ordinary spreadsheet math functions, without VBA or macros. The key mathematical functions I used are VLOOKUP, BITXOR, DEC2HEX, and HEX2DEC. Curiously older versions of Excel don’t have BITXOR, so the OpenDocument version was easier to implement. There is a separate worksheet to store the long and unsightly lookup tables such as the S-box . All 3 key lengths (128, 192, 256 bits) are supported for encryption mode, and AES-128 is supported for decryption.

Download

The AES cipher internals spreadsheet is available in multiple formats, all with the same content and formatting:

Microsoft Excel binary file format: aes-cipher-internals.xls Works in basically all versions of Microsoft Excel. In LibreOffice / Apache OpenOffice, the formulas should work properly but the style/ formatting may be slightly incorrect. Microsoft Office Open XML Workbook: aes-cipher-internals.xlsx Preferred format for Microsoft Excel 2007 and above. In OpenOffice.org/ LibreOffice, the formulas should work properly but the style/ formatting may be slightly incorrect. OpenDocument Spreadsheet: aes-cipher-internals.ods Preferred format for the open-source office suites LibreOffice and Apache OpenOffice. Broken in Microsoft Excel 2010, but works in newer versions.

More info