Simplified DES (S-DES) Encryption and Decryption in MATLAB, Lab Reports of Network security

network security manual cryptography

Typology: Lab Reports

2019/2020

Uploaded on 09/16/2020

mariyam-ashraf
mariyam-ashraf 🇵🇰

5 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CE-408: Cryptography & Network Security SSUET/QR/114
LAB#04
Modern Encryption Techniques
Simplified DES (S-DES)
OBJECTIVE
The purpose of this lab is to implement SDES encryption and decryption in MATLAB.
THEORY
Encryption: It takes an 8-bit block of plain text and a 10-bit key as input and produces an
8-bit block of cipher text as output.
Decryption: It takes an 8-bit block of cipher text and the same 10-bit key used to produce
that ciphertext as input and produces the original 8-bit block of plaintext.
Algorithm involves 5 functions:
1. An initial permutation (IP).
2. A complex function, fK , that involves both permutation and substitution operations and
depends on the sub key input. In the first fK block, sub key 1 is used.
3. A simple permutation function that switches the two halves of the data (SW).
4. The function fK again with sub key 2 being used in this case.
5. A permutation function that is the inverse of the initial one (IP-1) as shown below
C =( IP
-1
f
K
2
SW f
K
1
IP)
or
Ciphertext=IP
-1
(f
K
2
(SW (f
K
1
(IP(plaintext ))) ))
where
K
1
=P8(Left Shift-1 (P10 (key )))
K
2
=P8(Left Shift-2(Left Shift-1(P10(key ))))
and
Plaintext=IP
-1
(f
K
1
(SW (f
K
2
(IP (ciphertext )))))
Lab#04: Simplified DES (SDES) Page | 17
pf3

Partial preview of the text

Download Simplified DES (S-DES) Encryption and Decryption in MATLAB and more Lab Reports Network security in PDF only on Docsity!

LAB#

Modern Encryption Techniques

Simplified DES (S-DES)

OBJECTIVE

The purpose of this lab is to implement SDES encryption and decryption in MATLAB. THEORYEncryption: It takes an 8-bit block of plain text and a 10-bit key as input and produces an 8-bit block of cipher text as output.  Decryption: It takes an 8-bit block of cipher text and the same 10-bit key used to produce that ciphertext as input and produces the original 8-bit block of plaintext.  Algorithm involves 5 functions:

  1. An initial permutation (IP).
  2. A complex function, fK , that involves both permutation and substitution operations and depends on the sub key input. In the first fK block, sub key 1 is used.
  3. A simple permutation function that switches the two halves of the data (SW).
  4. The function fK again with sub key 2 being used in this case.
  5. A permutation function that is the inverse of the initial one (IP-1) as shown below C =( IP - ∘ f (^) K 2 ∘ SWf (^) K 1

∘ IP )

or Ciphertext=IP

  • ( f (^) K 2 (SW ( f (^) K 1 (IP( plaintext ))))) where K 1 =P8(Left Shift-1 (P10 (key ))) K 2 =P8(Left Shift-2( Left Shift-1( P10( key )))) and Plaintext=IP

( f (^) K 1 (SW ( f (^) K 2 (IP (ciphertext )))))

 Refer to the detailed figure for encryption and decryption from the lecture notes.  The reference figures are shown below for encryption and key generation: Matlab Code:  The constants being used are hard coded first in MATLAB.  Create three functions, main, key generator and fk function. The key and fk functions are