Skip to content

Commit

Permalink
Debugged some errors, need to fix RoundKey
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyinjie committed Nov 8, 2014
1 parent e21210e commit cfc8ac3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions AES.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class AES {
private static int[][] roundkey;

public static void main(String[] args) {
AES aes = new AES();
if (!aes.cmdLine_valid(args)) {
System.out.println("Please rerun program with a valid command");
return;
Expand Down Expand Up @@ -111,9 +112,6 @@ public static void main(String[] args) {
if(process.equals("e"))
{


AES aes = new AES();

//initial round 0
int[][] state = aes.addRoundKey(input, cipherkey);

Expand Down Expand Up @@ -141,12 +139,11 @@ public static void main(String[] args) {
}
if (process.equals("d"))
{
AES aes = new AES();
int numRound = 10;
int[][] state = aes.addRoundKey(input, cipherkey);

for (int i = numRound - 1; i >0; i --){
state = aes.addRoundKey(state, roundkey)
state = aes.addRoundKey(state, roundkey);
state = aes.invMixColumns(state);
state = aes.invShiftRows(state);
state = aes.invSubBytes(state);
Expand Down Expand Up @@ -204,9 +201,9 @@ private static String getState(int[][] state)
{
result += Integer.toHexString(state[row][col])+" ";
}
result+="\n"
return result+="\n";
}
result+="\n";
return result+="\n";
}


Expand Down Expand Up @@ -404,7 +401,6 @@ else if(mult == 2)
result ^= 0x1B;
result ^= base;
}
e
return result & 0x00_00_00_FF;
}
/*XOR the state with a 128-bit round key derived from the original key K by
Expand Down

0 comments on commit cfc8ac3

Please sign in to comment.