RCM3720 Cryptography, Network and Computer Security
Laboratory Class 10: The Data Encryption Standard
The object of this lab will be to build up the necessary functions and
tools to implement simplified DES (sDES). All operations will be done on
binary lists. Since the definitions of the sDES functions require lists to be
indexed starting at 0, but in Axiom lists are indexed starting at 1, many of
the operations will have extra ones added at some stage.
- Save the file des.input to a directory in which you
have write access. Read the file into Axiom, and open up the file
with a text editor.
- Compare the first command perm(b) with the initial
permutation for sDES defined in page 94 of the notes. How do the
indices in the Axiom command relate to the indices of the
permutation in the notes?
- Now using the above procedure as a guide, write a procedure called
invperm to perform the inverse permutation.
- Test this procedure: it should invert the permutation you
obtained from the perm procedure.
- The subkey procedure creates two lists: one for the
first subkey, and one for the second. Edit the procedure to include
the second subkey as given on the bottom of page 95.
- Write a procedure called expperm which implements the
expansion permutation on page 96; use the perm and
invperm procedures as guides.
- Using the sbox0 procedure as a guide, write a procedure
to implement S-box 1.
- The mixing function shown in figure 8.5 in the notes is
implemented as mix. This procedure has been
commented.
- Comment each line of the feistel and sdes
procedures in a similar fashion.
- Test the sdes procedure on the example given in the notes.
- Modify your procedure to implement sDES decryption, using the
scheme given on page 99.
- Test that your decryption procedure works; that it decrypts the
ciphertext produced by your encryption procedure to the original
plaintext.