CH 3
CH 3
CRYPTOGRAPHY
Introduction:-
Cryptography is a method of storing and transmitting data in a particular form so that only those for
whom it is intended can read and process it. OR
The art of protecting information by transforming it (encrypting it) into an unreadable format,
called cipher text. Only those who possess a secret key can decipher (or decrypt) the message into
plain text.
Cryptography system
Cryptography played an important role in World War II. In the years preceding the war, both the
Allies as well as the Germans were investing heavily in building cryptosystems. Many of these
systems were based on a combination of mechanical and electronic systems.
Application of cryptography:-
It is used
Symmetric cipher
Asymmetric cipher
insecure
Message channel
Message
In this same key is used for encryption & decryption.Hence also called as
single key/secret key/shered key technique.
This key is shared between sender & receiver & known to only sender & receiver & no one else.
Fig. Symmetric cryptography
Difference between
6.
SUBSTITUTION CIPHER:-
A substitution technique is the one in which the one in which the letters of plain text are replaced
by other letters or by numbers or symbols.
1. Caesar cipher
2. Play fair cipher
3. Hill cipher
1. Caesar cipher:- it involves replacing each letter of alphabet with the letter standing 3 places
down the alphabet. i.e.
Replacement table
plain a b c d e f g h i j k l m
cipher d e f g h i j k l m n o p
plain n o p q r s t u v w x y z
cipher q r s t u v w x y z a b c
Cipher text a i p g s g i
Value of k
1 b j q h t r j
2 c k r i u s k
3 d l s j v t l
4 e m t k w u m
5 f n u l x v n
6 g o v m y w o
7 h p w n z x p
8 i q x o a y q
9 j r y p b z r
10 k s z q c a s
11 l t a r d b t
12 m u b s e c u
13 n v c t f d v
14 o w d u g e w
15 p x e v h f x
16 q y f w i g y
17 r z g x j h z
18 s a h y k i a
19 t b i z l j b
20 u c j a m k c
21 v d k b n l d
22 w e l c o m e
23 x f m d p n f
24 y g n e q o g
25 z h o f r p h
We can see that cipher text shown in first row of fig. needs maximum 25 different attempts to
break according to algorithm.
22nd attempt reveals to break plain text.
In this one plaintext alphabet can be mapped to more than one cipher text alphabet. E.g. A can be
replaced by [D, H, P, R ]. B can be replaced by [E, I, Q, S ]
It involves substitution of one plain text character with a cipher text character can be any one of
chosen set.
In this rather than replacing one plain text with one cipher text at a time, a block of alphabet is
replaced with another block.
E.g. hello replaced with YVQQW. Hell replaced with TXUG with totally different scheme.
RULES:-
1. Split the plain text as a group of 2 letters.
2. All letters written in lowercase and without punctuation.
3. If group contain repeated plain text letter then they are separated with filler letter x.
e.g. balloon ba l l oo n
ba lx lo on
4. If a single letter remains at the end to attached with z
5. If 2 plaintext letters fall in same row of matrix then each letter is replaced by letter to the right.
6. If 2 plaintext letters fall in same column of matrix then each letter is replaced by letter below it
7. If 2 plaintext letter not in same row or same column then each plain text letter that is present in his
row but column occupied by the other letter in plain text letter.
Preparing matrix
1. 5 * 5 matrix
p l a y f
i r e x m
b c d g h
k n o q S
t u v w z
Encryption example
1. Plain text is MIT POLYTECHNIC
p l a y f
i r e x m
b c d g h
k n o q S
t u v w z
Cipher text = IR PI NA PW RD CS RB
Hill Cipher
Hill cipher works on multiple letters at same time.
Encryption process:-
1. First convert the key word into key matrix (2*2) or (3*3).It keyword not provide select any
random key matrix.
2. Convert plaintext into diagraph for 2*2 key matrix or trigraph for 3*3 key matrix.
3. Number the plain text alphabets in diagraph or trigraph (A=0……Z=25)
4. Multiply two matrices, plain text matrix and key matrix
5. Perform mod26 of above resultant matrix.
6. Again translate the numbers to alphabets to get cipher text.
Example:-
Keyword = HILL
Plaintext= java.
(09) (21
0
)
4. Perform multiplication with following rules
𝑎 𝑏 𝑥 𝑎𝑥 + 𝑏𝑦
( )( ) = ( )
𝑐 𝑑 𝑦 𝑐𝑥 + 𝑑𝑦
5. Consider
9 7 8 7∗9 + 8∗0 63
( )( )=( )= ( )
0 11 11 11 ∗ 9 + 11 ∗ 0 99
6. Perform mod 26 of above 26 resultant matrix that is take the remainder after dividing above
matrix value by 26
63 11
( ) 𝑚𝑜𝑑 26 = ( )
99 21
147
10. (
231
) 𝑚𝑜𝑑 26 = (17
23
)
11. 17 R 23 X
Transposition Techniques
Transposition technique performs some permutations over the plain text alphabet.
1) Rail Fence technique:-
Algorithm=
Example=
Cipher text=cmhmtmrooeoeoorw
Algorithm :-
Example:-
One N C B T Z Q A R X
time pad
13 2 1 19 25 16 0 17 23
After 20 16 23 19 42 20 24 31 43
addition
Subtract -26 -26 -26
26 if >25
total 20 16 23 19 16 20 24 5 17
Cipher V Q X T Q V Y F R
text
Algorithm -
1. Take key.
2. Write the plain text row wise & divided into key length number of columns
3. Arrange the key in alphabetical order so accordingly order the columns
4. Read cipher text column wise
5. To complete the table plain text is padded with X.
G I V E N
t h e s i
m p l e s
t p o s s
i b l e c
i p h e r
i s x x x
Arrange key in alphabetical order
Key = eginv
E G I N V
s t h i e
e m p s l
s t p s o
e i b c l
e i p r n
x i s x x
Steganography
It is the technique of hiding one message inside other message.
Steganography process
Thus secret message is hidden in cover medium without compromising its integrity. By encrypting it
using stego key. Finally we get stego medium which contain hidden message.
Techniques of Stenography
1. Character marking – in this selected letters of text are overwritten using pencil.
2. Invisible ink – a number of substances can be used for writing but leave no visible trace until
heat or some chemical.
3. Pin punctures – small pin punctures of selected letters are not visible unless paper is held in
front of light.
4. Wax tablets in wooden frame
5. Message below postal stamp
6. Typewriter ribbon – double typed alphabets
7. Knitting yarn
Advantages of steganography
1) It can be employed by parties who have something to lose should the fact of their secret
communication be discovered.
2) Steganography can protect both the message & communication parties.
Disadvantages of steganography
Applications
Digital signature
- It is an electronic signature.
- It is authentication mechanism used to authenticate identity of the sender.
OR
Digital signature is a digital code (generated & authenticated by public key encryption) which
is attached to an electronically transmitted document to verify its contents & the senders
identity.
- Digital signature is based on both hashing function & asymmetric cryptography.
- Digital signature is easily transportable & cannot be imitated by someone else. & can be
automatically time stamped.
Digital signature must be a bit pattern with such a information which is unique to the sender. This
information helped to prevent forgery and denial.
Authenticity The digital signature helps ensure that the signer is who he or she claims to be.
This helps prevent others from pretending to be the originator of a particular document (the
equivalent of forgery on a printed document).
Integrity The digital signature helps ensure that the content has not been changed or
tampered with since it was digitally signed. This helps prevent documents from being
intercepted and changed without knowledge of the originator of the document.
Non-repudiation The digital signature helps prove to all parties the origin of the signed
content. "Repudiation" refers to the act of a signer's denying any association with the signed
content. This helps prove that the originator of the document is the true originator and not
someone else, regardless of the claims of the signer. A signer cannot repudiate the signature on
that document without repudiating his or her digital key, and therefore other documents signed
with that key.
Working of digital signature
It consist of 2 processes
-Digital certificate is a data with digital signature from one trusted certification authority. (CA)
CA – Certification authority is trusted agent who certifies public keys for general use.
On input of message, public key & signature, either accepts or rejects the messages
claim to authenticity.
Example:-
Assume you were going to send the draft of a contract to your lawyer in another town. You
want to give your lawyer the assurance that it was unchanged from what you sent & that it is really
from you.
Advantages:-
1. Speed
In business no longer have to wait for paper document to be sent by couriers using DS contracts
are easily written completed & signed by all concerned parties in less time.
2. Cost
Postal or courier service for paper document is much more expensive as compared using DS.
3. Security:-
Use of DS & electronic document reduces risk of document being intercepted read, destroyed.
4. Authenticity:-
An electronic document signed with DS can stand up in court just as well as any other signed
paper document
5. Non-Republication:-
6. Tracking:-
Digitally signed document can be easily tracked & located in short amount of time.
Disadvantages:-
Wherer =
M message s signature
H Hash function r (gk mod p)mod q (key pair)
Sig signature PUa Public key of sender
PRa Private key of sender Ver Verification function
PUG set of global public key compare Compare function
Electronic mail.
Electronic fund transfer.
Electronic data interchange.
Software distribution.
Data storage.
Authentication protocol
It is used between a dial-in client & server to determine what authentication protocol will be
used. He Extensible Authentication Protocol (EAP) is a protocol for wireless networks that
expands on authentication methods used by the Point-to-Point Protocol (PPP), a protocol often
used when connecting a computer to the Internet.