Crytography PPT 2
Crytography PPT 2
Crytography PPT 2
Terminologies
■ plaintext - original message
■ ciphertext - coded message
■ encipher (encrypt)
converting plaintext to ciphertext
■ decipher (decrypt)
recovering plaintext from ciphertext.
■ cryptography
study of encryption principles/methods
■ cryptanalysis (codebreaking)
study of principles/ methods of deciphering ciphertext without knowing key
■ cryptology
field of both cryptography and cryptanalysis
2
Symmetric key cryptography
■ An original message is known as the plaintext, while the coded message is
called the cipher text.
3
Symmetric key cryptography (Conti…)
■ Symmetric encryption transform plaintext into ciphertext using a secret key
and an encryption algorithm. Using the same key and a decryption
algorithm, the plaintext is recovered from the ciphertext.
4
Symmetric cipher model
5
Symmetric cipher model (Conti…)
■ There are two requirements for secure use of conventional encryption
■ 2.Sender and receiver must have obtained copies of the secret key in a
secure fashion and must keep the key secure. If someone can discover the
key and knows the algorithm, all communication using this key is readable.
6
Transposition techniques
■ Transposition techniques systematically transpose
the position of plaintext elements.
7
Transposition techniques (Conti…)
■ Plain text: meet at five pm behind p lab.
■ Written as rail fence of depth 2:
m e a f v p b h n p a
e t t i e m e i d l b
8
Transposition techniques (Conti…)
■ With rail fence of depth 3:
■ Encrypted as: mtf ebi pbe aip enl xet vmh dax
9
Transposition techniques (Conti…)
■ A more complex scheme is to write a message in a rectangle
(square matrix), row-by-row and read it off, column.
■ Pain text: meet at five pm behind p lab.
m e e t a
t f i v e
p m b e h
i n d p l
a b x x x
■ Encrypted text: mtpiaefmnbeibdxtvepxaehlx
10
Transposition techniques (Conti…)
11
Transposition techniques (Conti…)
■ Simple transposition-permutation:
12
Substitution techniques
13
Caesar Cipher
■ In cryptography, a Caesar cipher, also known as a Caesar's cipher, the
shift cipher, Caesar's code or Caesar shift, is one of the simplest and
most widely known encryption techniques.
■ It is a type of substitution cipherIt is a type of substitution cipher in which
each letter in the plaintextIt is a type of substitution cipher in which each
letter in the plaintext is replaced by a letter some fixed number of positions
down the alphabet.
■ For example, with a shift of 3, A would be replaced by D, B would become
E, and so on.
14
Caesar Cipher (Conti…)
■ The encryption can also be represented using modular arithmetic by
first transforming the letters into numbers, according to the scheme, A =
0, B = 1,..., Z = 25.
■ Encryption of a letter by a shift n can be described mathematically as
15
PLAYFAIR CIPHER
■ To generate the key table, one would first fill in the spaces in the table with
the letters of the keyword (dropping any duplicate letters), then fill the
remaining spaces with the rest of the letters of the alphabet in order
■ To encrypt a message, one would break the message into digraphs (groups
of 2 letters) such that, for example, "HelloWorld" becomes "HE LL OW
OR LD", and map them out on the key table.
16
RULES
■ If both letters are the same (or only one letter is left), add an "X" after the first
letter. Encrypt the new pair and continue. Some variants of Playfair use "Q" instead
of "X", but any uncommon monograph will do.
■ If the letters appear on the same row of your table, replace them with the letters to
their immediate right respectively (wrapping around to the left side of the row if a
letter in the original pair was on the right side of the row).
■ If the letters appear on the same column of your table, replace them with the letters
immediately below respectively (wrapping around to the top side of the column if a
letter in the original pair was on the bottom side of the column).
■ If the letters are not on the same row or column, replace them with the letters on the
same row respectively but at the other pair of corners of the rectangle defined by the
original pair. The order is important – the first letter of the encrypted pair is the one
that lies on the same row as the first letter of the plaintext pair.
17
EXAMPLE( 5x5 MATRIX)
18
EXAMPLE
■ Cipher text: YI EA ES VK EZ
19
EXAMPLE
■ Cipher text: QF YS ZQ LQ IC UW
■ Plain text : IM PO SX SI BL EX
20
EXAMPLE(6 x 6 MATRIX)
■ Key: KEY WORD
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 0 1 2 3
4 5 6 7 8 9
■ Plain text: MECSE ROOM NO 416
■ ME CS ER OO MN O4 16
■ Regrouping: ME CS ER OX OM NO 41 6X
■ Cipher text: OI TB YK 2K FU RM X7 04
21
HILL CIPHER
■ C=EK(X)=KX mod 26
■ X=DK(C)= K-1C mod 26
■ For n=3
■ C1= (k11x1+k12x2+k13x3) mod 26
■ C2= (k21x1+k22x2+k23x3) mod 26
■ C3= (k31x1+k32x2+k33x3) mod 26
22
HILL CIPHER (Conti…)
■ Example: encrypt ‘meet b’ using 2x2 hill cipher with the key k= 3 1
■ 5 2
■ K-1= 2 -1
■ -5 3
■ Plain text will be written as ME ET BX
■ Letters with there numerical values are as follows
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
23
HILL CIPHER (Conti…)
■ ENCRYPTION
■ c1 = k11 k12 x x1 mod 26
■ c2 k21 k22 x2
■ c1 = 3 1 X 12 mod 26
■ c2 5 2 4
■ C1=(36+4) mod 26 = 14 = o
■ C2=(60+8) mod 26 = 16 = q
■ C3=(12+19) mod 26 = 5 = f
■ C4=(20+38) mod 26 = 6 = g
■ C5=(3+23) mod 26 = 0 = a
■ C6=(5+46) mod 26 = 25 = z
■ Encrypted text is : ‘oq fg az’
24
HILL CIPHER (Conti…)
■ DECRYPTION
■ X1 = k11 k12 x C1 mod 26
■ X2 k21 k22 C2
■ x1 = 2 -1 X 14 mod 26
■ x2 -5 3 16
■ x1=(28-16) mod 26 = 12 = m
■ x2=(-70+48) mod 26 = 4 = e
■ x3=(10-6) mod 26 = 4 = e
■ x4=(-25+18) mod 26 = 19 = t
■ x5=(0-25) mod 26 = 1 = b
■ x6=(0+75) mod 26 = 23 = x
■ Decrypted text is : ‘me et bx’
25
HILL CIPHER (Conti…)
■ K= 2 1 1
■ 1 1 2
■ 1 0 -2
■ K-1= 2 -2 -1
■ -4 5 3
■ 1 -1 -1
26
VIGENERE CIPHER
■ In a Caesar cipher, each letter of the alphabet is shifted along some
number of places; for example, in a Caesar cipher of shift 3, A would
become D, B would become E and so on.
27
VIGENERE CIPHER (Conti…)
■ Plain text: ATTACKATDAWN A T T A C K A T D A W N
L E M O N L E M O N L E
■ Key: LEMON
28
VIGENERE CIPHER (Conti…)
29
VIGENERE CIPHER (Conti…)
■ Vigenère can also be viewed algebraically. If the letters
A–Z are taken to be the numbers 0–25, and addition is
performed modulo 26, then Vigenère encryption can be
written,
■ Decryption
30
VERNAM CIPHER
■ Gilbert vernam in 1918 devised a system that works on binary
data rather than letters.
31
ONE-TIME PAD
■ Major joseph mauborgne-an army signal corp. officer, invented it by
proposing improvement in vernam cipher.
■ A one-time pad (OTP) is a large no repeating set of truly random key
letters, written on sheet of paper, and glued together in a pad.
■ The sender uses each key letter on the pad to encrypt exactly one plain
text character.
■ The sender encrypts the message and then destroys the used pages of
the pad.
■ The receiver has an identical pad and uses each letter on the pad, in
turn, to decrypt each letter of cipher text.
■ The receiver destroys the same used pages of the pad after decrypting
the message.
■ It produces random output that bears no statistical relationship to the
plaintext so there is no way to break the code.
32
CRYPTOGRAPHIC CODE
■ Ciphers are encryption techniques, which are applied to plain text units
independent of their semantic or linguistic meaning; the result is called
cipher text.
■ Cryptographic codes operate on semantic units such as words, groups of
words, or phrases, and substitute (replace) these by designated words, letter
groups, or number groups called code groups.
■ The key is a dictionary-like codebook listing plain text units and their
corresponding code groups, indexed by the former; a corresponding
codebook for decoding is reverse-indexed.
■ Several factors suggest that codes may be more difficult to break than
cipher: the key (codebook) is vastly larger than typical cipher keys; codes
may result in data compression; and statistical analysis is complicated by
the large plain text unit block.
33
CRYPTOGRAPHIC CODE (Conti…)
■ Major disadvantages: the coding operation not being easily automated; and
identical encryption of repeated occurrences of plain text units implies
susceptibility to known plain text attacks, and allows frequency analysis
based on observed traffic.
■ This implies a need for frequent changing of the codebook, which is both
more costly and inconvenient. Consequently, codes are not commonly used
to secure modern telecommunications.
34
CRYPTANALYSIS
■ general approaches:
cryptanalytic attack
brute-force attack
35
CRYPTANALYSIS (Conti…)
■ Cryptanalytic attacks
■ Cryptanalytic attacks rely on the nature of the algorithm plus
perhaps some knowledge of the general characteristics of the
plain text or even some sample plaintext-ciphertext pairs.
36
CRYPTANALYSIS (Conti…)
■ Known plaintext attack
Encryption algorithm
Ciphertext
One or more plaintext-ciphertext pair formed with the secret key
■ Chosen plaintext attack
Encryption algorithm
Ciphertext
Plaintext message chosen by cryptanalyst, together with its
corresponding ciphertext generated with the secret key.
■ Chosen ciphertext attack
Encryption algorithm
Ciphertext
Purported ciphertext chosen by cryptanalyst, together with its
corresponding decrypted plaintext generated with the secret key
38
CRYPTANALYSIS (Conti…)
■ Brute-force attack
■ A brute-force attack involve trying every possible key until an
intelligible translation of the ciphertext into plaintext is
obtained.
39
Unconditional Security
■ An encryption scheme is unconditionally secure if the
ciphertext generated by the scheme dose not contain enough
information to determine uniquely the corresponding plaintext,
no matter how much ciphertext is available.
40
Computational Security
The time required to break the cipher exceeds the useful lifetime
of the information.
41
Monoalphabetic cipher
■ With only 25 possible keys, the caesar cipher is far from the
security
42
English Letter Frequencies
43
cryptanalysis
44
cryptanalysis
■ given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
45
cryptanalysis
■ Frequency of 15 common diagrams in English text.
■ guess ZW is th and hence ZWP is the
46
Machine cipher
■ Jefferson cylinder
47
Machine cipher
■ Rotor-based machines
48
Machine cipher (Conti…)
49
Steganography
■ Steganography is the art and science of writing hidden messages in
such a way that no one apart from the intended recipient knows of
the existence of the message.
■ Cryptography relies on transformation algorithms using key to
scramble a message.
■ Steganography takes one piece of information and hides it within
another.
■ Both are used to protect information but steganography is concerned
with hiding information thereby making it unseen while
cryptography is concerned with encrypting information thereby
making it unreadable.
■ Some example of steganography from the past are:
■ Character marking: where selected letters of text are overwritten
with a special pencil. The marks are ordinarily not visible unless the
paper is held at an angle to bright light.
■ Use of invisible ink.
■ Pin punctures.
50
Steganography (Conti…)
■ Audio steganography
■ Video steganography
■ Textual steganography
■ Real-time steganography
51
TOPICS
52
Practical Assignment
53