1st Lecture
1st Lecture
1
C.N. Security lec 1 ENG. AHMED K. DARAJ
Cryptology is the science and study of systems for secret communications. It consists of two
complementary fields of study: Cryptography, the design of secret communications systems,
and Cryptanalysis, the study of ways to compromise of secret communications systems.
• Non-repudiation It implies that one party of a transaction cannot deny having received
a transaction, nor can the other party deny having sent a transaction.
C.N. Security lec 1 ENG. AHMED K. DARAJ
1- Symmetric
2- Asymmetric
A Symmetric cryptography ciphers may in fact be sub classified into Block Ciphers (in
which blocks of data, known as plaintext, are transformed into cipher text which appears
unintelligible to unauthorized persons) and Stream Ciphers (which involve streams of typically
binary operations and are well suited for efficient computer implementation) as shown in figure
1-1.
Symmetric Ciphers
In Symmetric cryptography ciphers the enciphering and deciphering keys are the same, as
shown in figure 1-2:
Plaintext: This is the original intelligible message or data that is fed into the algorithm as input.
Ciphertext: This is the scrambled message produced as output. It depends on the plaintext and
the secret key. The ciphertext is an apparently random stream of data and, as it stands,
is unintelligible.
Secret key: The secret key is also input to the encryption algorithm. The key is a value
independent of the plaintext and the algorithm. The algorithm will produce a different
output depending on the specific key being used at the time. The exact substitutions
and transformations performed by the algorithm depend on the key.
1. Block Cipher: processes the input one block of elements at a time, producing an output
block for each input block.
2. Stream Cipher: processes that encrypt a digital data stream one bit or one byte at a time.
The process of transforming plaintext into ciphertext is called Encryption; the reverse
process of transforming ciphertext into plaintext is called Decryption.
Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes the
ciphertext and the secret key and produces the original plaintext.
An algorithm for performing encryption (and the reverse, decryption): a series of well-defined
steps that can be followed as a procedure. It works at the level of individual letters, or small
groups of letters.
Cryptosystem: The package of all processes, formulae, and instructions for encoding and
decoding messages using cryptography
Digram: Sequence of two consecutive characters
C.N. Security lec 1 ENG. AHMED K. DARAJ
Key: A relatively small amount of information that is used by an algorithm to customize the
transformation of plaintext into ciphertext (during encryption) or vice versa (during
decryption)
Key length: The size of the key - how many values comprise the key
Monoalphabetic: Using one alphabet - refers to a cryptosystem where each alphabetic character
is mapped to a unique alphabetic character
Polyalphabetic: Using many alphabets - refers to a cipher where each alphabetic character can
be mapped to one of many possible alphabetic characters
Trigram: Sequence of three consecutive characters unigram
Caesar cipher
The earliest known use of a substitution cipher, and the simplest, was by Julius Caesar.
The Caesar cipher involves replacing each letter of the alphabet with the letter standing three
places further down the alphabet. For example:
Plain: m eet me after the toga party Cipher: P HHW PH DIWHU WKH WRJD SDUWB
Each letter location shifted 3 locations for example: m =12 so 12+3= 15 that mean (P)
Let us assign a numerical equivalent to each letter:
A B C D E F G H I J K L M
0 1 2 3 4 5 6 7 8 9 10 11 12
N O P Q R S T U V W X Y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
c(1) = 18+3 mod 26 = 21 c(2) = 7+3 mod 26 =10 c(3) = 8+3 mod 26 = 11
cipertexe: VKLSHTXLSPHQWZLOOUHDFKRQWKHIRXUWKRIMXOB
p3= (1-3) mod 26=24➔y p4= (25-3) mod 26=22➔w p5= (17-3) mod 26=14➔o p6= (20-3)
mod 26=17➔r p7= (6-3) mod 26=3➔d then the plaintext is keyword
The two basic building blocks of all encryption techniques are substitution and
transposition:
Substitution technique is one in which the letters of plaintext are replaced by other letters or
by numbers or symbols.
1. Monoalphabetic: Using one alphabet - refers to a cryptosystem where each alphabetic
character is mapped to a unique alphabetic character.
2. Polyalphabetic: Using many alphabets - refers to a cipher where each alphabetic
character can be mapped to one of many possible alphabetic characters.
Cryptosystem: The package of all processes, formulae, and instructions for encoding and
decoding messages using cryptography.
The simple substitution cipher is a cipher that has been in use for many hundreds of years.
It basically consists of substituting every plaintext character for a different ciphertext character.
It differs from the Caesar cipher in that the cipher alphabet is not simply the alphabet shifted, it
is completely jumbled.
Example : Encrypt the following text: "defend the east wall of the castle".
Keys for the simple substitution cipher usually consist of 26 letters (compared to the
caeser cipher's single number). An example key is:
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
P H Q G I U M E A Y L N O F D X J K R C V S T Z W B
Ciphertext: GIUIFGCEIIPRCTPNNDUCEIQPRCNI
C.N. Security lec 1 ENG. AHMED K. DARAJ
Example 2:
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
H W U G C T V A E K D Y Q P B R J L F I X M S O Z N
Playfair Cipher
The Playfair algorithm is based on the use of a 5 x 5 matrix of letters constructed using a
keyword. The matrix is constructed by filling in the letters of the keyword (minus duplicates)
from left to right and from top to bottom, and then filling in the remainder of the matrix with
the remaining letters in alphabetic order. The letters I and J count as one letter.
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
C.N. Security lec 1 ENG. AHMED K. DARAJ
1. Repeating plaintext letters that are in the same pair are separated with a filler letter, such as
x, so that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each replaced by the letter
to the right, with the first element of the row circularly following the last. For example, ar
is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the letter beneath,
with the top element of the column circularly following the last. For example, mu is
encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and
the column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes
IM (or JM, as the encipherer wishes).
Example: Encrypt the following message: “Why, don’t you?” using the keyword: "keyword"
K E Y W O
R D A B C
F G H I/ J L
M N P Q S
T U V X Z
wh yd on ty ou
YJ EA ES VK EZ
Example: Decrypt the message (PH GK CN HR FA NY) using playfair cipher with the
key=encrypt.
GK➔ fi f g h i/j k
l m o q s
CN➔ ne
u v w x z
RH➔ ci
AF➔ ph