0% found this document useful (0 votes)
27 views

Cryptographic Algorithms

Uploaded by

Rohaan kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Cryptographic Algorithms

Uploaded by

Rohaan kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Cryptographic Techniques

Gautam Kumar, PhD


Model of Security
Some Basic Terminology
• Plaintext - original message

• Ciphertext - coded message

• Cipher - algorithm for transforming plaintext to ciphertext

• Key - info used in cipher known only to sender/receiver

• Encipher (encrypt) - converting plaintext to ciphertext

• Decipher (decrypt) - recovering plaintext from ciphertext

• Cryptanalysis (Code Breaking) - study of principles/


methods of deciphering ciphertext without knowing key
Characteristics of Cryptography

• characterize cryptographic system by:


– type of encryption operations used
• substitution / transposition / product
– number of keys used
• single-key or private / two-key or public
– way in which plaintext is processed
• block / stream
Symmetric Encryption
• conventional / private-key / single-key

• sender and recipient share a common key

• all classical encryption algorithms are private-key

• It is useful to encrypt files on your computer, and


intend to decrypt them at yourself. It is less useful
if you intend to send them to someone else to be
decrypted, because in that case you have a "key
distribution problem“.
Symmetric Cipher Model

Figure-1
-2
Requirements
• Two requirements for secure use of symmetric
encryption:
– a strong encryption algorithm
– a secret key known only to sender / receiver
• Mathematically have:
Y = EK(X)=E( K, X)
X = DK(Y)=D( K, Y)
• Assume encryption algorithm is known
• Implies a secure channel to distribute key
Type of Ciphers
• Transformation: Replace, Reverse, Case Transform, Numeral
System, Bitwise Operation

• Alphabets: Morse Code, Spelling alphabet

• Ciphers: Enigma Machine, Caesar Cipher, Affine Cipher, ROT13,


A1Z26, Vigenere Cipher, Bacon Cipher, Alphabetical
Substitution, Rail Fence Cipher

• Polybius Square Ciphers: Polybius Square, ADFGX cipher, Bifid


Cipher, Tap Code, Trifid Cipher

• Encoding: Base32, Base64, ASCII85, Bootstring

• Modern Cryptography: Block Cipher, RC4, Hash Function, HMAC


Classical Substitution Ciphers
• where letters of plaintext are replaced by
other letters or by numbers or symbols
• or if plaintext is viewed as a sequence of bits,
then substitution involves replacing plaintext
bit patterns with ciphertext bit patterns
Caesar Cipher
• earliest known substitution cipher, by Julius
Caesar
• replaces each letter by 3rd letter on
• example:
PT: MEET ME AFTER THE TOGA
PARTY
CT: PHHW PH DIWHU WKH WRJD SDUWB
• Mathematically, Caesar cipher as:
c = E(k,p) = (p + k) mod (26)
p = D(k,c) = (c – k) mod (26)
Cryptanalysis of Caesar Cipher
• only have 26 possible ciphers
– A maps to A,B,..Z
• could simply try each in turn
• a brute force search
• given ciphertext, just try all shifts of letters
• do need to recognize when have plaintext
• eg. break ciphertext
" PHHW PH DIWHU WKH WRJD SDUWB "
Significance with Different Perspective

1. If the language of the plaintext in unknown,


then plaintext output may not recognize.

2. The input if abbreviated or compressed in


some fashion, again making recognition
difficult.
Monoalphabetic Cipher
• rather than just shifting the alphabet
• could shuffle (jumble) the letters arbitrarily
• each plaintext letter maps to a different random
ciphertext letter
• hence key is 26 letters long
Plain:
abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext:
ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher Security
• now have a total of 26! = 4 x 1026 keys
• with so many keys, might think is secure
• but would be !!!WRONG!!!
• problem is language characteristics
Language Redundancy and Cryptanalysis

• human languages are redundant


• letters are not equally commonly used
• in English E is by far the most common letter
– followed by T,R,N,I,O,A,S
• other letters like Z,J,K,Q,X are fairly rare
• have tables of single, double & triple letter
frequencies for various languages
English Letter Frequencies
Example Cryptanalysis
• given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
• count relative letter frequencies (see text)
• guess P & Z are e and t
• guess ZW is th and hence ZWP is the
• proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made with political
representatives of the viet cong in moscow
Playfair Cipher
• One approach to improving security is to
encrypt multiple letters

• The Playfair Cipher is an example

• Invented by Charles Wheatstone in 1854, but


named after his friend Baron Playfair
Playfair Key Matrix
• a 5X5 matrix of letters based on a keyword
• fill in letters of keyword
• fill rest of matrix with other letters
• eg. using the keyword MONARCHY

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
PlayFair Cipher: Encrypting and Decrypting
Plaintext is encrypted two letters at a time, according to the
rules as shown..
1. if a pair is a repeated letter, insert a filler like 'X', eg. "balloon"
encrypts as "ba lx lo on"
2. if both letters fall in the same row, replace each with letter to
right (wrapping back to start from end), eg. “ar" encrypts as
"RM"
3. if both letters fall in the same column, replace each with the
letter below it (again wrapping to top from bottom), eg. “mu"
encrypts to "CM"
4. otherwise each letter is replaced by the one in its row in the
column of the other letter of the pair, eg. “hs" encrypts to "BP",
and “ea" to "IM" or "JM" (as desired)
Decrypting works exactly in reverse.

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
Security of Playfair Cipher
• security much improved over monoalphabetic
• since have 26 x 26 = 676 digrams
• would need a 676 entry frequency table to analyse
(verses 26 for a monoalphabetic)
• and correspondingly more ciphertext
• was widely used for many years
– eg. by US & British military
• it can be broken
One-Time Pad
• if a truly random key as long as the message is used,
then cipher will be secure, called a One-Time pad

• is unbreakable since ciphertext bears no statistical


relationship to the plaintext

• can only use the key once though

• problems in generation & safe distribution of key


One-Time Pad
ENCRYPTION
PT J U I T W A K N A
Example 9 20 8 19 22 0 10 13 0
Key C K M N Z O P K A
2 10 12 13 25 14 15 10 0
TOTAL=PT+KEY 11 30 20 32 47 14 25 23 0
TOTAL%26 11 4 20 6 21 14 25 23 0
CT L E U G V O Z X A

DECRYPTION
CT L E U G V O Z X A
11 4 20 6 21 14 25 23 0
Key C K M N Z O P K A
2 10 12 13 25 14 15 10 0
TOTAL=CT-KEY 9 -6 8 -7 -4 0 10 13 0
TOTAL%26 9 20 8 19 22 0 10 13 0
CT J U I T W A K N A
Polyalphabetic Ciphers
Polyalphabetic substitution ciphers
• write the plaintext out
• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
• eg using keyword deceptive
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Autokey Cipher
• If the key is not as long as message, then staring from
the plaintext it acts in key
• eg. given key deceptive
key:
deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: Z ICV TWQNGKZE I IGASXSTSLVVWLA
Transposition Ciphers
• Transposition ciphers or permutation ciphers
hide the message by rearranging the letter
order
• without altering the actual letters used
• The core idea is to rearrange the order of
basic units (letters/bytes/bits) without altering
their actual values.
Rail Fence cipher
• write message letters out diagonally over a number
of rows
• then read off cipher row by row
• eg. write message out as:
m e m a t r h t g p r y
e t e f e t e o a a t
• giving ciphertext
MEMATRHTGPRYETEFETEOAAT
Row Transposition Ciphers
• a more complex transposition
• write letters of message out in rows over a
specified number of columns
• then reorder the columns according to some
key before reading off the rows
Key: 4 3 1 2 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Product Ciphers
• ciphers using substitutions or transpositions are not
secure because of language characteristics
• hence consider using several ciphers in succession to
make harder, but:
– two substitutions make a more complex substitution
– two transpositions make more complex transposition
– but a substitution followed by a transposition makes a new
much harder cipher
• this is bridge from classical to modern ciphers

You might also like