DES - Arup Guha Solution for CIS 3362 DES Project There are...

Info icon This 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 java.io.*; 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.
Image of page 1

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

View Full Document Right 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!
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern