FINALLY
FINALLY
FACULTY OF TECHNOLOGY
Encrypting my name (the first 64 bit only) using DES Encryption Techniques.
Text =?
Binary Version of plain text (M) = 01010111 01000001 01010011 01001001 01001000
01010101 01001110 01000101
K(binary) = 0101000001000001010100110101001101010000010010000101001001000001
K+ = 00000000111111110000000001010100110000000000001000001101
Next, split this key into left and right halves, C0 and D0, where each half has 28 bits.
C0 = 0000000011111111000000000101
D0 = 0100110000000000001000001101
With C0 and D0 defined, we now create sixteen blocks Cn and Dn, 1<=n<=16.
Each pair of blocks Cn and Dn is formed from the previous pair Cn-1 and Dn-1,
respectively, for n = 1, 2, ..., 16, (using the given schedule in the hand out) of "left
shifts" of the previous block.
C0 = 0000000011111111000000000101
D0 = 0100110000000000001000001101
C1 = 0000000111111110000000001010
D1 = 1001100000000000010000011010
C2 = 0000001111111100000000010100
D2 = 0011000000000000100000110101
C3 = 0000111111110000000001010000
D3 =1100000000000010000011010100
C4 = 0011111111000000000101000000
D4 = 0000000000001000001101010011
C5 = 1111111100000000010100000000
D5 =0000000000100000110101001100
C6 = 1111110000000001010000000011
D6 =0000000010000011010100110000
C7 = 1111000000000101000000001111
D7 =0000001000001101010011000000
C8 = 1100000000010100000000111111
D8 =0000100000110101001100000000
C9 = 1000000000101000000001111111
D9 =0001000001101010011000000000
C10 = 0000000010100000000111111110
D10 =0100000110101001100000000000
C11 = 0000001010000000011111111000
D11 = 000001101010011000000000001
C12 = 0000101000000001111111100000
D12 =0001101010011000000000000100
C13 = 0010100000000111111110000000
D13 =0110101001100000000000010000
C14 = 1010000000011111111000000000
D14 =1010100110000000000001000001
C15 = 1000000001111111100000000010
D15 =1010011000000000000100000110
C16 = 0000000011111111000000000101
D16 = 0100110000000000001000001101
We now form the keys Kn, for 1<=n<=16, by applying the following permutation table to
each of the concatenated pairs CnDn. Each pair has 56 bits, but PC-2( given in the hand out)
only uses 48 of these.
C1 = 0000000111111110000000001010
D1 = 1001100000000000010000011010
which,
after we apply the permutation PC-2, becomes
This rearranges the bits according to the table given in the hand out, where the entries in the
table show the new arrangement of the bits from their initial order. The 58th bit of M
becomes the first bit of IP. The 50th bit of M becomes the second bit of IP. The 7th bit of M
is the last bit of IP. IP is given in the handout.
Next divide the permuted block IP into a left half L0 of 32 bits, and a right half R0 of 32 bits.
We now proceed through 16 iterations, for 1<=n<=16, using a function f which operates on
two blocks--a data block of 32 bits and a key Kn of 48 bits--to produce a block of 32 bits.
Let + denote XOR addition.
To calculate f, we first expand each block Rn-1 from 32 bits to 48 bits. This is done by using a
E bit-selection table (given in the hand out) that repeats some of the bits in Rn-1. We'll call the
use of this selection table the function E. Thus E (Rn-1) has a 32 bit input block, and a 48 bit
output block.
Note that each block of 4 original bits has been expanded to a block of 6 output
bits. Next in the f calculation, we XOR the output E(Rn-1) with the key Kn:
Kn + E(Rn-1).
For n = 1:
K1 = 101000 001001 001001 001010 010001 000010 000001 100011
L1 = R0 = 00000000 00000000 01011000 01000101
R1 = L0 + f (R0, K1) = ?
101001
where Si(Bi) refers to the output of the i th S box (given in the hand out).
The first and the last digit (in decimal) represent the row in the S table.
The middle four digit (in decimal) represents the column in the S table.
0010 1111 0011 0110 0000 0000 0100 0100 (in binary)
The final stage in the calculation of f is to do a permutation P table (given in the hand out) of
the
S-box output to obtain the final value of f :
f = P(S1(B1)S2(B2)...S8(B8))
R1 = L 0 + f
L0 = 11111111 00100101 11100001 10101111
FOR N=2
In the next round, we will have L2 = R1, which is the block we just calculated, and
then we must calculate R2 =L1 + f(R1, K2), and so on for 16 rounds.
= 0101 1100 0100 1010 1000 0101 1111 1101 (in Binary).
f = P(S1(B1)S2(B2)...S8(B8))
R2 = L 1 + f
L1 = 00000000 00000000 01011000 01000101
For n= 3:
K3+ E (R2)= 001100 010011 100010 100011 101110 001000 010111 111110
f= P(S1(B1)S2(B2)...S8(B8))
R3= L2+ f
For n= 4:
f= P(S1(B1)S2(B2)...S8(B8))
R4= L3+ f
f= P(S1(B1)S2(B2)...S8(B8))
R5= L4+ f
For n= 6:
K6+ E (R5)= 110000 000111 110011 011000 000111 111010 011011 010111
f= P(S1(B1)S2(B2)...S8(B8))
R6= L5+ f
For n= 7:
= 0011 0111 1101 1000 1001 0000 0110 0110 (in Binary).
f= P (S1(B1)S2(B2)...S8(B8))
R7= L6+ f
For n= 8:
= 1001 0011 0011 1111 1010 0011 0011 1111 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R8= L7+ f
For n= 9:
f= P(S1(B1)S2(B2)...S8(B8))
R9= L8+ f
For n= 10:
0011 0000 0000 1100 1101 0001 0011 1010 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R10= L9+ f
For n= 11:
K11 + E (R10)= 000010 101001 001111 100001 011010 100111 110110 011100
0100 0011 1010 0011 0000 1100 1000 1100 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R11= L10+ f
For n= 12:
K12+ E (R11)= 010011 101010 111101 100011 010101 001100 100111 110101
= 1011 0100 0010 1000 1111 0110 1000 1001 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R12= L11+ f
For n= 13:
K13 + E (R12)= 010010 010010 011011 011001 100111 010000 101011 110010
= 1010 0111 1011 0001 0111 0000 1000 1001 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R13= L12+ f
For n= 14:
f= P(S1(B1)S2(B2)...S8(B8))
R14= L13+ f
For n= 15:
K15 + E (R14)= 110010 000010 111001 111110 000110 111011 100110 000110
= 1100 0001 1011 0100 0001 0000 1101 0100 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R15= L14+ f
For n= 16:
K16 + E (R15)= 110010 110101 000101 011100 100000 001001 110110 010101
= 1100 0111 0000 0100 0100 0111 1000 0110 (in Binary).
f= P(S1(B1)S2(B2)...S8(B8))
R16= L15+ f
We then reverse the order of the two blocks into the 64-bit block R16L16and apply a final
R16 L16 = 010001 101100 111001 010110 00101110 110101 100111 111100 010101 10001010
IP-1 = 0010 1000 1111 0111 1111 1101 0011 0011 1010 1100 0010 0001 1111 0100 1001 0010
C= 00E2FB7D5E75043F
This is the encrypted form of M=DANIEL TE (The first 64 bit of my full name: WAS5H4NE TADESSE ).