Fr. C.
Rodrigues Institute of Technology, Vashi, Navi-Mumbai
Department of Computer Engineering
Cryptography and System Security (CSS)
CSC602
By
Mrs. Smita Rukhande
1
Chapter 1- Introduction to Number Theory & cryptography
Classical Encryption techniques –
substitutiontechniques: mono-alphabetic (Caesar) and poly-
alphabetic (Vigenère cipher, Playfair cipher)
transposition techniques : keyed and keyless transposition ciphers
2
Classical Encryption techniques
(Symmetric encryption or conventional encryption or single key
encryption was only type of encryption in use prior to the
development of public key encryption in the 1970s.)
3
What is Cryptography?
Cryptography derived its name from a Greek word called
“Kryptos” which means “Secrets writing”.
Cryptography is the practice and study of hiding information.
It is the Art or Science of converting a plain intelligible data into
an unintelligible data and again retransforming that message into
its original form.
4
How cryptography works?
5
Some Basic Terminology
• plaintext - original message
• ciphertext - coded message
• cipher - algorithm for transforming plaintextto ciphertext
• key - info used in cipher known only to sender/receiver
• enciphering or encryption – process of converting plaintext tociphertext
• deciphering or decryption - recovering plaintext from ciphertext
• cryptography - study of encryption principles/methods
• cryptanalysis (codebreaking) - study of principles/ methods of deciphering ciphertext
without knowing key (breaking the code).
• cryptology - field of both cryptography andcryptanalysis
6
Symmetric Cipher Model
Plaintext - original message that will be fed to the encryption algorithm as an input.
Encryption algorithm - performs various substitutions and transformations on the
plaintext.
Secret key - a value independent of the plaintext and of the algorithm.
The exact substitutions and transformations performed by the algorithm depend on the
key.
Fig- Simplified Model of Symmetric Encryption
7
Encryption Requirements
a strong encryption algorithm
a secret key known only to sender / receiver
8
Model of Symmetric Encryption
Figure - Model of Symmetric Cryptosystem
9
Cryptography
Dimension used to describe cryptographic system :
type of operations used for transforming plaintext to ciphertext
(classical techniques)
Substitution
Transposition
number of keys used
Symmetric, single-key, secret-key, or conventional encryption.
Asymmetric, two-key, or public-key encryption.
way in which plaintext is processed
Block cipher
Stream cipher
10
X X X X X X 12
Classical Encryption Techniques
• or conventional / private-key / single-key.
• sender and recipient share a common key.
• all classical encryption algorithms are private-key.
• was only type prior to invention of public-key in 1970’s.
• The only security service (Classical Encryption Techniques)
these systems provide is confidentiality of information.
• Unlike modern systems which are digital and treat data as binary
numbers, these systems worked on alphabets as basic element.
13
Classical Encryption Techniques
(letters are (letters are
replaced by arranged in a
other letters) different order)
Substitution ciphers are Transposition ciphers are
• Monoalphabetic cipher • keyless
• Polyalphabetic cipher • keyed
15
Groups of substitution cipher are
Monoalphabetic cipher is a substitution cipher in which a character (or a symbol) in the
plaintext is always replaced by the same character (or symbol) in the ciphertext irrespective
of its position in the text.
• For example, if ‘A’ is encrypted as ‘D’, for any number of occurrence in that plaintext,
‘A’ will always get encrypted to ‘D’.
• Monoalphabetic cipher include additive (or shift cipher or Caesar cipher ),
multiplicative, affine cipher
• Relation between letters in the PT & CT is one to one.
Polyalphabetic Cipher is a substitution cipher in which the cipher alphabet for the
plaintext alphabet may be different at different places during the encryption process.
• The relationship of a character in the PT & CT is one-to many.
• Playfair, Vigenère and Hill Cipher are polyalphabetic ciphers.
16
Mono Alphabetic Ciphers
Example
The following shows a plaintext and its corresponding ciphertext. The cipher is
monoalphabetic because both l’s are encrypted as O’s.
Example
The following shows a plaintext and its corresponding ciphertext. The cipher is not
monoalphabetic because each l is encrypted by a different character.
17
Substitution technique: 1. Shift Cipher or Additive cipher or Caesar cipher
The plaintext and ciphertext consist of uppercase letters (A to Z) only.
In this cipher, the encryption algorithm is “shift key characters down”, with key equal
to some number.
The decryption algorithm is “shift key characters up”.
For example, if the key is 5, the encryption algorithm is "shift 5 characters down"
(toward the end of the alphabet).
The decryption algorithm is "shift 5 characters up" (toward the beginning of the
alphabet).
If we reach the end or beginning of the alphabet, wrap around.
Julius Caesar used the shift cipher to communicate with his officers. For this reason, the
shift cipher is sometimes referred to as the Caesar cipher.
Caesar used a key of 3 for his communications.
18
Shift Cipher
Example - Use the shift cipher with key= 15 to encrypt the message "HELLO”
Solution
• Encrypt one character at a time.
• Each character is shifted 15 characters down.
• Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted
to A. The second L is also encrypted to A. And O is encrypted to D.
• The cipher text is WTAAD.
19
Shift Cipher
Example- Use the shift cipher with key = 15 to decrypt the message “WTAAD.”
Solution
• Decrypt one character at a time.
• Each character is shifted 15 characters up.
• Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted
to L. The second A is decrypted to L. And, finally , D is decrypted to O.
• The plaintext is HELLO.
20
Substitution technique: Caesar Cipher/ Additive Cipher/ Shift Cipher
• This technique is proposed by Julius Caesar.
• This is substitution cipher technique in which each letter in the plaintext
is replaced by a letter standing three places further down the alphabet.
• It is also called monoalphabetic cipher / additive cipher.
• This cipher is sometimes called as Shift Cipher.
• This encryption algo adds the key to the PT character, the decryption
algorithm subtracts the key from the CT character.
21
Caesar Cipher/ Additive Cipher/ Shift Cipher
22
Caesar Cipher
Then the algorithm can be expressed as follows
C = E (p, 3) = (p + 3) mod 26
Shift may be of any amount, then general Caesar cipher algorithm is
C = E (p, k) = (p + k) mod 26
The decryption algorithm
p = D (C, k) = (C - k) mod 26
23
Caesar Cipher
replaces each letter by 3rd letter on or shifting of letters is based on key value ie 3.
Assign a number to each letter
can define transformation as:
example: (key=3)
PT - meet me after the toga party
CT- PHHW PH DIWHU WKH WRJD SDUWB
24
Example:
Use the additive cipher or Caesar Cipher with key=15 to encrypt the message
“hello”
Solution
Encrypt one character at a time. Each character is shifted 15 characters down. Letter H is
encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also
encrypted to A. And O is encrypted to D.
The cipher text is WTAAD
C = E (p, k) = (p + k) mod 26
25
Example- Use the shift cipher with key = 15 to decrypt the message “WTAAD.”
Decryption
Note-: the operation is in modulo 26 which means that a –ve result
needs to be added to Z (26)
(eg-: -15 becomes 11)
p = D (C, k) = (C - k) mod 26
(00-15)mod 26 = -15 +26=11
26
Qu- Why we called additive cipher as shift cipher or Caesar cipher?
Caesar cipher-: Julius Caesar used an additive cipher to communicate
with the officers. For this reason additive ciphers are sometimes referred
to as Caesar cipher. Caesar used a key of 3 for his communication.
Shift cipher-: the reason is that the encryption algorithm can be
interpreted as “shift key characters down” and decryption algorithm can
be interpreted as “shift key characters up” .
Example-: Eve has intercepted the CT “UVACLYFZLJBYL” what is
the plain text?
27
Security Value of Caesar Cipher
Disadvantages-
• Caesar Cipher is not a secure cryptosystem because if it is known
that a given ciphertext is a Caesar cipher, then a brute-force
cryptanalysis is easily performed. simply try all the 25 possible keys.
• With only 25 keys , this method is not secure.
Three important characteristics of this problem enabled us to use a brute
force cryptanalysis:
1. The encryption and decryption algorithms are known.
2. There are only 25 keys to try.
3. The language of the plaintext is known and easily recognizable.
28
Example-
Eve has intercepted the ciphertext “UVACLYFZLJBYL”. Show how
she can use a brute-force attack to break the cipher.
Solution
Eve tries keys from 1 to 7. With a key of 7, the plaintext is “not very
secure”, which makes sense.
29
Multiplicative cipher
In a Multiplicative cipher the Encryption algo specifies multiplication of PT
by the key & Decryption algorithm specifies division of the CT by the key.
P =(C
Decryption here means multiplying by the multiplicative inverse of the key.
So encryption & decryption are inverse of each other.
30
Encryption
Example
Use a multiplicative cipher to encrypt the message “hello” with a key of 7.
The ciphertext is “XCZZU”.
Example
PT = Saturday
Key = 5 CT =?
(Ans-MARWHPAQ)
31
Decryption
Example
Use a multiplicative cipher to decrypt the ciphertext “XCZZU” with a key
of 7.
the multiplication inverse of the key (where the multiplication inverse of 7 is 15 )
32
To find inverse modulo
Example – to find 𝟕−𝟏 mod 26
Step 1-
1= x * 7 – y *26 first find out x and y values
for that write table of 7 and 26 so value of x is 15
in table of 7 and y is 4 in table of 26.
So 1= 15* 7 – 4 *26
1= 105 -104
So 𝟕−𝟏 mod 26 is 15 (ie. x=15 in above equation)
33
Affine cipher
• combine additive & multiplicative ciphers to get affine cipher.
• A combination of both ciphers with pair of keys.
• For Encryption- The first key is used with the multiplicative cipher the second key is
used with the additive cipher.
The additive cipher is a
special case of an affine
cipher in which k1 = 1.
The multiplicative cipher
is a special case of affine
cipher in which k2 = 0.
34
Use an affine cipher to encrypt the message “hello” with the key pair (7, 2).
Example Modular arithmetic properties:
1. [(a mod n) + (b mod n)] mod n = (a + b) mod n
2. [(a mod n) - (b mod n)] mod n = (a - b) mod n
3. [(a mod n) * (b mod n)] mod n = (a * b) mod n
The additive cipher is a special case of an affine cipher in which
k1 = 1. The multiplicative cipher is a special case of affine cipher in
which k2 = 0.
35
Example
Use the affine cipher to decrypt the message “ZEBBW” with the key pair (7, 2) in modulus 26.
Modular arithmetic properties:
1. [(a mod n) + (b mod n)] mod n = (a + b) mod n
Solution 2. [(a mod n) - (b mod n)] mod n = (a - b) mod n
3. [(a mod n) * (b mod n)] mod n = (a * b) mod n
The additive cipher is a special case of an affine cipher in which
k1 = 1. The multiplicative cipher is a special case of affine cipher in which k2 = 0.
36
37