I'm trying to write a code to perform encryption and decryption of 64-bit DES but I'm having a problem in verifying that my code is working correctly. My graduation project is about DES crypt-analysis so I'm trying to implement DES to generate the pairs used in the attack.

Can anyone give me an example on encryption of DES with all stages?

For instance, I would like to see the key schedule and the values of all 16 round keys generated by the input key.

| improve this question | | | | |
  • 3
    $\begingroup$ Just download a working DES code and check with it? $\endgroup$ – kelalaka Dec 19 '18 at 19:22
  • $\begingroup$ @siba36 Note that DES has a 56-bit key, not 64-bits. The LSB in each byte is not part of the key. $\endgroup$ – zaph Dec 26 '18 at 17:13

Might I suggest the "DES cipher internals in Excel" page by Nayuki? Because everything's in Excel, all the internal values are openly displayed.

| improve this answer | | | | |

There's also Eugene Styer's Javascript DES Example which can be (re-)modified to allow using any key:

<         <td><input name="key" value="0000000000000000" size="25" type="text"></td>
>         <td><input name="key" value="3b3898371520f75e" readonly="readonly" size="25" type="text"></td>
<         <td><input name="keyb" value="0000000000000000" size="25" type="text"></td>
>         <td><input name="keyb" value="922fb510c71f436e" readonly="readonly" size="25" type="text"></td>

by removing the readonly attribute (also shows the default keys set to all zeros, supports triple DES as well). You'd save the page and make the above modifications then open the saved page JS-DES.html in a browser.

A copy of the original code allowing the keys to be set can be extracted from the google code dpades source architecture.

The code is found from the decompressed archive by path dpades/trunk/simu_js, extracting JS-DES.html and collocated image directory JS-DES_fichiers. JS-DES.html can be opened in a browser. (The entire archive is 37 MB, Google quit showing the expanded code trees when google code was archived.)

It seems a bit of lesson plan laziness using a fixed key to prevent students from 'cheating' on assignments.

There's also a set of DES validation triplets derived from FIPS Special Pub 500-20 Appendix B: The DES Test Set (Also found on the Internet Archive.)

The triplets are available on github. There may be a single key parity error, I don't recall if I left it corrected. I used the triplets to verify the original libcrypt DES implementation in the early '90s and modified that code to output all the round values. Using JS-DES.html is a bit more convenient (and it passes the validate test set as well).

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.