Project Nayuki


DES cipher internals in Excel

DES internals screenshot

Not long after I published AES in Excel, I decided to amuse myself again by implementing the Data Encryption Standard cipher a few months later. DES (year ) is a much older cipher design than AES (), and has rightly fallen into disuse in applications because it’s no longer secure against brute force attacks. So my spreadsheet here is more for historical interest than for practical purposes. (Heaven forbid that you are debugging a 3DES implemen­tation...)

The input to the spreadsheet is two 16-digit hexadecimal strings (each equivalent to 8 bytes), which are the plaintext block and the cipher key. Note that the key effectively has 56 bits of security, because according to the DES specification the least significant bit of each byte is ignored as padding or parity. All other parts of the spreadsheet should not be edited by the user.

Compared to AES, the structure of DES uses fewer types of primitive operations – only bit-by-bit permutations/expansions, XOR, and eight 6bit-to-4bit S-boxes – whereas AES uses byte shifting, XOR, one 8bit-to-8bit S-box, and field multiplication. Because of the heavy use of bit permutations, I chose to implement the DES spreadsheet by giving each bit its own cell, instead of constantly assembling and disassembling multi-bit integers (whereas in AES I always handled whole bytes). DES’s key schedule is less regular than AES’s. Note that all of the data cells are formatted as text instead of number or general, otherwise the whole calculation falls apart. (The data typing in Excel can be confusing, and it behaves like a dynamic, weakly typed programming language.)

Download

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

Microsoft Excel binary file format: des-cipher-internals.xls

Works in basically all versions of Microsoft Excel.

Microsoft Office Open XML Workbook: des-cipher-internals.xlsx

Preferred format for Microsoft Excel 2007 and above.

OpenDocument Spreadsheet: des-cipher-internals.ods

Preferred format for the open-source office suites LibreOffice and Apache OpenOffice.

More info