Unit 3
Encryption
Encryption
Whether it be personal or commercial, data is
really valuable so it is important to keep it safe.
Whether a user is working on an off-line or
online(internet) computer, keeping data safe is very
important.
Data security refers to the process of protecting Encryption is the conversion of plain text
data from unauthorized access and data corruption into cipher text which cannot be easily
Encryption used to ensure the data that cannot be understood by anyone
read by unauthorized user.
Decryption
** In encryption process, key is used to
encrypt and decrypt messages
Decryption is the conversion of cipher text
into plain text.
Encryption
There are two type of encryption: Symmetric and
Asymmetric encryption
Asymmetric Encryption Symmetric Encryption
uses public and private key (difference keys) to uses the same secret key to encrypt
encrypt and decrypt the data. and decrypt the data.
A encrypted message with public key can only be Used by HTTPS connection
decrypted by private key
Pigpen Cypher
• The pigpen does not substitute one letter for another.
• It substitute each letter with a symbol that corresponds
to the portion of the pigpen grid containing the letter.
Example
1. Encrypt the message “ Computer” using Pigpen Cypher
2. Decrypt the cypher message
. .
Plain Text : Computer
Cipher Text : . . . . Encrypt
Cipher Text : . .
Decrypt
Plain Text : D E L L
Pigpen Cipher
• It is a simple cipher and, unless different grids are designed, quite easy to solve.
• Alternative grids, to make the cipher more sophisticated.
In the correct pigpen grid, All characters/letters (A-Z) are contained and each letter has
unique symbol.
Exercise
1. Encrypt the following message using the pigpen cipher
(a) “ I like encoding message”
(b) “ Computer Science”
Caesar Cipher
• The Caesar cipher is a very simple encryption method and would not be used today
because it is so easy to solve.
• The letters of the alphabet are shifted a set of number of places.
• A positive shift moves the letters to the right.
• A negative shift moves the letters to the left.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Example Solution1: Encrypt ( key -3)
1. Encrypt the message “ A Computer” using
Caser Cipher with key of -3 Use left shift
Plain Text A C O M P U T E R
Cipher Text X Z L J M R Q B O
Cipher Text : X ZLJMRQBO
Caesar Cipher
Encrypt Decrypt
Example + Right shift + Left shift
1. Encrypt the message “ SECRET” using - Left shift - Right shift
Caser Cipher with key of +5
2. Decrypt above cipher text with the same key
+5
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Solution1: Encrypt ( key +5) Solution 2: Decrypt ( key +5)
Use Right shift Use Left Shift (opposite shifting of encrypt)
Plain Text S E C R E T
J Y Cipher Text X J H W J Y
Cipher Text X J H W
Plain Text S E C R E T
Cipher Text : XJHWJY
Plain Text : SECRET
Caesar Cipher
• The number of key are limited making it easier to use brute force attack to
decrypt.
1.Encrypt the following using the Caesar cipher with a key of +3.
“ THIS IS A MESSAGE”
2. Decrypt the following cipher text using Caser cipher with of +2
“IQQF LQD”
Vigenere Cipher
This cipher used polyalphabetic
substitution.
In the vigenere cipher, the letter
are replaced using a keyword
(keystream) and a grid containing
26 combination of the alphabet.
In the vigenere cipher, the key
chosen are limitless options
making the cipher far more difficult
than Caesar cipher.
Vigenere Cipher
Example
1. Encrypt the message “ This is a message”
using Vigenere Cipher with keystream “code”
Plain Text t h i s i s a m e s s a g e
Keystream c o d e c o d e c o d e c o
Cipher Text V V L W K G D Q G G V E I S
Cipher Text : VVLW KG D QGGVEIS
Repeat the keyword(keystream) until it is the same length as plain text
To encrypt the plain text, the intersection of the row with plain text
and column with the keystream is found.
Vigenere Cipher
Example
1. Decrypt the cipher message “VVLW KG D
QGGVEIS” using Vigenere Cipher with
keystream “code”
Cipher Text V V L W K G D Q G G V E I S
Keystream c o d e c o d e c o d e c o
Plain Text T H I S I S A M E S S A G E
Plain Text : This is a message
Repeat the keyword(keystream) until it is the same length as cipher text
Find column with the letter of keystream and look down the letter of cipher
text and look along the letter of this row. This letter is plain text
Exercise
(1) Encrypt the message “ computer science” using Vigenere cipher and a keyword “edexcel”.
(2) Perform the encryption of the message “ like a stone” using Vigenere cipher and a key of
“supreme” .
The Rail Fence Cipher
• This is simple cipher which transposes the characters following a simple rule based on a
key.
• In the rail fence cipher, the letters are written zigzag pattern according a give key.
Encrypt the message “ This is a message” using rail fence cipher with key 3
t i e g
h s s m s a e
i a s
Cipher Text : tieg hssmsae ias
The letters are set out on three rows or tracks a zigzag diagonal path.
To encrypt the message, we read each letter from left to right across each row in order,
starting with the top row.
The Rail Fence Cipher
Encrypt the message “ This is a message” using rail fence cipher with key 4
t a g
h s m a e
i i e s
s s
Cipher Text : taghsmaeiiesss
Decrypt the above cipher text “TAGHSMAEIIESSS “ using rail fence cipher with key 4
-T -A -G
- H -S -M -A - E Plain Text:
-I -I - E -S THISISAMESSAGE
THIS IS A MESSAGE
- S -S
The Rail Fence Cipher
To decrypt cipher text, a grid with key value rows is drawn and a dash placed in the cells
in a diagonal path.
The letters, starting from the left , replace the rows, starting with top row.
Read the message in zigzag.
Exercise
(1) Encrypt the message “see you tomorrow” using the rail fence cipher with key of 3
(2) Decrypt the ciphertext “ELTEDECUEINECOPRCCXMSE” using the rail fence cipher with a key of 4.
Exercise
1.Encrypt the following using the Caesar cipher with a key of +3.
“ THIS IS A MESSAGE”
2. Decrypt the following cipher text using Caser cipher with of -2
“ENNB HNZ”