Initial and Final Permutation
Each Permtation takes a 64-bit input and permutes them according to a predefined rule.
It follows the Initial Permutation table . The table is fixed so meaning to say the 58th Bit will become the 1st Bit, 50th Bit becomes the 2nd bit, 42th Bit become the 3rd bit, so on and so forth.
For the Final Permutation, It follows the Final Permutation Table which is as follows:
In this case the 40th Bit become the 1st Bit, the 8th bit becomes the 2nd bit, 48th bit becomes the 3rd bit.
Lets take an example of a Plaintext: 123456ABCD132536
We will apply initial permutation to it.
Firstly the plain text is in HEX. We have to convert it to binary.
1 = 0001 2 = 0010 3=0011
4 = 0100 5= 0101 6=0100
7 = 0111 8 = 1000 9 = 1001
A = 1010 B = 1011 C = 1100
D = 1101 E = 1100 F = 1111
Therefore 123456ABCD132536 converted to binary would be
0001 0010 0011 0100 0101 0100 1010 1011 1100 1101 0001 0011 0010 0101 0011 0100
16 x 4 bits each = 64 bits.
1st bit = 0
2nd bit = 0
3rd bit = 0
4th bit = 1
5th bit = 0
6th bit = 0
7th bit = 1
8th bit = 0
and so on...
Now we map the bits into the first permutation table
we will get :
in this case the 58th bit is a 1 so
we place the 0 in the first bit position
next we look at the 2nd bit which is suppose to be fitted with value of the 50th bit which is also a 0
now the 3rd bit is to be fited by value from the 42th bit which has the value of 0
the 4th bit is to be fitted by value from the 34th Bit which is suppose to be the value of 1
0001
and we carry on with the rest ..
0001 0010 0011 0100 0101 0110 1010 1011 1100 1101 0001 0011 0010 0101 0011 0110
Converted To :
0001 0100 1010 0111 1101 0110 0111 1000 0001 1000 1100 1010 0001 1000 1010 1101
and now we convert this back to HEX using the table above where
0001 = 1
0100 = 4
1010 = A
0111 = 7
and so we will end up with
14A7D67818CA18AD
We will do the Final Permutation after the 16 rounds of Feistel Encryption.
Subscribe to:
Post Comments (Atom)
!001010100101000100101000101010010101010101001001 run