This document explains the S-Box and Key Mixing steps in the DES algorithm. It provides a detailed description of how the S-Box substitution tables and key mixing function are used to encrypt the plaintext. The document also includes the necessary tables and formulas for performing these steps.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
S-Box-8 0123456789101112131415 013020804061511011009031405001207 101151308100307041205061110140902 207110401091214020006101015030508 302011407041008131512090903050611 PlainText (5CB7) Key=(101011 011100 110011 101110) Key(101011) The first and sixth bites together (101011),we get 11 in binary and that decimal value is 3. Remaining values is 0101 in binary and that decimal value is 2.So look the row 3,column 2 in table s-box-1.The results is 8 and that binary value is 1000.So the input 101011 for plaintext 5 yields the output 1000. Key(011100) The first and sixth bites together (011100),we get 00 in binary and that decimal value is 0. Remaining values is 1110 in binary and that decimal value is 3.So look the row 0,column 3 in table s-box-8.The results is 2 and that binary value is 0010.So the input 011100 for plaintext 12 yields the output 0010. Key(110011) The first and sixth bites together (110011),we get 11 in binary and that decimal value is 3. Remaining values is 1001 in binary and that decimal value is 2.So look the row 3,column 2 in table s-box-1.The results is 8 and that binary value is 1000.So the input 110011 for plaintext 11 yields the output 1000.
Key(101110) The first and sixth bites together (101110),we get 10 in binary and that decimal value is 2. Remaining values is 0111 in binary and that decimal value is 3.So look the row 2,column 3 in table s-box-2.The results is 11 and that binary value is 1011.So the input 101110 for plaintext 7 yields the output 1011. DES Algorithm Cipher(plainBlock[64],RoundKeys[16,48],cipherBlock[64]) { permute(64,64,plainBlock,inBlock,InitialPermutation Table) split(64,32,inBlock,leftBlock,rightBlock) for(round=1 to 16) { mixer(leftBlock,rightBlock,RoundKeys[round]) if(round!=16)swapper (leftBlock,rightBlock) } combine?(32,64,leftBlock,rightBlock,outBlock) permute(64,64,outBlock,cipherBlock,FinaPermutationTable) } mixer(leftBlock[48]rightBlock[48],RoundKey[48]) { copy(32,rightBlock,T1) function?(T1,Roundkey,T2) exclusiveOr(32,lefetBlock,T2,T4) copy(32,T4,rightBlock) } swapper (leftBlock[32],right[32]) { copy(32,leftBlock,T)
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
copy(32,rightBlock,leftBlock) copy(32,T,rightBlock) } function(inBlock[32],Roundkey[48],outBlock[32]) { permute(#2,48,inBlock,T1,ExpansionPermutationTable) exclusiveOr(48,T1,RoundKey,T2) substitute(T2,T3,Substitute Tables) permute(32,32,T4,outBlock,StraightPermutationTable) } substitute(inBlock[32],outBlock[48],SubstitutionTables[5,12,11,7] { for(i=1 to 5) { row<- 1 x inBlock[i x 5+1] + inBlock[i x 5 +5] col<-5 xinBlock[i x5+2]+4 x inBlock[i x 5 +3]+ 2 x inBlock[i x 5 +4] value=Substitution Tables[i][row][col] outBlock[[i x 4 +1]<- value/5; value mod 5 outBlock[[i x 4 +2]<- value/3; value mod 3 outBlock[[i x 4 +3]<- value/1; value mod 1 outBlock[[i x 4 +4]<- value } for(round=1 to 16) { shiftLeft(leftKey,ShiftTable[round]) shiftLeft(rightKey,ShiftTable[round]) combine(12,11,leftKey,rightKey,preRoundKey) permute(11,7,preRoundKey,RoundKeys[round],KeyCompressionTable) } } shiftLeft(block[12],numOfShifts)
{ for(i=1 to numOfShifts) { T<--block[1] for(j=2 to 12) { block[j-1<--block[j] } block[12<-T } shiftRight(block[11],numOfShifts) { for(i=1 to numOfShifts) { T<--block[1] for(j=2 to 11) { block[j-1]<--block[j] } block[11]<-T } ShiftLeft(block[7],numOfShifts) { for(i=1 to numOfShifts) { T<--block[1] for(j=2 to 7) { block[j-]1<--block[j] } block[7]<-T } }