CYB102 Module 2
CYB102 Module 2
Adewole Housing Estate, Adeta Road, PMB 1601, Ilorin, Kwara State
FACULTY OF NATURAL AND APPLIED SCIENCES
DEPARTMENT OF COMPUTER SCIENCE
CYBERSECURITY PROGRAMME
2019/2020 ACADEMIC SESSION
CYB 102- Fundamental of Cybersecurity I
MODULE 2
Elementary Cryptography: Substitution Cipher
Encryption is the process of encoding a message so that its meaning is not obvious; decryption is
the reverse process, transforming an encrypted message back into its normal, original form.
Alternatively, the terms encode and decode or encipher and decipher are used instead of encrypt
and decrypt. That is, we say that we encode, encrypt, or encipher the original message to hide its
meaning. Then, we decode, decrypt, or decipher it to reveal the original message. A system for
encryption and decryption is called a cryptosystem.
The original form of a message is known as plaintext, and the encrypted form is called cipher text.
For convenience, we denote a plaintext message P as a sequence of individual characters P = <p1,
p2, …, pn>. Similarly, cipher text is written as C = <c1, c2, …,cm>.
For instance, the plaintext message "I want cookies" can be denoted as the message string <I,
,w,a,n,t,c,o,o,k,i,e,s>. It can be transformed into cipher text<c1, c2, …,c14>, and the encryption
algorithm tells us how the transformation is done.
We use this formal notation to describe the transformations between plaintext and cipher text.
For example:
we write C = E (P) and P = D(C), where C represents the cipher text, E is the
encryption rule, P is the plaintext, and D is the decryption rule.
P = D (E(P)).
In other words, we want to be able to convert the message to protect it from an intruder, but we
also want to be able to get the original message back so that the receiver can read it properly.
The cryptosystem involves a set of rules for how to encrypt the plaintext and how to decrypt the
cipher text. The encryption and decryption rules, called algorithms, often use a device called a key,
denoted by K, so that the resulting cipher text depends on the original plaintext message, the
algorithm, and the key value. We write this dependence as C =E (K, P). Essentially, E is a set of
encryption algorithms, and the key K selects one specific algorithm from the set.
There are many types of encryption. In the next sections we look at two simple forms of encryption:
substitutions in which one letter is exchanged for another and transpositions, in which the order of
the letters is rearranged.
Cryptanalyst: cryptanalyst is a person who studies encryption and encrypted message and tries to
find the hidden meanings (to break an encryption).
Confusion: it is a technique for ensuring that ciphertext has no clue about the original message.
Diffusion: it increases the redundancy of the plaintext by spreading it across rows and columns.
Substitutions Cipher: It basically consists of substituting every plaintext character for a different
cipher text character.
It is of two types-
I. Mono alphabetic substitution cipher
II. Poly alphabetic substitution cipher
Key value is added to plain text and numeric value of key ranges from 0 – 25.
Example:
Plain text(P)- H E L LO (H=7,E=4,L=11,L=11,O=14)
Key (K)=15
Cipher text (C)= 7+15,4+15,11+15,11+15,14+15
= 22,19, 26,26,(29%26)=3
= W T A AD
Playfair cipher
In playfair cipher the secret key is made of 25 characters arranged in 5x5 matrix
Rules:-
If 2 letters in a plaintext are located in the same row of the secret key then the corresponding
encrypted character for each letter is next letter to the right.
If 2 letters in a pair are in same column then the corresponding encrypted character is next below
in the same column.
If 2 letters are neither in same row or in same column then encrypted character is in its own row
but in the same column as the other character.
Vigener cipher:
The key stream is the repetition of the initial secret key stream of length m. (1<=m<=26)
Example:
Plaintext- A B C D E F G H
Ks= 0, 5, 8
A B C D E F G H (B=1 =>1+5=6=>G)
05805805
0 6 10 3 9 13 6 12
A G K D J N G M <= ciphertext
Transposition cipher:
A transposition cipher is a method of encryption by which the positions held by units of plaintext
(which are commonly characters or groups of characters) are shifted according to a regular system,
so that the ciphertext constitutes a permutation of the plaintext. That is, the order of the units is
changed.
The goal of substitution is confusion; the transposition method is an attempt to make it difficult i.e
diffusion.
1. Keyless transposition cipher
Example: m e e t
meat
thep
ark
ciphertext- mmtaeehreaekttp