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

Notes Cryptography

The document discusses cryptography and information security. It defines encryption as transforming information into an unreadable format called ciphertext, and decryption as reverting ciphertext back to plaintext. There are different types of security like computer, network, and internet security to protect data and information. Security services, mechanisms, and attacks are also covered, along with classical encryption techniques like symmetric encryption which uses a single secret key.

Uploaded by

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

Notes Cryptography

The document discusses cryptography and information security. It defines encryption as transforming information into an unreadable format called ciphertext, and decryption as reverting ciphertext back to plaintext. There are different types of security like computer, network, and internet security to protect data and information. Security services, mechanisms, and attacks are also covered, along with classical encryption techniques like symmetric encryption which uses a single secret key.

Uploaded by

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

CRYPTOGRAPHY

The art of protecting information by transforming it to an unreadable format called


cipher text and this is called encryption. The process of reverting (or) converting the cipher
text to readable format (i.e) the plain text is called decryption. This system is called
cryptographic system (or) design.
 the person who possess a secret key can decrypt the message into plain text. But
for decrypting a message without any knowledge of encrypting details can
sometimes be broken by crypt analysis (i.e) .code breaking.

1.1. SERVICES, MECHANISMS AND ATTACKS

1.2 OSI SECURITY ARCHITECTURE


Security
Computer user requires automated tools to protect files and other stored information.
There are different types of security.

a) Computer Security
The collection of tools designed to protect data to prevent hackers.

b) Network Security
It measures to protect data during data transmission in network.

c) Internet Security
It measures to protect data during their transmission over a collection of
interconnected networks.

d) Information Security
Information should be secured so information security should be against physical
damage and administrative damage.
There are three aspects of information security.
(i) Security Attack
Action that compromises the security of information owned by an organization.

(ii) Security Mechanism


A mechanism that is designed to detect, prevent or recover from a security attack

(iii) Security service


A service that enhances the security of data processing systems and information
transfers. A security service makes use of one or more security mechanisms.

 Consider in reverse order

Security Service:
 X.800- defines security service as service provided by a protocol layer of
communication open systems, which ensures adequate security of the systems or of
data transfers.
 RFC 2828 defines security service as a processing or communication service provided
by a system to give a specific kind of protection to system resources.
 X.800 defines security service in 5 categories
i) Authentication
Assurance that the communication entity is the one claimed
ii) Access control
Prevention of the unauthorized use of a resource.
iii) Data Confidentiality
Protection of data from unauthorized disclosure.
iv) Data Integrity
Assurance that data received are exactly as sent by an authorized entity
v) Non repudiation
Protection againt denial by one of the parties in a communication.

Security Mechanism
X-800 defines security mechanism in many ways
(i) Enciphertext
(ii) Digital Signature
(iii) Access Control mechanisms
(iv) Data Integrity Mechanisms
(v) Authentication Exchange
(vi) Traffic Padding
(vii) Routing Control
(viii) Notorisation

Security Attack:
There are two types of attack
i) Passive attack
A passive attack moniters unencrypted traffic and looks for clear-text passwords
and sensitive information that can be used in other types of attacks.
 Passive attaks are difficult to detect
 It is possible to prevent the passive attack by encryption

Types:
i) Release of message contents
The message transmitted should be prevented from eaves dropping.

ii) Traffic Analysis


Intruder watches the srequency length of message exchanged between the two
principals.

ii) Active attacks


It involve alteration to the data. It's difficult to prevent active attacks Detection can
be recovered from the after effects caused by them.
Types:
i) Masquerade

Attacker

A Internet B

Masqurade occurs when one entity pretends to be a ifferent entity. here the attacker
captures the authentication and impersonifies the sender. Generates and transmits
the message or replay the message

ii) Replay
The attacker captures the message and retranmits the message without any
modification to produce unauthorized effect
C

A Internet B

iii) Modification of Messages


Attacker captures the message and retransmits the message with modification or
delays or reorder the message to produce unauthorized effect.

A Internet B

iv) Denial of Service


This attack has specific target like supress all the messages directed to a user or
disable the network, degrade the performance.

v) Software Attack
Software attacks are those which can be introduced into the systems or networks.
Ex viruses.
1.3 NETWORK SECURITY MODEL
Trusted third party
(e.g: arbiter, distributer of
secret information)

Sender Recipient

Information Security Related


Security Related channel Transformation
Transformation
Secure Message

Secure Message
Message

Message
Secret Secret
information information

Opponent

Fig – 1.3 Network Security Model


This model requires us to
 design a algorithm for the security transformation
 Generate the secret information (keys) used by the algorithm.
 Develop methods to distribute and share the secret information
 Specify a protocol enabling the principals to use the transformation and secret
information for a security service.

1.4 CLASSICAL ENCRYPTION TECHNIQUES


1.4.1 Symmetric Cipher Model
symmetric encryption is also called as conventional encryption or single key
encryption
Symmetric encryption has 5 ingredients

i) Plaintext
It is original intelligible data or message that is fed into the algorithm as input.
Fig -1.4.1 (a) simplified model of symmetric encryption

ii) Encryption algorithm


The encryption algorithm performs various substitutions and transformations on the
plaintext.

iii) Secret Key


The secret key is also input to the encryption algorithm. The key is a value
independent of the plaintext and of the algorithm. The algorithm will produce a different
output depending on the specific key being used at the time. The exact substitution and
transformations performed by the algorithm depend on the key.

iv) Ciphertext
This is the scrambled (or) altered message produced as output. It depends on the plain
text and the secret key. for a given message, two different keys will produce two different
ciphertexts. The ciphertext is an apparently random stream of data and as it is
unintelligible.

v) Decryption algorithm
Encryption algorithm run in reverse it takes the ciphertext and the secret key and
produces the original plain text.

Two requirements of conventional encryption


i) The opponent should know the encryption algorithm well and has access to one or
more ciphertexts would be unable to decipher the cipher text or figure out the key.
This requirement is stated in a stronger form.

 The opponent should be unable to decrypt ciphertext or discover the key even if
he or she is in possession of a number of ciphertexts together with the plain-text
that produced each ciphertext.

ii) Sender and receiver should have secret key copies in a secure way. If key is
discovered, then all communication using this key is readable.

Assumption
It is not possible to decrypt a message on the basis of the ciphertext plus knowledge of
the encryption/decryption algorithm. For this, key should be secured (i.e̵.) manufactures have
developed low-cast chip implementations of data encryption algorithms. These chips are
incorporated into a number of products.

Solution
By usin`g symmetric encryption, the principal security problem is maintaining the
key secrecy

Symmetric Encryption Scheme

Fig - 1.4.1 (b) model of Symmetric Cryptosystem

A Source produces a message in plaintext, X =[X1, X2,....Xm]. The M elements of X


are letters in some finite alphabets. Even binary alphabet {O,1} is also used, For encryption; a
key K=[K1, K2,...Kj] is generated. If key is generated to source, then key should be provided
to the destination by means of secure channel. Alternatively, third party generate and deliver
key securely to both source and destination

Working
 with the message X and encryption key K as input, encryption algorithm forms
the ciphertext Y=[Y1,Y2,....YN], can be written as Y=E(K,X).
 Y is produced by using encryption algorithm E as a Function of the plaintext X,
with the specific function determined by the value of the key k.
 The receiver in possession of the Key is able to invert the transformation
X=D (K,Y)
 opponent observing Y but no access to k or X, but attempt to recver X or K or both
X and K

Assume
An opponent knows the Encryption and Decryption algorithms. If the opponent wants
to know one particular message, then he/ she recover x by generating a plaintext estimate x.

1.4.1.1. Cryptography
Cryptographic systems characterization
(i) The type of operations used for transforming plaintext to ciphertext
Encryption algorithms based on 2 principles
a substitution
Each element in plaintext is mapped into another element.
b) Transposition
Elements in the plaintext are rearranged.
Basic requirement is that no information be lost.
(ii) The number of Keys used
a) If sender and receiver use the same key, the system is referred to as symmetric,
single-key, secret key, or conventional encryption.
b) If sender and receiver use different keys, the system is referred to as
asymmetric, two-key, or public-key encryption.
(iii)The way in which plaintext is processed
a) A block cipher process the input (i.e) one block of element at a time,
producting an output block for each input block.
b) A stream cipher processes the input elements continuously, producing output
one element at a time.

1.4.1.2 Cryptanalysis And Brute-Force Attack


The objective of attacking an encryption system is to recover the key. There are two
approaches to attacking a symmetric encryption schemes

(I) Cryptanalysis
This attacks rely on the nature of the algorithm plus some knowledge of the general
characteristics of the plaintext or plain-cipher text pairs. This type of attack deduce a specific
plaintext or to deduce the key being used.

Type of Attack Known to Cryptanalyst


Ciphertext only  Encryption algorithm
 Ciphertext
Known  Encryption algorithm
plaintext  Ciphertext
 One or more plaintext-ciphertext pairs formed with the secret
key
Chosen  Encryption algorithm
plaintext  Ciphertext
 Plaintext message chosen by cryptanalyst, together with its
corresponding ciphertext generated with the secret key
Chosen  Encryption algorithm
ciphertext  Ciphertext
 Ciphertext chosen by cryptanalyst, together with its
corresponding decrypted plaintext generated with the secret
key
Chosen text  Encryption algorithm
 Ciphertext
 Plaintext message chosen by cryptanalyst, together with its
corresponding ciphertext generated with the secret key
 Ciphertext chosen by cryptanalyst, together with its
corresponding decrypted plaintext generated with the secret
key

Table 1.4.1.2 Types of Attacks on Encrypted Messages

The table shows the various types of cryptanalytic attacks based on the amount of
information known to the cryptanalyst.

Assume
The opponent know the encryption algorithm possible attack under these
circumstances is the brute-force approach of trying all possible keys.

Solution
If the key space is very large, its impractical. So the opponent rely on an analysis of
the ciphertext, applying various statistical tests to it. To use this approach, the opponent
must have general idea of the type of plaintext that is concealed.

a) Ciphertext-only Attack
it’s easiest to defend against because the opponent has less amount of information.
Usually, the analyst has more information, analyst capture more plaintext messages
and their encryption or analyst know the particular plaintext pattern will appear in the
message.
Example
A file is encoded in the postscript format always begins with the same pattern, or
there may be a standardized header or banner to an electronic funds transfer
message. All these are examples of known plaintext. The analyst deduce the key
on the basis of the way in which the known plaintext is transformed.

b) Known plaintext
it is also referred to as a probable-world attack. It the opponent is working with the
encryption of same general prose message, he she may have little knowledge of what
is in the message. If opponent is with specific information, then parts of the message is
known.
Example
Accounting files is transmitted, the opponent know the placement of key words in
the header of the files.

c) Chosen-plaintext
if the analyst is able to get the source system to insert into the system a message
chosen by the analyst, then a Chosen-plaintext attack is possible
Example
If the analyst choose the message to encrypt, he may pick patterns that can be
expected to reveal the structure of the key.

d) Chosen ciphertext and

e) Chosen text
These two are commonly employed as cryptanalytic techniques.

Encryption Scheme unconditionally Secure


If the ciphertext generated by the scheme does not contain enough information to
determine the corresponding plaintext. An opponent’s time availability is also not considered,
it’s impossible for him or her to decrypt the ciphertext because the required information is not
there.

Encryption algorithm meets either one of the following criteria

i) The cost of breaking the cipher exceeds the value of the encrypted information.
ii) the time required to break the cipher exceeds the lifetime of the information.

Encryption Scheme-Computationally Secure


If any one of the above criteria’s are met, its difficult to estimate the amount of efforts
required to cryptanalyze ciphertext successfully.

II) Brute-Force Attack


Every possible keys are tried for translation of the ciphertext into plaintext obtained
most of the keys are tried to achieve success.

(i.e.) There are X different Keys, an attacker discover the actual key after X/2 tries,
known plaintext is provided, Analyst should recognize plaintext as plaintext.
 if the message is plaintext, result POPS out. If the message is compressed before
encryption, the recognition of English language itself is more difficult.
 if the message is some more general type of data, such as a numerical file, and this
has been compressed, the problem becomes more difficult to automate.
To supplement the brute-force approach, some degree of knowledge about the
expected plaintext is needed.

1.4.2. SUBSTITUTION TECHNIQUES


The following techniques are called classical encryption techniques.

A substitution technique in which the letters of plaintext are replaced by other letters
or by number of symbols. If plaintext is viewed as a sequence of bits, then substitution
involves replacing plaintext bit patterns with ciphertext bit patterns.

a) Caesar Cipher
The Caesar cipher means replacing each letter of the alphabet with the letter standing
three places further down the alphabet.

Example
Plaintext Meet me after the toga party
Ciphertext PHHW PH DIWHU WKH WRJD SDUWB

Transformation is defined by listing all possibilities as follows

Plain 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
Cipher D E F G H I J K L MN O P Q R S T U V WX Y Z A B C

Assign a numerical equivalent to each letter

a b c d e f g h i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y z
13 14 15 16 17 18 19 20 21 22 23 24 25

Algorithm can be expressed as follows,

For each plaintext letter P, substitute the cipher text letter C

C=E(3,P) =(P+3) mod 26

A shift may be of any amount, so that the general Caesar algorithm is

C=E(K,P) =(P+K) mod 26--------------------------------(1)

Where k takes on a value in the range 1 to 25.

The decryption algorithm is simply

P=D(k,c) =(c-k) mod 26-----------------------------------(2)

Try all the 25 possible keys. Below fig shows the results of applying this strategy to
the example ciphertext.

PHHW PH DIWHU WKH WRJD SDUWB


KEY
1 oggv og chvgt vjg vqic rctva
2 nffu nf bgufs uif uphb qbsuz
3 meet me after the toga party
4 idds id zesdq sqd snfz ozqsx
5 kccr kc ydrcp rfc rmey nyprw
6 jbbq jb xcqbo qeb qlbx mxoqv
7 iaap ia wbpan pda pkcw lwnpu
8 hzzo hz vaoxm ocz ojbv kvmot
9 gyyn gy uznyl nby niau julns
10 fxxm fx tymxk max mhzt itkmr
11 ewwl ew sxlwj lzw lgys hsjlq
12 dvvk dv rwkvi kyv kfxr grikp
13 cuuj cu qujuh jxu jewq fghjo
14 btti bt puitg iwt idvp epgin
15 assh as othsf hvs hcuo dofhm
16 zrrg zr nsqre qur gbtn cnegl
17 yqqf yq mrfqd ftq fasm bmdfk
18 xppe xp lqepc esp ezrl alcej
19 wood wo kpdob dro dyqk zkbdi
20 vnnc vn jocna cqn cxpj yjach
21 unmb um inbmz bpm bwoi xizbq
22 tlla tl hmaly aol avnh whyaf
23 tskkz sk qlzkx znk zumg vgxze
24 rjjy rj fkyjw ymj ytlf ufwyd
25 qiix qi ejxiv xli xske tevxc

Fig-1.4.2 (a) Brute-Force Cryptanalysis of Caesar Cipher

In this case, the plain text leaps out as occupying the third line.

Characteristics of this problem enabled to use a brute-force cryptanalysis

i) The encryption and decryption algorithms are known.


ii) There are only 25 keys to try.
iii) The language of the plaintext is known and easily recognizable.

 Brute=force cryptanalysis become impractical by the use of an algorithm that


employs a large-number of keys.
Example The triple DES algorithm makes use of a 168-bit key, giving a key
space of 2168 or greater than 3.7 X 1050 possible keys.

 If the language of the plaintext in unknown, then plaintext output may not be
recognizable. The input is abbreviated or compressed again making
recognition difficult.
Fig-1.4.2(b) Sample of compressed text
The above fig shows a portion of a text files compressed using an algorithm called
ZIP. If this file is encrypted with a simple substitution cipher then the plaintext is not
recognized when it is uncovered in the brute-force cryptanalysis .

b) Monoalphabetic Ciphers
Increase in the key space can be achieved by following an arbitrary substitution
permutation.

It is a finite set of elements S is an ordered sequence of all the elemts of S, with each
element appearing exactly once.
Example
If S={a,b,c}, there are six permutations of S.
Abc, acb, bac, bca, cab, cba
There are n! Permutations of a set of n elements, because the first element can be
chosen in one of n ways, the second in n-1 ways, the third in n-2 ways.
Recall the assignment for the Caesar Cipher

Plain 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
Cipher D E F G H I J K L MN O P Q R S T U V WX Y Z A B C

Monoalphabetic substitution cipher


“Cipher” line can be any permutation of the 26 alphabetical characters, then there are
26! Or greater than 4X1026 possible keys. This is 10 orders of magnitude grater than the key
space for DES and seem to eliminate Brute-Force techniques for cryptanalysis. In this cipher,
a single cipher alphabet is used per message.

Line of Attack`
Cryptanalyst know the nature of the plaintext, then the analyst can exploit the
regularities of the language.
To Solve
The cipher text
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
 the relative frequency of the letters determined and compared to a standard
frequency distribution for English as shown in below fig

Fig-14.2.(c) Relative Frequency of Letters in English Text


 If the message is enough, this technique is sufficient, because this is a short
message, we cannot expect an exact match.

 The relative frequencies of the letters in Ciphertext are as follows

P 13.33 H 5.83 F 3.33 B 1.67 C 0.00


Z 11.67 D 5.00 W 3.33 G 1.67 K 0.00
S 8.33 E 5.00 Q 2.50 Y 1.67 L 0.00
U 8.33 V 4.17 T 2.50 I 0.83 N 0.00
O 7.50 X 4.17 A 1.67 J 0.83 R 0.00
M 6.67

The above breakdown is compared with fig-1.4.2 (c), cipher letters p and z are the
equivalent of plain letters e and t, but it’s not certain which is which.

i) The letters S, V, O, M and H are all of relatively high frequency and probably
correspond to plain letters from the Set {a, h, i, n, o, r, s}.
ii) The letters with the lowest frequencies are likely included in the Set {b, j, k, q, v,
x, z}.
 Tentative assignments are made and start to fill in the plaintext to see if it
looks like a reasonable “skeleton” of message.
 A systematic approach is to look for other regularities.

Example
Certain words may be known to be in the text.
We could look for repeating sequences of cipher letters and try to deduce their
plaintext equivalent.

Diagram
 A powerful tool is to look at the frequency of two=letter combinations known as
diagrams.
 A table similar to fig-1.4.2(c) could be down up showing the relative frequency of
diagrams.
 In out ciphertext, the common diagram is zw, which appears three times. So we
make the correspondence of z with t and w with h.
 By our earlier hypothesis, we can equate p with e.
 The sequence zwp appears in the ciphertext, and we can translate that sequence as
“the”.
 This is the most Frequent trigram in English, which seems to indicate that we are
on the right track.
 Notice the sequence zwsz in the first line. We don’t know that these four letters
form a complete word, but if they do, it is of the form th_t. If so, S equates with a.
So far, then, we have
Only four letters have been identified, but already we have quite a bit of the message.
Continued analysis of frequencies plus trial and error should easily yield a solution from this
point. The complete plaintext, with spaces added between words, follows

It was disclosed yesterday that several informal but direct contacts have been made
with political representatives of the viet cong in moscow

Monoalphabetic ciphers are easy to break because they reflect the frequency data of
the original alphabet. A countermeasure is to provide multiple substitutes, known as
homophones, for a single letter

Example
The letter e could be assigned a number of different cipher symbols, such as 16, 74, 35
and 21, which each homophone assigned to a letter in rotation or randomly.
If the number of symbols assigned to each letter is proportional to the relative
frequency of that letter, than single-letter frequency information is completely
obliterated.
With homophones, each element of plaintext affects only one element of ciphertext,
and multiple-letter patterns still survive in the ciphertext, making cryptanalysis
relatively straight forward.
Two methods are used in substitution cipher to lessen the extent to which the structure
of the plaintext survives in the ciphertext
i) To encrypt multiple letters of plaintext.
ii) To use multiple cipher alphabets

c) Playfair cipher
The best-known multiple-letter encryption cipher is the playfair, which treats diagrams
in the plaintext as single units and translate these units into ciphertext diagrams.

The playfair algoritms is based on the use of 5x5 matrix of letters constructed using a
keyword

Example
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

 In this case keyword is monarchy.


 The Matrix is constructed by filling in the letters of the keyword from left to right and
from top to bottom, and then filling in the remainder of the matrix with the remaining
letters in alphabetical order.
 The letters i and J count as one letter.
 Encrypting plaintext’s two letters at a time, with the following rules
1. Repeating plaintext letters that are in the same pair are separated with a filler letter,
such as x, so that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each replaced by the
letter to the right, with the first element of the row circularly following the last. For
example, ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the letter
beneath, with the top element of the column circularly following the last. For example,
mu is encrypted as CM.
4. Otherwise, each plaintext in a pair is replaced by the letter that lies in its own and the
column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes
IM.

Playfair cipher-un breakable


In palyfair Cipher, there are only 26 letters, there are 26x26=676 diagrams. So, that
identification of individual diagrams is difficult and also the rerlative frequencies of
individual letters exhibit a much greater range than that of diagrams, making frequency
analysis difficult.
Playfair Cipher-breakable
Ii leaves much of the structure of the plaintext language intact. A few hundred letters
of ciphertext are sufficient.

Playfair Cipher-Effect
Fig 1.4.2(d) Relative Frequency of occurrence of Letters

The line labelled plaintext plots a typical frequency distribution of the 26 alphabetic
characters in ordinary text.

This is also the frequency distribution of monoalphabetic substitution cipher, because


the frequency values for individuals letters are the same just with different letters substituted
for the original letters.

Plot-development
The number of occurrences of each letter in the text is counted and divided by the
number of occurrences of the most frequently used letter.

Result
Using the results of the above fig,
 e is the most frequently used letter.
 e has a relative frequency of 1, t of 9.056/12.702 ≈ 0.72 and so on.
 The point on the horizonal axis correspond to the letter in order of decreasing
frequency
 the above fig shows the frequency distribution results when the text is encrypted
using the playfair cipher.
 To normalize the plot the number of occurrences of each letter in the ciphertext
divided by the number of occurrences of e in the plaintext.
 The resulting plot shows the extent to which the frequency distribution of letters,
which makes it trivial to solve substitution ciphers, is masked by encryption.
 playfair cipher has a flatter distribution than does plaintext, but it reveals plenty of
structure for a cryptanalyst to work with.

d) Hill Cipher
Before learning hill cipher, let us study basics of linear algebra, which is necessary to
understand matrix arithmetic module 26

i) linear algebra
Define the inverse M-1 of a square matrix M by the eqn

M(M-1) = M-1 M = I
Where I is the identity matrix

Square Matrix
I is a square matrix that is all zeros except for ones along the main diagonal from
upper left to lower right.
The inverse of a matrix does not always exist, but when it does, it satisfies the
preceding equation.

Example
5 8 9 2
𝐴=( ) 𝐴−1 𝑚𝑜𝑑 26 = ( )
17 3 1 15
(5 × 9) + (8 × 1) (5 × 2) + (8 × 15)
𝐴𝐴−1 = ( )
(17 × 9) + (3 × 1) (17 × 2) + (3 × 15)

53 130 1 0
=( ) 𝑚𝑜𝑑 26 = ( )
156 79 0 1
Computation of inverse of a matrix
Determinant concept is used for any square matrix (𝑚 × 𝑚), the determinant
equals the sum of all the products that can be formed by taking exactly one element from
each row and exactly one element from each column, with certain of the product terms
preceded by a minus sign.

For a 2 × 2 matrix,
𝑘11 𝑘12
[ ]
𝑘21 𝑘22
The determinant is k11 k22 – k12 k21
For a 3 × 3 matrix,

The value of the determinant is


k11 k22 k33 + k21 k32 k13 + k31 k12 k23 – k31 k22 k13 – k21 k12 k33 – k11 k32 k23

Square matrix – non zero determinant


Then the inverse of the matrix is computed as
[A-1]ij=(det A)-1(-1)i+j(Dji)

Where (Dji) is the subdeterminant formed by deleting the jth row and the ith column
of A, det (A) is the determinant of A, and (det A) -1 is the multiplicative inverse of (det A)
mod 26.

From the last example,

5 8
det ( ) = (5 × 3) − (8 × 17) = −121 od 26 = 9
17 3
We can show that 9-1 mod 26 = 3, because 9 * 3 = 27 mod 26 = 1 (see Chapter 4
or Appendix E). Therefore, we compute the inverse of A as

5 8
A=( )
17 3
3 −8 3 18 9 54 9 2
𝐴−1 𝑚𝑜𝑑 26 = 3 ( ) = 3( )=( )= ( )
−17 5 9 5 27 15 1 15
ii) The Hill Algorithm
This encryption algorithm takes m successive plaintext letters and substitutes for
them m ciphertext letters.
The substitution is determined by m linear equations in which each character is
assigned a numeric`al value
(a = 0, b=1,….,Z = 25)

For, m = 3, the system is described as


c1 = (k11p1 + k21p2 + k31p3) mod 26
c2 = (k12p1 + k22p2 + k32p3) mod 26
c3 = (k13p1 + k23p2 + k33p3) mod 26
This can be expressed in terms of row vectors and matrices6
(C1C2C3) = (P1P2P3)

𝑘11 𝐾12 𝐾13


(𝐾21 𝐾22 𝐾23 ) 𝑚𝑜𝑑 26
𝐾31 𝐾32 𝐾33

C=PK mod 26
Where c and p are row vectors of length 3 representing the plaintext and
ciphertext, and k is a 3× 3 matrix representing the encryption key operations are
performed mod 26.

Example
Plaintext “paymore money” and use the encryption key
17 17 5
K = [21 18 21]
2 2 19
The first three letters of the plaintext are represented by the vector ( 15 0 24)
Then (15 0 24) k = (303 303 531)
Mod 26 = ( 17 17 11) =RRL

Ciphertext for the entire plaintext is RRLMWBKASPDH

Decryption
It requires using the inverse of the matrix k.
Compute det K = 23, and (det k)-1 mod 26 = 17
Computing the inverse as
4 9 15
𝑘 −1 = (15 17 6)
24 0 17
This is demonstrated as

17 17 5 4 9 15 443 442 442 1 0 0


(21 18 21) (15 17 6 ) = (858 495 780) 𝑚𝑜𝑑 26 = (0 1 0)
2 2 19 24 0 17 494 52 365 0 0 1
It is easily seen that if the matrix K-1 is applied to the ciphertext, then the plaintext
is recovered.
In general terms, the Hill system can be expressed as
C = E(K, P) = PK mod 26
P = D(K, C) = CK-1 mod 26 = PKK-1 = P
 In hill cipher, usage of a larger matrix hides more frequency information. So, a
3 × 3 Hill cipher hides not only single letter but also two letter frequency
information.
 Hill cipher is stronger against a ciphertext-only attack but it is easily broken
with a known plaintext attack.
 for 𝑚 × 𝑚 Hill cipher,
We have m plaintext – ciphertext pairs, each of length m.
We label the pairs
Pj = (P1j P1j…Pmj) and Cj =(C1j C1j…Cmj)
Such that Cj = Pjk for 1 ≤ j ≤ m and for some unknown key matrix k.
 2 𝑚 × 𝑚 matrices X = (Pij) and y = (Cij) forming matrix equation Y =XK.
a) If X has an inverse, then we can determine K = X -1 Y.
b) If x is not invertible, then a new version of X can be formed with
additional plaintext – ciphertext pairs until an invertible x is obtained

Example
Plaintext “ hillcipher” is encrypted using a 2*2 Hill Cipher to yield the ciphertext
HCRZSS*NSP.

We know that (7 8)k mod 26= (72)

(11 11)k mod 26=(17 25) and so on.

First two plaintext - ciphertext pairs, we have

7 2 7 8
( )=( ) 𝐾 𝑚𝑜𝑑 26
17 25 11 11
The inverse of X can be computed

7 8 −1 25 22
( ) =( )
11 11 1 23
25 22 7 2 549 600 3 2
so K=( )( )= ( ) 𝑚𝑜𝑑26 = ( )
1 23 17 25 398 577 8 5
This result is verified by testing the remaining plaintext ciphertext pairs.

e) Polyalphabetic Ciphers
A monoalphabetic technique is to use different monoalphabetic substitutions as one
proceeds through the plaintext message. This approach is polyalphabetic substitution cipher.

Features
1. A set of related monoalphabetic substitution rules is used.
2. A Key determines which particular rule is chosen for a given transformation

i) Vigenere Cipher
Simplest polyalphabetic ciphers is the Vigenee Cipher.

Assume
Sequence of plaintext letters
P = P0, P1, P2,…..Pn-1 and
A key consisting of the sequence of letters
K = K0, K1, K2, …,Km-1 where m < n
Sequence of ciphertext letters
C = C1, C1, C2, …, Cn-1 is calculated as
C = C0, C1, C2, …, Cn-1 = E(K, P) = E[(k0, k1, k2, …, km-1), (p0, p1, p2,…, pn-1)]
= (p0 + k0) mod 26, (p1 + k1) mod 26, …, (pm-1 + km-1) mod 26,
(pm + k0) mod 26, (pm+1 + k1) mod 26, …, (p2m-1 + km-1) mod 26, …

 First letter of the key is added to the first letter of the plaintext, mod 26, the second
letters are added and so on through the first m letters of the plaintext, for the next
m letters of text, the key letters are repeated.
This process continues all the plaintext sequence is encrypted.

Eqn of the encryption process


Ci = (Pi + Ki mod m) mod 26. -----------------------------------(3)
Compare this eqn with Caesar cipher eqn (1)
Each plaintext character is encrypted with a different Caesar cipher, depending on
key character.

Decryption
It is a generalization of eqn (2).
Pi = (Ci – Ki mod m) mod 26----------------------------------------(4)

Encryption
Example
Keyword is deceptive, Message “ we are discovered save yourself”
Encrypted as
Vigener cipher – advantage
The strength of this cipher is there are multiple ciphertext letters for each plaintext
letter, one for each unique letter of the keyword. So, the letter frequency information is
covered, not all knowledge of the plaintext structure is lost.

Example
Fig – 1.4.2 (d) shows the f.d. for a vigener cipher with a keyword of length 9.
If monoalphabetic substitution is used, then properties of the ciphertext should be
the same as the language of the plaintext. A shown in fig – 1.4.2(c), there is one cipher
letter with a relative frequency of occurrence of about 12.7%, one with 9.06% and so on.
Keyword length – Determination
If two identical sequences of plaintext letters occur at a distance (i.e) an integer
multiple of the keyword length, they will generate identical ciphertext sequences.
Example
Two instances of the sequence “red” are separated by nine character positions.
R is encrypted using key letter e
E is encrypted using key letter p
D is encrypted using key letter t
Ciphertext sequence is vtw. This is indicated above by underlining the relevant
ciphertext letters and shading the relevant ciphertext numbers.

An analyst detect the repeated sequences vtw at a displacement of 9 and make the
assumption that the keyword is either three or nine letters in length. The appearance of
vtw twice not reflect identical plaintext letters encrypted with ide`ntical key letters.
It the message is long there is repeated ciphertext sequences by looking for
common factors in the displacement of the various sequences, the analyst guess the
keyword length.

Cipher – solution
It the keyword length is m, then the cipher consists of m monoalphabetic
substitution ciphers.

Example
Keyword DECEPTIVE, the letters in positions 1, 10, 19 and so on are all
encrypted with the same monoalphabetic cipher.

So, we can use the frequency characteristics of the plaintext language to attack
each of the monoalphabetic ciphers separately.

Auto key – System


A nature of keyword can be eliminated by using a nonrepeating keyword (i.e) as
long as the message itself. Vigenere proposed an autokey system, a keyword is
concatenated with the plaintext itself to provide a running key.

Example
Key deceptive weared is coveredsave
Plaintext weared is covered save yourself
Ciphertext ZICVIWQNGKZEIIGASXSTSLVVWLA.
Key and plaintext share the same frequency distribution of letters, statistical
techniques are applied.

Example
E enciphered by e
By fig – 14.2 (c), can be expected to occur with a frequency of (0.127)2 =
0.016, t enciphered by t would occur only half.

ii) Vernam Cipher


Keyword is chosen which is as long as the plaintext and has no statistical
relationship to it. This system works on binary data (bits) rather than letters. This system is
expressed in below fig.
Fig – 1.4.2/(e) Vernam Cipher
ci = pi  ki
where
pi = ith binary digit of plaintext
ki = ith binary digit of key
ci = ith binary digit of ciphertext

 = exclusive-or (XOR) operation


Compare this with Equation (3) for the Vigenère cipher. Thus, the ciphertext is
generated by performing the bitwise XOR of the plaintext and the key. Because of the
properties of the XOR, decryption simply involves the same bitwise operation

pi = ci  ki
which compares with Equation (4).

Features – vernam cipher


This technique is the means of construction of the key. This cipher only proposed the
use of a running loop of tape that eventually repeated the key. So, system worked with a
long but repeating keywords. If with a long key, presents formidable cryptanalytic
difficulties, it can be broken with sufficient ciphertext, the use of known plaintext
sequence.

f) one-time pad
Vernam cipher yields the security. Using a random key which is as long as the
message so that the key is not repeated. Key is to encrypt and decrypt a single message, and
then discarded. Each new message requires a new key of the same length as the new message,
such a scheme known as one-time pad is unbreakable.
It produces o/p that bears no statistical relationship to the plaintext because ciphertext
has no information about the plaintext, there is no way to break the code.

Example
Vigenere scheme with 27 characters in which 27th character is the space character, but
with a one-time key (i.e) as long as the message.
Ciphertext

It’s difficult for the crypt analyst to say that one of these two keys is more likely than
the other. So, these is no way to decide which key is correct and which plaintext is
correct.

One – time pad – unbreakable


Given any plaintext of equal length to the ciphertext, there is a key that produces
that plaintext. Exhaustive search of all possible keys are did and many legible plaintexts
are found, with no way of knowing which was the intended plaintext.

One – time pad – security


It is due to the randomness of the key. It the stream of characters that constitute the
key is truly random, then the stream of characters that constitute the ciphertext will be
truly random. There are not patterns or regularities that a cryptanalyst can use to attack the
ciphertext.

One – time pad – difficulties


1. There is the practical problem of making large quantities of random keys. Any
heavily used system might require millions of random characters on a regular
basis. Supplying truly random characters in this volume is a significant task.
2. Even more daunting is the problem of key distribution and protection. For every
message to be sent, a key of equal length is needed by both sender and receiver.
Thus, a mammoth key distribution problem exists.
Because of these difficulties, this one-time pad is useful for low- band- width
channels requiring very high security.
The one – time pad exhibits perfect secrecy.

1.4.3 TRANSPOSITION TECHNIQUES


Mapping achieved by performing some sort of permutation on the plaintext letters.
This is called transposition cipher.

Rail fence technique


Plaintext is written down as the sequence of diagonals and then read off as a sequence
of rows.

Example
Encipher the message
“meet me after the toga party”
With a rail fence of depth 2.
We write as
Mematrhtgpry
Etefeteoaat
The encrypted message is
MEMATRHTGPRYETEFE TEOAAT

Technique – complex
To write the message in a rectangle, row by row and read the message off, column by
column, but permute the order of the columns. The order then becomes the key to the
algorithm.

Example
 the key is 4 3 1 2 5 6 7
 to encrypt, start with the column that is labeled 1, in this column 3.
 write down all the letters in that column. Proceed to column 4, which is labeled 2,
then column 2, then column 1, then columns 5, 6 and 7.
 This cipher has the same letter frequenices as the original plaintext
 In columnar transposition, laying out the cipher text in a matrix and playing around
with column positions.
 digram and trigram frequency tables can be useful.
 The result is a more complex permutation that is not easily reconstructed.
 Thus, if the foregoing message is reencrypted using the same algorithm.

To visualize the result of this double transposition, designate the letters in the
original plaintext message by the numbers designating their position. Thus, with 28 letters
in the message, the original sequence of letters is

After the first transposition, we have

which has a somewhat regular structure. But after the second transposition, we
have
This is a much less structured permutation and is much more difficult to
cryptanalyze.

1.4.4 STEGANOGRAPHY
A plaintext message hidden in one or two ways. The methods of steganography
conceal the existence of the message, whereas the methods of cryptography render the
message unintelligible to outsiders by various transformations of the text.

3rd March

Dear George,
Greetings to all at Oxford. Many thanks for your letter and for the Summer
examination package. All Entry Forms and Fees Forms should be ready for final
despatch to the Syndicate by Friday 20th or at the very latest, I'm told, by the 21st.
Admin has improved here, though there's room for improvement still; just give us
all two or three more years and we'll really show you! Please don't let these
wretched 16+ proposals destroy your basic O and A pattern. Certainly this sort of
change, if implemented immediately, would bring chaos.

Sincerely yours,

Fig – 1.4.4 A puzzle for Inspector morse


 stenography is the time – consuming one to construct, and also in which an
arrangement of words or letters within harmless text spells out the real message.
Example
The sequence of first letters of each word of the overall message spells out the
hidden message
The above fig shows in which a subset of the words of the overall message is used
to convey the hidden message.
Other techniques
 Character marking Selected letters of printed or typewritten text are overwritten
 in pencil. The marks are ordinarily not visible unless the paper is held at an angle
to bright light.
 Invisible ink A number of substances can be used for writing but leave no visible
trace until heat or some chemical is applied to the paper.
 Pin punctures Small pin punctures on selected letters are ordinarily not visible
unless the paper is held up in front of a light.
 Typewriter correction ribbon Used between lines typed with a black ribbon, the
results of typing with the correction tape are visible only under a strong light.

Stenography – Drawbacks
 It requires a lot of overhead to hide a relatively few bits of information, although
using a scheme like that proposed in the preceding paragraph may make it more
effective.
 Once the system is discovered, it becomes worthless.
 message is encrypted and hidden using stegnography.

Stenography – Advantages
 It can be employed by parties who have something to lose should be fact of their
secret communication be discovered.
 Encryption flags traffic identify the sender or receiver as someone with something
to hids.
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner

You might also like