DES - / Arup Guha / 11/7/06 / / Solution for CIS 3362 DES...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
// Arup Guha // 11/7/06 // Solution for CIS 3362 DES Project / // There are many weaknesses in this solution due to my laziness! // All of the constants in the algorithm should be stored in final // static variables, but I just wanted to read in the information // from the files instead of hard-coding them. / // Also, the key should stay the same for encrypting one file, but // the blocks must change. This hasn't been indicated clearly. / import*; import java.util.*; i public class DES { p private int[] key; private int[][] roundkeys; private int[] block; p private static int[][][] stables; private static int[] IP; private static int[] IPInv; private static int[] E; private static int[] PC2; private static int[] P; private static int[] PC1; private static int[] keyshifts; // Reads all the information from the file I created based on the order // the values were stored in the file. My original posted file had some // errors in it, because some zeroes were stored as captial O's. I fixed // those issues in the file and have posted the corrected file with this // solution. public DES(int[] thekey) throws Exception { p key = new int[64]; stables = new int[8][4][16]; IP = new int[64]; IPInv = new int[64]; E = new int[48]; PC2 = new int[48]; P = new int[32]; PC1 = new int[56]; keyshifts = new int[16]; block = new int[64]; b // Sets the key to what was passed in. for (int i=0; i<64; i++) key[i] = thekey[i]; k Scanner fin = new Scanner(new File("destables.txt")); S // Reads in the initial permutation matrix. for (int i=0; i<64; i++) IP[i] = fin.nextInt(); I // Reads in the inverse of the initial permutation matrix.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
for (int i=0; i<64; i++) IPInv[i] = fin.nextInt(); I // Expansion matrix used in each round. for (int i=0; i<48; i++) E[i] = fin.nextInt(); E // The permutation matrix P used in each round. for (int i=0; i<32; i++) P[i] = fin.nextInt(); P // Reads in the 8 S-boxes! for (int i=0; i<8; i++) {
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/13/2011 for the course CIS 3362 taught by Professor Staff during the Fall '08 term at University of Central Florida.

Page1 / 6

DES - / Arup Guha / 11/7/06 / / Solution for CIS 3362 DES...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online