•

Check out our Community Blogs

Register and join over 40,000 other developers!

### Recent Blog Entries

• phi

I love this community !

# implementation of 4 round impossible differential of AES

encryption

### #1 stMuzak

stMuzak

CC Lurker

• Just Joined
• 1 posts

Posted 05 January 2011 - 10:16 AM

Hi,
I'm trying to implement 4 round impossible differential of AES according to [Impossible differential cryptanalysis of 7-round Advanced Encryption Standard (AES) by Raphael C. & -W. Phan].
It seems round 1 & 2 working properly but round 3 & 4 not ok. I'm using java language, my method is as follows.
```        public void fourRoundDifferential()
{
KeyExpansion();
for(int i = 0; i < 16; i ++){
C1[i] = extend_key[i]^P1[i];
C2[i] = extend_key[i]^P2[i];
}
for(int r = 1; r < 5 ; r++){
System.out.println("\nround-"+r);
if(r < 3){//round 1 & 2
for(int j = 0; j < 16; j++){
C1[j] = SubWord(C1[j]);
C2[j] = SubWord(C2[j]);
}
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | SB-"+x+", = "+(C1[x]^C2[x]));
}
ShiftRow1();
ShiftRow2();
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | SR-"+x+", = "+(C1[x]^C2[x]));
}
MixColumn1();
MixColumn2();
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | MC-"+x+", = "+(C1[x]^C2[x]));
}
for(int i = 0; i < 16; i ++){
C1[i] = C1[i]^extend_key[r*16+i];
C2[i] = C2[i]^extend_key[r*16+i];
}
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | AR-"+x+", = "+(C1[x]^C2[x]));
}
}else
if(r >= 3){//round 3 & 4
for(int j = 0; j < 16; j++){
C1[j] = invSubWord(C1[j]);
C2[j] = invSubWord(C2[j]);
}
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | SB-"+x+", = "+(C1[x]^C2[x]));
}
invShiftRow1();
invShiftRow2();
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | SR-"+x+", = "+(C1[x]^C2[x]));
}
if(r == 3){
invMixColumn1();
invMixColumn2();
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | MC-"+x+", = "+(C1[x]^C2[x]));
}
}

for(int i = 0; i < 16; i ++){
C1[i] = C1[i]^extend_key[160-r*16+i];
C2[i] = C2[i]^extend_key[160-r*16+i];
}
System.out.print("\n");
for(int x = 0; x < 16; x++){
System.out.print(" | AR-"+x+", = "+(C1[x]^C2[x]));
}
}
}
}```

Edited by WingedPanther, 08 January 2011 - 03:58 PM.
add code tags (the # button)

• 0

### #2 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts
• Location:Upstate, South Carolina
• Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
• Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 08 January 2011 - 03:59 PM

Unfortunately, I don't have that reference, or an example of what should be happening vs what is. Can you provide any of that?
• 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### Also tagged with one or more of these keywords: encryption

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download