0% found this document useful (0 votes)
26 views8 pages

Ias Assignment

data encryption with des

Uploaded by

abdibedilu2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views8 pages

Ias Assignment

data encryption with des

Uploaded by

abdibedilu2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

It is clear that DES is one of the symmetric key encryption algorithm mechanism; but

categorized under the modern cipher mechanisms’ using block cipher to


en/decryption the message from sender to receiver then do the following massages to
send from sender to receiver and read at the receiver side .NB: your secret key must
be in hexadecimal format.
3. Take the plain-text message “we are the beginner of cryptography” encrypt it with the
DES key of your own and, read by decrypting the cipher text.

 General instruction follow all the steps (rounds) Feistel Cipher Structure to
encryption and decryption process; by using both (S &P box) tables.
Submission Date 5/01/2025

ANSWER
plain-text : “we are the beginner of cryptography”
key : “0f1571c947d9e859 ”
To convert the phrase "we are the beginner of cryptography" into hexadecimal and
binary, we first convert each character into its ASCII value, then represent that value
in hexadecimal and binary formats.
 Understand the Conversion Process
 Every character in the phrase (including spaces) has an ASCII value.
 ASCII values are then converted to hexadecimal (base 16) and binary (base 2).
Step 1: Convert to ASCII, Hexadecimal and Binary
Each character in the phrase has an ASCII value:
Character ASCII Value Hexadecimal Binary
w 119 77 01110111
e 101 65 01100101
(space) 32 20 00100000
a 97 61 01100001
r 114 72 01110010
e 101 65 01100101
(space) 32 20 00100000
t 116 74 01110100
h 104 68 01101000
e 101 65 01100101
(space) 32 20 00100000
b 98 62 01100010
e 101 65 01100101
g 103 67 01100111
i 105 69 01101001
n 110 6E 01101110
n 110 6E 01101110
e 101 65 01100101
r 114 72 01110010
(space) 32 20 00100000
o 111 6F 01101111
Character ASCII Value Hexadecimal Binary
f 102 66 01100110
(space) 32 20 00100000
c 99 63 01100011
r 114 72 01110010
y 121 79 01111001
p 112 70 01110000
t 116 74 01110100
o 111 6F 01101111
g 103 67 01100111
r 114 72 01110010
a 97 61 01100001
p 112 70 01110000
h 104 68 01101000
y 121 79 01111001
Hexadecimal Result:
77 65 20 61 72 65 20 74 68 65 20 62 65 67 69 6E 6E 65 72 20 6F 66 20 63 72 79 70
74 6F 67 72 61 70 68 79
Binary Result:
01110111 01100101 00100000 01100001 01110010 01100101 00100000 01110100
01101000 01100101 00100000 01100010 01100101 01100111 01101001 01101110
01101110 01100101 01110010 00100000 01101111 01100110 00100000 01100011
01110010 01111001 01110000 01110100 01101111 01100111 01110010 01100001
01110000 01101000 01111001

Key in Hexadecimal and Binary form


· Hexadecimal: 0f1571c947d9e859
· Binary: 00001111 00010101 01110001 11001001 01000111 11011001 11101000 01011001

Step 2: Key Scheduling


1. Convert the 64-bit key into a 56-bit key by applying the Key Permutation
(PC-1) table, which removes 8 parity bits.
A. Input Key

0 0 0 0 1 1 1 1
0 0 0 1 0 1 0 1
0 1 1 1 0 0 0 1
1 1 0 0 1 0 0 1
0 1 0 0 0 1 1 1
1 1 0 1 1 0 0 1
1 1 1 0 1 0 0 0
0 1 0 1 1 0 0 1

B. Permuted Choice One (PC-1)


PC-1 rearranges the 64-bit key into a 56-bit key by discarding 8 parity bits
(positions 8, 16, 24, 32, 40, 48, 56, and 64).
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
After PC-1:This gives a 56-bit key.
K = 01101000 11111100 01000100 10100001 00010001 00111110 10010110
Split Key into Halves
After PC-1, divide the 56-bit key into two 28-bit halves:
 C0 (Left Half): First 28 bits
01101000 11111100 01000100 1010
 D0 (Right Half): Last 28 bits
0001 00010001 00111110 10010110
In the DES algorithm, circular left shifts are performed on the 28-bit halves Cn and
Dn during each of the 16 rounds. The number of shifts for each round is defined by
the following schedule:C0= 01101000 11111100 01000100 1010
D0 =0001 00010001 00111110 10010110

Round Number of Cn and Dn


Number Shifts(LS) Cn = Cn-1 +LS and Dn = Dn-1 + LS
C0=01101000 11111100 01000100 1010
0 0
D0=0001 00010001 00111110 10010110
C1=1101000 11111100 01000100 10100
1 1
D1=001 00010001 00111110 100101100
C2=101000 11111100 01000100 101001
2 1
D2=01 00010001 00111110 1001011000
C3= 1000 11111100 01000100 10100110
3 2
D3= 00010001 00111110 1001011000 01
C4= 00 11111100 01000100 1010011010
4 2
D4= 010001 00111110 100101100001 00
C5= 11111100 01000100 101001101000
5 2
D5=0001 00111110 100101100001 0001
Round Number of Cn and Dn
Number Shifts(LS) Cn = Cn-1 +LS and Dn = Dn-1 + LS
C6= 111100 01000100 10100110100011
6 2
D6= 01 00111110 100101100001 000100
C7= 1100 0100 01001010 01101000 1111
7 2
D7= 00111110 100101100001 0001 0001
C8= 00 01000100 101001101000111111
8 2
D8= 111110 100101100001 00010001 00
C9= 0 01000100 101001101000 1111110
9 1
D9= 11110 100101100001 00010001 001
C10= 1000100 101001101000 11111100 0
10 2
D10= 110 10010 11000010 00100010 0111
C11= 00100 101001101000 11111100 010
11 2
D11=0 10010 11000010 00100010 011111
C12= 100 101001101000 11111100 01000
12 2
D12= 0010 11000010 00100010 0111110 1
C13= 0 101001101000 11111100 0100010
13 2
D13=10 11000010 00100010 0111110 100
C14= 01001101 00011111 10001000 1001
14 2
D14= 11000010 00100010 01111101 0010
C15= 00110100 01111110 00100010 0101
15 2
D15= 00001000 10001001 11110100 1011
C16= 01101000 11111100 01000100 1010
16 1
D16= 00010 001 00010011 11101001 0110
A circular left shift means that the leftmost bits are shifted to the end of the bit sequence.
Combine Cn and Dn for each round to form the 56-bit key for Permuted Choice 2 (PC-2).
C1D1 =1101000 11111100 01000100 10100001 00010001 00111110 100101100
The next is to apply Permuted Choice 2 (PC-2) to generate the 48-bit subkey
Apply PC-2
PC-2 Table:
PC-2 reduces the 56-bit key to a 48-bit subkey by selecting specific bit positions from
C1D1.
14 17 11 24 1 5 3 28
15 6 21 10 23 19 12 4
26 8 16 7 27 20 13 2
41 52 31 37 47 55 30 40
51 45 33 48 44 49 39 56
34 53 46 42 50 36 29 32
C1D1 = 01101000 11111100 01000100 10100001 00010001 00111110 10010110
subkey K1=
C1D1 = 11010001 11111000 10001001 01000010 00100010 01111101 00101100
subkey K1 = 01111000 00110011 11000011 00100000 11011010 01110000
After applying PC-2, we will have a 48-bit sub-key K1 for the first round of DES.
C2D2=10100011 11110001 00010010 10010100 01000100 11111010 01011000
subkey K2 = 00101011 0001010 01110100 111001010 01001000 11010000
C3D3= 10001111 11000100 01001010 01100001 00010011 11101001 011000 01
subkey K3 = 00001100 01111000 11011100 10000001 11010011 00011101

C4D4= 00111111 00010001 00101001 10100100 01001111 10100101 10000100


subkey K4 = 10010110 01100111 01111000 10010011 00010110 10100000

C5D5= 11111100 01000100 10100110 10000001 00111110 10010110 00010001


subkey K5 = 0100110 01011101 00000001 11011000 0000011 001001001

C6D6= 11110001 00010010 10011010 00110100 11111010 01011000 01000100


subkey K6 = 11001011 10101011 01001101 00010010 01101010 1011100

C7D7= 11000100 01001010 01101000 11110011 11101001 01100001 00010001


subkey K7 = 00001001 11110100 10001011 01110001 00110000 10010011

C8D8= 00010001 00101001 10100011 11111111 10100101 10000100 01000010


subkey K8 = 01110001 00001100 11101010 1010111 00100000 1011111

C9D9= 00100010 01010011 01000111 11101111 01001011 00001000 10001001


subkey K9 = 00010010 10011010 10111000 00110011 01000111 10010011

C10D10=10001001 01001101 00011111 10001101 00101100 00100010 00100111


subkey K10 = 10011100 00111000 0110110 0011110 10000001 00000011

C11D11=00100101 00110100 01111110 00100100 10110000 10001000 10011111


subkey K11 = 10100010 01101110 01001100 11000110 01100101 01000100

C12D12= 10010100 11010001 11111000 10000010 11000010 00100010 01111101


subkey K12 = 01001000 01110111 00100100 0110000 0 10100011 11001000

C13D13= 01010011 01000111 11100010 00101011 00001000 10001001 11110100


subkey K13 = 11000000 10011101 01111001 11110000 11010100 00101011

C14D14= 01001101 00011111 10001000 10011100 00100010 00010111 11010010


subkey K14 = 11000101 11100010 01100011 01001110 00011110 00101010

C15D15= 00110100 01111110 00100010 01010000 10001000 10011111 01001011


subkey K15 = 10100011 11011111 10000010 10011100 01111001 01101000

C16D16= 01101000 11111100 01000100 10100001 00010001 00111110 10010110


subkey K16 = 10100110 00010010 00001011 01001101 0100100 00100101
Now that we have the plain-text and key in both hexadecimal and binary
representation of the plain-text, the next step is to begin the DES encryption
process.
Step 3: Initial Permutation (IP)
A. Plain text BLOCK(M) in matrix form
M1=01110111 01100101 00100000 01100001 01110010 01100101 00100000
01110100

0 1 1 1 0 1 1 1
0 1 1 0 0 1 0 1
0 0 1 0 0 0 0 0
0 1 1 0 0 0 0 1
0 1 1 1 0 0 1 0
0 1 1 0 0 1 0 1
0 0 1 0 0 0 0 0
0 1 1 1 0 1 0 0
Apply the Initial Permutation (IP) table to the plain-text binary string.
B. Aplay IP
Initial Permutation Table:
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7
Rearrange the 64-bit plain-text binary using this table.
1 0 1 1 1 0 1 1
1 0 0 1 0 0 0 1
1 0 1 0 0 0 1 1
0 0 1 0 1 0 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
0 0 0 1 0 0 1 1
10111011 10010001 10100011 00101011 00000000 11111111 00000000 00010011
Step 4: Split into Left and Right Halves
 After applying the Initial Permutation, divide the result into two halves:
o Left Half (L0): First 32 bits
o Right Half (R0): Last 32 bits

LO: 10111011 10010001 10100011 00101011


RO: 00000000 11111111 00000000 00010011

Feistel Function and Rounds:


DES performs 16 rounds of processing. Each round involves:
Using the right half (Rn) as input to the Feistel function along with a subkey (Kn).
The Feistel function involves:
Expansion (E): Expands the 32-bit Rn to 48 bits using an expansion table.
Key Mixing: XOR the expanded RnR_n with the 48-bit subkey KnK_n.
Substitution (S-boxes): The 48-bit result is compressed back to 32 bits using substitution
boxes (S-boxes).
Permutation (P): The 32-bit output of the S-boxes is permuted using a P-box.
XOR the Feistel function's output with the left half (LnL_n).
Swap the halves:
Ln=Rn-1 (L1 = Ro) Rn=Ln-1⊕Feistel(Rn-1,Kn)
Ln+1=Rn Rn+1=Ln⊕Feistel(Rn,Kn)
LO: 10111011 10010001 10100011 00101011
L1 = RO: 00000000 11111111 00000000 00010011
subkey K1 = 01111000 00110011 11000011 00100000 11011010 01110000
R1 = L0 ⊕F(R0,K1)
Final Permutation (FP):
After 16 rounds, the final left and right halves are concatenated.
A final permutation (inverse of the initial permutation) is applied to produce the
64-bit ciphertext.
Let me know if you need further clarification or examples for
any step!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy