Classical Encryption Techniques (Monoalphabetic Ciphers) - Lab Exercise, Lab Reports of Cryptography and System Security

network security manual for cryptography

Typology: Lab Reports

2019/2020

Uploaded on 09/16/2020

mariyam-ashraf
mariyam-ashraf 🇵🇰

5 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CE-408: Cryptography & Network Security SSUET/QR/114
LAB#02
Classical Encryption Techniques (Monoalphetic Ciphers)
OBJECTIVE
The purpose of this lab is to implement the following algorithms in MATLAB:
1. Monoalphabetic cipher
Additive Cipher
Multiplicative Cipher
Affine Cipher
2. Monoalphabetic Substitution cipher
THEORY
Basic Vocabularies of General Encryption Algorithms:
Plaintext: This is what you want to encrypt
Ciphertext: The encrypted output
Enciphering or encryption: The process by which plaintext is converted into ciphertext
Encryption algorithm: The sequence of data processing steps that go into transforming plaintext
into ciphertext. Various parameters used by an encryption algorithm are derived from a secret
key.
Secret key: A secret key is used to set some or all of the various parameters used by the
encryption algorithm. The important thing to note is that the same secret key is used for
encryption and decryption in classical cryptography. It is for this reason that classical
cryptography is also referred to as symmetric key cryptography.
Deciphering or decryption: Recovering plaintext from ciphertext
Decryption algorithm: The sequence of data processing steps that go into transforming
ciphertext back into plaintext. Various parameters used by a decryption algorithm are derived
from the same secret key that was used in the encryption algorithm. In classical cryptography for
commercial and other civilian applications, the decryption algorithm is made public.
Lab#02: Classical Encryption Techniques (Monoalphetic Ciphers)
Page | 9
pf3
pf4

Partial preview of the text

Download Classical Encryption Techniques (Monoalphabetic Ciphers) - Lab Exercise and more Lab Reports Cryptography and System Security in PDF only on Docsity!

LAB#

Classical Encryption Techniques (Monoalphetic Ciphers)

OBJECTIVE

The purpose of this lab is to implement the following algorithms in MATLAB:

  1. Monoalphabetic cipher  Additive Cipher  Multiplicative Cipher  Affine Cipher
  2. Monoalphabetic Substitution cipher

THEORY

Basic Vocabularies of General Encryption Algorithms:

Plaintext: This is what you want to encrypt Ciphertext: The encrypted output Enciphering or encryption: The process by which plaintext is converted into ciphertext Encryption algorithm: The sequence of data processing steps that go into transforming plaintext into ciphertext. Various parameters used by an encryption algorithm are derived from a secret key. Secret key: A secret key is used to set some or all of the various parameters used by the encryption algorithm. The important thing to note is that the same secret key is used for encryption and decryption in classical cryptography. It is for this reason that classical cryptography is also referred to as symmetric key cryptography. Deciphering or decryption: Recovering plaintext from ciphertext Decryption algorithm: The sequence of data processing steps that go into transforming ciphertext back into plaintext. Various parameters used by a decryption algorithm are derived from the same secret key that was used in the encryption algorithm. In classical cryptography for commercial and other civilian applications, the decryption algorithm is made public. Lab#02: Classical Encryption Techniques (Monoalphetic Ciphers)

Block cipher: A block cipher processes a block of input data at a time and produces a ciphertext block of the same size. Stream cipher: A stream cipher encrypts data on the y, usually one byte at a time.

1. CEASER CIPHER / ADDITIVE CIPHER / SHIFT CIPHER

 Ceaser Cipher is a substitution technique.  It is the earliest known example of a substitution cipher. Each character of a message is

replaced by a character k^ position down in the alphabet where k^ is the index of the

key letter in the English alphabet minus one. For instance, if the plain text is “are you ready” and the key is “d”, then the cipher text becomes “duhbrxuhdgb”. This is done according to the following formula:

C = E ( k , P )=( P + k ) mod 26

Hence in this case, k^ =^3 , and p^ represent the integer representation of letters minus one.

So p^ have the values [^ 0 17 4 24 14 20 17 4 0 3 24^ ]^. Hence, C^ contains the numbers

corresponding to the cipher text. In these formulas, ' k ' would be the secret key. The symbols ' E ' and ' D ' represent encryption and decryption where decryption is given as:

P = D ( k , C )=( C − k ) mod 26

Matlab Code:  Store the letters in a vector. Their locations in the vector represent their values.  Use find() command to find the plaintext in the letters vector.  Use mod() command for the modular arithmetic.

2. MULTIPLICATIVE CIPHER

 In multiplicative cipher, we multiply each plain letter by our secret key. C=E(k,P)=(P x k)mod 26 Lab#02: Classical Encryption Techniques (Monoalphetic Ciphers)

Lab Tasks:

  1. Implement Ceasar Cipher both encryption and decryption or the plaintext “ilikecomputersecurity” by taking key is equal to your roll number.
  2. Implement multiplicative Cipher both encryption and decryption or the plaintext “thismessageiseasytoencrpyt” by taking any key by the user.
  3. Implement Affine Cipher both encryption and decryption or the plaintext “itshardtofindkey” by taking any pair of key.
  4. Encrypt and decrypt the text using monoalphabetic substitution cipher. The key arrangement should be different for each student. The plain text is same as in task 1. Lab#02: Classical Encryption Techniques (Monoalphetic Ciphers)