Cryptography PDF
Cryptography PDF
Cryptography
&
Cipher Algorithms
By
S.Meenatchisundaram
CONTENTS
ENCRYPTION
PLAIN TEXT ALGORITHM
CIPHER TEXT
KEY
KEY
Principles of Security
Confidentiality
Authentication
Integrity
Access control
Availability
Confidentiality
A sends a message to the user B. Another user
C gets access to this message, which is not
desired, defeats the purpose of confidentiality.
This type of attack is known as interception.
A B
C
Authentication
C sends a message to the user B, as if it is send
by user A. This type of attack is known as
Fabrication.
A I am B
User A
C
Integrity
User C tampers with a message originally sent by
user A, which is actually destined to B. User C
somehow manages to access it, change its
contents, and send the changed message to user B.
This type of attack is known as modification.
Ideal Route
A B
Transfer
Transfer
1000Rs. To
100Rs. To
C C
D
Availability
Intentional actions of unauthorized user C, an
authorized user A may not be able to contact a
user B. This type of attack is known as
interruption.
A B
C
Types of cryptography
Substitution Techniques
• Caesar Cipher
• Mono-alphabetic Cipher
• Homophonic Substitution Cipher
• Poly-alphabetic Substitution Cipher
Transposition Techniques
• Rail Fence Technique
• Simple Columnar Transposition Technique
• Simple Columnar Transposition Technique with
Multiple rounds
• Vernam Cipher
In substitution cipher, the characters of plain text message are
replaced by other characters, numbers or symbols.
Caesar Cipher
A character in the plain text can be shifted down or up by a
corresponding number. (Ex. A can be replaced with B, B can be
replaced with C, etc).
Mono-alphabetic Cipher
In Mono-alphabetic Cipher, any character of plain text can be
replaced by any other character. Ex A can be replaced by any
other character (B to Z).
The possible combinations now become 4 x 1026.
Homophonic Substitution Cipher
Homophonic substitution is also involves substitution of one
plain text character with a cipher text character at a time,
however the cipher text character can be any one of the chosen
set. (A can be replaced by D,H,P,R; B can be replaced by
E,I,Q,S, etc)
Polygram Substitution Cipher
It replaces one block of plain text with a block of cipher text. It
does not work on a character by character basis. (Ex. HELLO
could be replaced by YUQQW, but HELL could be replaced by a
totally different cipher text block TEUI)
TRANSPOSITION TECHNIQUES
Rail fence technique
It involves writing plain text as sequence of diagonals and
then reading it row by row to produce cipher text.
Let the original plain text is COME HOME TOMORROW.
C M H M T M R O
O E O E O O R W
C O M E H O
M E T O M O
R R O W
Plain Text H O W A R E Y O U
7 14 22 0 17 4 24 14 20
13 2 1 19 25 16 0 17 23
One time Pad
N C B T Z Q A R X
Initial Total 20 16 23 19 42 20 24 31 43
Algorithm detail
Block size(s) 64 bits
Key size(s) 56 bits
Structure Feistel network
Number of rounds 16
Data Encryption Standard (DES)
DES is a symmetric cryptosystem: when used for
communication, both sender and receiver must know
the same secret key, which is used both to encrypt
and decrypt the message.
DES can also be used for single-user encryption, such
as to store files on a hard disk in encrypted form.
In a multi-user environment, secure key distribution
may be difficult; public-key cryptography provides an
ideal solution to this problem.
DES has a 64-bit block size and uses a 56-bit key
during encryption. It is a 16-round Feistel cipher and
was originally designed for implementation in
hardware.
Various proposals for a DES-cracking machine were advanced.
In 1977, Diffie and Hellman proposed a machine costing an
estimated US$20 million which could find a DES key in a single
day.
By 1993, Wiener had proposed a key-search machine costing
US$1 million which would find a key within 7 hours. The
vulnerability of DES was practically demonstrated in the late
1990s.
In 1997, RSA Security sponsored a series of contests, offering a
$10,000 prize to the first team that broke a message encrypted
with DES for the contest. That contest was won by the
DESCHALL Project, led by Rocke Verser, Matt Curtin, and Justin
Dolske, using idle cycles of thousands of computers across the
Internet.
The feasibility of cracking DES quickly was demonstrated in 1998
when a custom DES-cracker was built by the Electronic Frontier
Foundation (EFF), a cyberspace civil rights group, at the cost of
approximately US$250,000. Their motivation was to show that
DES was breakable in practice as well as in theory.
Data Encryption Standard (DES)
64 bit 64 bit
Cipher Text Cipher Text
BLOCK
Block 1 Block 2
n
Data Encryption Standard (DES)
E – Expansion Permutation
S – S box Permutation
P – P box Permutation Key Transformation
Cipher Text (64 Bits)
The Feistel (F) function
1. Expansion — the 32-bit half-block is expanded to 48 bits
using the expansion permutation, denoted E in the diagram,
by duplicating some of the bits.
2. Key mixing — the result is combined with a subkey using
an XOR operation. Sixteen 48-bit subkeys — one for each
round — are derived from the main key using the key
schedule.
3. Substitution — after mixing in the subkey, the block is
divided into eight 6-bit pieces before processing by the S-
boxes, or substitution boxes. Each of the eight S-boxes
replaces its six input bits with four output bits according to a
non-linear transformation, provided in the form of a lookup
table. The S-boxes provide the core of the security of DES —
without them, the cipher would be linear, and trivially
breakable.
4. Permutation — finally, the 32 outputs from the S-boxes
are rearranged according to a fixed permutation, the P-box.
Data Encryption Standard (DES)
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 26 27 28 29 30 31 32
Plain Text (64 bit)
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
Input Permutation (IP) 64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7
EXPANSION PERMUTATION
Original Plain text will be divided into two blocks with 32bit
each called as RPT & LPT.
Considering RPT or LPT, it is divided further into 8 blocks,
with each block consisting of 4 bits.
Each 4 bits will be added with 2 bits as shown in the figure
to get a 48 bit text with 8 blocks each with 6 bits.
1 2 3 4 5 6 7 8 29 30 31 32
1 2 3 4 5 6 7 8 9 10 11 12 43 44 45 46 47 48
Key Transformation
Step1: The multiples of 8th bit will be discarded to get a 56 bit key.
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 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
57 49 41 33 25 17 9 1
58 50 42 34 26 18 10 2
59 51 43 35 27 19 11 3
60 52 44 36 0 0 0 0
Step3 - 16: Repeat step 2
63 55 47 39 31 23 15 7
62 54 46 38 30 22 14 6
61 53 45 37 29 21 13 5
28 20 12 4 0 0 0 0
International Data Encryption Algorithm (IDEA)
General
Algorithm detail
K1
ROUND 1
K6
K7
ROUND 2
K12
K43
ROUND 8
K48
K49
OUTPUT TRANSFORMATION
K52
MODULO
216 + 1
MULTIPLICATION
MODULO
216
ADDITION
International Data Encryption Algorithm (IDEA)
K1 K2
K2 K2
Algorithm detail
Block size(s) 32, 64 or 128 bits (64 suggested)
Key size(s) 0 to 2040 bits (128 suggested)
Structure Feistel network
Number of rounds 12 suggested originally
RC 5
RC5 has a variable block size (32, 64 or 128 bits),
key size (0 to 2040 bits) and
number of rounds (0 to 255).
C = A+s[0]; D= B+s[1]
E=C D G=D F
F = E + s[2i] H = G + s[2i+1]
Increment i by 1
C = F; D = H Check is Stop
i>r?
SUB KEY GENERATION