0% found this document useful (0 votes)
246 views23 pages

Cryptography, Network Security and Cyber Laws Notes 2019-2020

This document provides an introduction to cryptography, network security, and cyber laws. It discusses common cyber attacks such as theft of sensitive information, disruption of service, and illegal access to resources. It also covers common attack types like phishing, denial of service attacks, and those that use malware. The document outlines vulnerabilities at the human, protocol, software, and configuration levels. It describes defense strategies around access control, data protection, prevention and detection, and response, recovery, and forensics. Guiding principles for security emphasize it as a human problem requiring policy, education, and designing security in from the start rather than as an afterthought.

Uploaded by

Himanshu Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
246 views23 pages

Cryptography, Network Security and Cyber Laws Notes 2019-2020

This document provides an introduction to cryptography, network security, and cyber laws. It discusses common cyber attacks such as theft of sensitive information, disruption of service, and illegal access to resources. It also covers common attack types like phishing, denial of service attacks, and those that use malware. The document outlines vulnerabilities at the human, protocol, software, and configuration levels. It describes defense strategies around access control, data protection, prevention and detection, and response, recovery, and forensics. Guiding principles for security emphasize it as a human problem requiring policy, education, and designing security in from the start rather than as an afterthought.

Uploaded by

Himanshu Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Cryptography, Network security and Cyber laws Notes 2019-2020

CRYPTOGRAPHY, NETWORK SECURITY AND


CYBER LAWS

By ,
Swetha K H
Asst. professor
Dept. Of ISE

Swetha K H, Asst. prof., ISE Dept., AIT Page 1


Cryptography, Network security and Cyber laws Notes 2019-2020

MODULE-1
Chapter-1
Introduction

CYBER ATTACKS

Computer security is all about studying cyber attacks and to defend against them.

What are the motives behind attack? Or types of attackers

1) Sheer thrill of mounting successful attacks.


2) Most hackers are young adults, teens who had dropped out of school.
3) Traditional hackers are obsessive programmers.
4) Script kiddies- juveniles who use scripts and attack kits designed by others.
5) Company insiders- disgruntled employees.
6) Cyber terrorists-who expouse extreme religious or political causes.
7) For Financial gain.

Main Motives of launching cyber attacks

1) Theft of sensitive information


2) Disruption of service
3) Illegal access to or use of resources.

1) Theft of sensitive information: Many organizations store and communicate sensitive


information.
Ex1: information on new products- can be advantageous to company’s competitors.
Ex2: political espionage: Targeted at government ministries and national intelligence to know
sensitive operations planned for future.
Ex3: Identity Theft: Leakage of personal information like credit card numbers, passwords,
personal spending habits.

2) Disruption of service: Interruption or disruption of service is launched against an


organization’s server, so that they become unavailable or inaccessible.
Ex: Such attacks are launched by business rivals of e-commerce websites. (my competitors loss
is my gain)

3) Illegal access to or use of resources: The goal here is to obtain free access or service to paid
services.
Ex: Free access to online digital products such as magazine or journal articles, free use of
computing power on super computers.

Swetha K H, Asst. prof., ISE Dept., AIT Page 2


Cryptography, Network security and Cyber laws Notes 2019-2020

Common Attacks

Different types of attacks are there, they are:

a) Attempt to retrieve personal information from an individual


b) Denial of service(DOS)
c) Attacks that caused by various types of malware

a) Attempt to retrieve personal information from an individual:

There are two best known attacks in this category, they are:

1) Phishing attack- lures its victims to a fake website.


Ex: an online bank- fake site has the look and feel of the authentic bank which collects
information like login name and password of victim.

2) Pharming attack- involves modifying DNS entries, which causes users to be directed to
the wrong website when they visit a certain web address.

Other attacks which comes under personal information retrieval attacks are:

1) Skimming attacks – Capture information from a card holder.


2) Side channel attacks- Attack based on information gained from implementation of a
computer system, rather than weaknesses in the implemented algorithm itself.
Ex: cryptanalysis, software bugs
3) Eavesdropping or snooping attacks or sniffing attack: incursion (attack) where
someone tries to steal information that computers, smart phones or other devices transmit
over network.
4) Password guessing attacks: Special case of dictionary attacks, an attempt to discover a
password by systematically trying every possible combination of letters, numbers and
symbols until correct combination is discovered.

Phishing, pharming, skimming, eavesdropping, password guessing all these are called
identity theft.

b) Denial of service(DOS):

• Attack that interrupts or disrupts computing services of the victim are called as denial of
service.
• These attacks exhaust the computing power, memory capacity or communication
bandwidth of their targets.

c) Attacks that caused by various types of malware: They are,

Swetha K H, Asst. prof., ISE Dept., AIT Page 3


Cryptography, Network security and Cyber laws Notes 2019-2020

1) Worms & viruses- are the malware that replicate themselves. A virus infects a file,
spreads from one to another file. A worm is stand-alone program that infects a computer,
spreads from one computer to another. Examples like spread through email, internet
messages, Bluetooth etc.
2) Trojan- malware that masquerades as a utility but has other insidious goals such as
modification of files, data theft etc.
3) Spyware- installed on a machine, can be used to monitor user activity and as a key
logger to recover valuable information such as passwords from user keystrokes.

Vulnerabilities

Vulnerability is a weakness or lacuna in a procedure ,protocol, hardware, or software within an


organization that has potential to cause damage.

There are 4 important vulnerability classes in the domain of security:

1)Human vulnerabilities:- These are induced by human behaviour or action.


Ex: clicking an email attachment may open a document causing a macro to be executed.

2)Protocol Vulnerabilities:- A number of networking protocols including


TCP,IP,ARP,ICMP,UDP,DNS used in LANs have features that have been used in unanticipated
ways to craft assorted attacks.
Ex: Pharming attacks and hijacking attacks.

3)Software Vulnerabilities:- This is caused by sloppily written system or application software.


Ex1: buffer overflow is exploited to inject and execute malicious worm code.
Ex2: Insufficient validation of user input at browser leads to attacks(coz of cross site scripting
vulnerability, SQL injection vulnerability)

4)Configuration vulnerabilities:- These relate to configuration settings on newly installed


applications, files etc. Read write execute privileges may be misused during execution leading to
‘privilege escalation’ attacks.

DEFENCE STRATEGIES AND TECHNIQUES


There are 4 Defence strategies and techniques, they are:

1) Access control-Authentication and authorization


2) Data protection
3) Prevention and detection
4) Response, recovery and forensics.

Swetha K H, Asst. prof., ISE Dept., AIT Page 4


Cryptography, Network security and Cyber laws Notes 2019-2020

1)Access control-Authentication and authorization: Access control is existence of a trusted


third party that mediates access to a protected system. The first step in access control is to permit
or deny entry into system. This involves authentication- process whereby the subject or principal
establishes that, it is indeed the entity it claims to be.
Ex: password(login)
After successful authentication, subject is logged into the system. The subject may need to
access several resources such as files. Access controller has to answer authorization related
questions.

Ex: is rajeev allowed to write into file CS649 grades.


Subject is rajeev
Resource is CS649 grades
Access mode is write

2)Data protection: The data in transit or in storage need to be protected. There are 2
dimensions to it.
1. Data confidentiality: The data should not be readable by an intruder.
2. Data integrity: Data in transit should not be tampered with or modified.

Cryptographic techniques are among the best known ways to protect both, the confidentiality and
integrity of data.

3)Prevention and detection: Access control and message encryption are preventive
strategies. Cryptographic checksum, detects tampering of messages. code testing is used to detect
vulnerabilities.Intrusion prevention may not always be practical or affordable. So we need
intrusion detection.

4)Response, recovery and forensics: Once an attack or infection has been detected, response
measures should be taken. It includes shutting down all or part of the system. Infected part of the
system should be quarantined and necessary patches applied.
Cyber forensics is an emerging discipline with a set of tools that help trace back the perpetrators
of cyber crime.

GUIDING PRINCIPLES
1) Security is as much a human problem than a technological problem and must be
addressed at different levels:
- Robust security policies should be formulated.
- Security engineers have a key role to play in designing techniques and products to protect
organizations from cyber attacks.
- System admins should be proactive in crucial security practices.
- Employees within an organization should be educated on do’s and dont’s through
security awareness programs.

2) Security should be factored in at inception, not as an afterthought:

Swetha K H, Asst. prof., ISE Dept., AIT Page 5


Cryptography, Network security and Cyber laws Notes 2019-2020

- Security should be factored in early on during the design phase of a new product and then
carried forward through implementation and testing.

3) Security by obscurity if often bogus:


- Many complex cryptographic algorithms had serious vulnerabilities. So prior to
widespread adoption of new protocols or algorithms, they should be studied by ethical
hackers.

4) Always consider the default deny policy for adoption in access control:
The subject in an access control policy could be people, packets or user inputs.
- The best policy is the ‘default deny’ in which subject’s request is denied if it is not in
whitelist.

5) An entity be given the least amount/level of permissions/privileges to accomplish a given


task:
- Role based access control(RBAC) is an approach to restricting system access to
authorized users. If we give higher privilege it could compromise system.
- Sloppy or incomplete configuration management leads to privilege escalation.

6) Use ‘Defence in depth’ to enhance security of an architectural design.


- Ex: Firewall architecture for mid to large size enterprise. Every packet from the outside
should be intercepted by atleast two firewalls from different vendors and configured by
different system admins. So what escapes from firewall 1 may be caught by firewall 2.

7) Identify vulnerabilities and respond appropriately.


- Vulnerabilities in software or protocols have to be detected. But equally important are
lacunae/shortcomings in policy, procedures and operations -which have to be identified
and corrected.
- Ex: Not to have USB enabled PCs, not to allow mobile devices, pendrives.

8) Carefully study tradeoffs involving security before making any.


- Engineering design involves making tradeoffs- cost versus performance, functionality
versus chip area etc and security versus cost. So security engineer have to be careful with
tradeoffs.

Module -1’s chapter 1 completed

Swetha K H, Asst. prof., ISE Dept., AIT Page 6


Cryptography, Network security and Cyber laws Notes 2019-2020

Chapter 2
Mathematical Background for cryptography

MODULO ARITHMETIC:
• Let d be an integer, n a positive integer, q is quotient and r is remainder from dividing d
by n. The relationship b/w d, n, q, r is given by,

d=n*q + r , 0<=r<n
• d is equal to r modulo n, expressed as,

d ≡ r (mod n)

• Congruence Class- Set of numbers when divided by n gives common remainder r.


• Two integers are said to be congruent modulo n, if they give same remainder r.

• If two integers are congruent modulo n, then they differ by a integral multiple of n.
Algebraically expressed as,
If a mod n= r and b mod n =r
Then,
a=n*q1 + r and b=n*q2 + r

a-b=n*(q1-q2)

Properties of modulo arithmetic are:


1) (a+b) mod n = ((a mod n) + (b mod n)) mod n
2) (a-b) mod n = ((a mod n) - (b mod n)) mod n
3) (a*b) mod n = ((a mod n) * (b mod n)) mod n

Note:
If a=n*q1 + r1 and b=n*q2 + r2
Then,
(a*b) mod n = (r1*r2) mod n

Example1: n=8, a=27, b=34

To check whether property 1 holds good or not.

(a+b) mod n = ((a mod n) + (b mod n)) mod n


(27+34) mod 8=5

Swetha K H, Asst. prof., ISE Dept., AIT Page 7


Cryptography, Network security and Cyber laws Notes 2019-2020

(27 mod 8 + 34 mod 8) = 5


LHS=RHS
So, the property holds good.

• These modulo arithmetic properties are used in cryptography.


• As it involves multiplying a large number of terms, each term itself is a very large
number.

THE GREATEST COMMON DIVISOR


• If a|b (a divides b) and a|c, and there exists no a’>a such that a’|b and a’|c, then a is
referred to as the greatest common divisor of b and c, denoted as,
a=gcd (b, c)

Example:
2,3 and 6 are common divisors of both 24 and 78. The largest integer that divides both is 6, so
gcd(24,78)=6.

• If gcd(b,c)= 1, we say that b and c are relatively prime or co-prime.


• An integer is prime if it is co-prime with all positive integers less than it.
• Ex: 14 and 9 are co-prime but neither is a prime number.

Euclid’s Algorithm

• Euclid’s algorithm is used to find the gcd of two integers b and c.


• If b>c, b=c*q + r is the first step in the algorithm. i.e divide b by c explicitly showing the
quotient q and remainder r.
• In each subsequent step, similar equation is written in which the new dividend and new
divisor are respectively the divisor and remainder from previous step.

Ex: b=161, c=112, find gcd using euclid’s algorithm.

Step 1: 161=112*1 + 49
Step 2: 112= 49*2 + 14
Step 3: 49= 14*3+ 7
Step 4: 14= 7*2 + 0
The process of division continues until a remainder of 0 is encountered.
So, 7 is the gcd(161, 112)

GCD theorem: Given 2 integers b and c, there exist 2 integers x and y such that,
b*x + c*y=gcd(b, c)

Ex: b=161, c=112, find x and y.


Consider step 3 of euclid’s steps of find gcd(161, 112).
49=14*3 + 7

Swetha K H, Asst. prof., ISE Dept., AIT Page 8


Cryptography, Network security and Cyber laws Notes 2019-2020

Rewrite
7= 49-14*3

Substitute for 14 from step 2


Step 2 is 112=49*2+ 14
Rewrite
14=112-49 *2
7=49-14*3
7=49-(112-49*2)*3
7=49*7 + 112*(-3)
Substitute for 49 from step1

161=112*1 +49
49=161-112*1
7=(161-112*1)*7 + 112*(-3)
7=161*7 + 112*(-10)
161*7 + 112*(-10)=7
X=7, y=-10
(its lengthy, same can be solved using Extended euclid’s algorithm easily)

Corollary of GCD theorem: if b and c are relatively prime, then there exist integers x and y
such that,
b*x + c*y=1
• Multiplicative inverse modulo a prime number is often need to be computed in
cryptography. This inverse can be obtained using extended euclid’s algorithm.
• c*y≡1 (mod b) if this holds, then y is the multiplicative inverse of c mod b

Extended euclid’s algorithm

computeInverse(b, c)
{
Old1=1 new1=0
Old2=0 new2=1
b’=b c’=c
r=2
While(r>1)
{
q=b’/c’
r=b’%c’
temp1= old1-new1*q
Old1=new1
new1=temp1
Temp2=old2-new2*q

Swetha K H, Asst. prof., ISE Dept., AIT Page 9


Cryptography, Network security and Cyber laws Notes 2019-2020

Old2=new2
New2=temp2
b’=c’
c’=r
// at this point new1*b + new2 * c= r
}
return new2
}

Ex: Find inverse of 12 modulo 79


Sol: c=12, b=79, y=?
c*y≡ 1 mod b
12*y ≡ 1 mod 79

iteration b’ C’ q r old1 new1 old2 new2 Invariant


new1*b+new2*c=r

- 79 12 - 2 1 0 0 1 -

1 12 7 6 7 0 1 1 -6 7

2 7 5 1 5 1 -1 -6 7 5

3 5 2 1 2 -1 2 7 -13 2

4 2 1 2 1 2 -5 -13 33 1

Inverse of 12 mod 79 is 33.


12*33 ≡ 1 (mod 79)

Problem1: Compute gcd (6622,645) using euclid’s algorithm.


Ans:43

Problem2:Do each of the following inverse exist?


1) 102-1 mod 411
2) 77-1 mod 411
Ans: 1) b and c are not co-prime, so multiplicative inverse do not exist.
2)-16 is the inverse of 77.

Swetha K H, Asst. prof., ISE Dept., AIT Page 10


Cryptography, Network security and Cyber laws Notes 2019-2020

Problem3:Find inverse of 18 (mod 35)


Ans: 2 is the inverse of 18(mod 35)

USEFUL ALGEBRAIC STRUCTURES

Groups:
• Groups are also required in cryptography.
• A group is a pair <G,*>, where G is a set and * is a binary operation such that, the
following hold
closure: if a and b are elements of G, then so is a*b.
Associativity: if a, b and c are elements of G then a*(b*c)=(a*b)*c
Identity element: there exists an element I in G such that for all b in G,
I*b=b=b*I
Inverse: For each element b in G, there exists exactly one element c in G such that b*c=c*b=I

Then it is called as group.

• Cryptography uses finite groups.


• Example of finite group is the set {0,1,….,n-1} with the operation “addition modulo n”,
where n is a positive integer.
• <zn,+n> denotes a group. Zn represents set {0,1,……,n-1}. +n represents addition modulo
n.
• The identity element of this group is 0 and the inverse of an element b is –b.

• <zn-{0},*n> is a group only if n is a prime number.


• Order of a group:<G,*> is the number of elements in G.
• Euler totient function: (φ(n)) represents the order of group <z*n,*n>
• Number of elements in group z*5 ={1,2,3,4} is denoted by,
φ(5)=4

Sub-group: <G’,*> is a sub-group of <G,*> if <G’,*> satisfies the group properties enumerated
earlier and G’ is a subset of G.
Note:
• If m and are relatively prime, mφ(n) mod n=1.
• Let p be prime and let m be a non zero integer that is not a multiple of p. Then, mp-1 mod
p=1
• A group <G,*> is cyclic if there is atleast one element g in it such that <g> is <G,*>.
Then g is called generator of <G,*>

Note:
• The group <z*p,*p>, where p is prime is cyclic.
• The number of generators in <z* p,*p> is φ(p-1).

Swetha K H, Asst. prof., ISE Dept., AIT Page 11


Cryptography, Network security and Cyber laws Notes 2019-2020

• Let p be prime and let p1,p2,…pk be the distinct prime factors of p-1. Then, g is a
generator of <z*p,*p> if and only if, g(p-1)/pi ≠ 1 mod p for all pi, 1<=i<=k

Rings

• A ring is a triplet <R,+,*> , where + and * are binary operations and R is a set satisfying
the following properties:
1) <R,+>, is a commutative group. The additive identity is designated as 0.
2) For all x, y and z in R,
- x*y is also in R.( R is closed under *)
- x*(y*z)=(x*y)*z. (* is an associative operation)
- x*(y+z)=x*y+x*z= (y+z)*x. (* distributes over +)

Few other properties of rings are(non-properties):


1) All rings that we use have a multiplicative identity designated as 1.
2) Unlike the + operation, the operation * does not need to be commutative. If * is
commutative, the ring is called as commutative ring.
3) While each element x, in R has an additive inverse (-x), an element need not have a
multiplicative inverse(x-1).

Polynomial Rings

Zp[x] : is a set of all polynomials in x with coefficients belonging to Zp.


-Polynomial addition
-Polynomial multiplication
Ex: Set of all integers with + and * form an infinite ring
Ex: Set of integers modulo n is a finite commutative ring

Fields

A field <R,+,*> is a commutative ring with the following additional properties:


1) R has a multiplicative identity.
2) Each element , x in R has an inverse element in R except 0.
i.e <R,+> and <R-{0},*> are commutative groups.

Ex: The set of all real numbers with regular addition and multiplication is an infinite field.
Ex: <Zn, +n,*n> is a field iff ‘n’ is prime.

Swetha K H, Asst. prof., ISE Dept., AIT Page 12


Cryptography, Network security and Cyber laws Notes 2019-2020

CHINESE REMAINDER THEOREM


Theorem: Suppose n1,n2,....nk are positive integers which are pairwise relatively prime. Then for
any given sequence of integers x1,x2,....xk, there exists an integer x solving the following system
of simultaneous congruences
x≡x1 (mod n1)
x≡x2 (mod n2)
.
.
x≡xk (mod nk)
All the solutions of this system are congruent modulo the product N=n1*n2*...*nk

Note:
How to solve for X by Chinese remainder theorem?
X=(x1.a1.α1 + x2.a2. α2+....+ xm.am. αm) mod N
xi=remainder
ai= N/ni
αi=inverse of ai mod ni (ai-1 mod ni) (can be obtained by applying extended euclid’s algorithm)

1) problem: N=210 and n1=5, n2=6, n3=7


Compute f-1(3,5,2) i.e given x1=3,x2=5,x3=2 compute x.
Ans: 23

2) Problem:An integer n, 0<=n<210, satisfies the following set of congruences


n mod 5=4
n mod 6=3
n mod 7=2
What is n?
Ans: 9

3) Problem: Apply chinese remainder theorem to find square roots of 3 modulo 143.

Ans: 82, 126, 17, 61

MODULE -1’s Chapter 2 completed

Swetha K H, Asst. prof., ISE Dept., AIT Page 13


Cryptography, Network security and Cyber laws Notes 2019-2020

Chapter 3
Basics Of Cryptography

PRELIMINARIES
Cryptography: is the science of disguising messages so that only the intended recipient can
decipher the received message.
• Cryptography maintains confidentiality, integrity of messages. It provides message
authentication and digital signatures.
• Useful in e-banking, e-commerce, e-trading.

Plaintext: The original message or document to be transferred.


Ciphertext: The disguised version of plaintext.
Encryption: The process of disguising the original plaintext.
Decryption: The process of recovering the original plaintext from ciphertext.

• Encryption involves use of encryption function or algorithm denoted by E and encryption


key, e.
c=Ee(p)
• Decryption involves the use of a decryption function denoted by D and a decryption key,
d.
p=Dd(c)
• p denotes block of plaintext.
• c denotes ciphertext.

Types of cryptography
There are 2 types of cryptography:

1) Secret Key Cryptography


2) Public key Cryptography

Secret Key Cryptography: both sender and receiver share a common secret key. So
e=d. It is also called as symmetric key cryptography.

Public key Cryptography: Two distinct keys forming a key pair are used. Encryption
key is called as public key and decryption key is called as private key. It is also called as
Asymmetric key cryptography.

Swetha K H, Asst. prof., ISE Dept., AIT Page 14


Cryptography, Network security and Cyber laws Notes 2019-2020

• The 2 best known secret key cryptography algorithms are:


1) DES (Data Encryption Standard) and
2) AES (Advanced Encryption Standard)

Other secret key algorithms are Blowfish and RC4.

Public key algorithms are:

1) RSA and
2) ECC (Elliptic curve cryptography)

Choosing a particular cryptographic algorithm depends on many factors.

• Ease of implementation
• Hardware requirements
• Performance characteristics
• Security

Types of Attacks
Cryptographic algorithm is secure if a cryptanalyst is unable to,

• Obtain the corresponding plaintext from a given cipher text.


• Deduce the secret key or the private key

1) Known cipher text attack: Attacker accumulates lot of ciphertexts. Then looks for
patterns in the cipher text to reconstruct some plaintext or to deduce the key.
2) Known plain text attack: All or part of some plaintext blocks are predictable.
Cryptanalyst builds a collection of corresponding plaintext, ciphertext pairs to deduce
key.

Known plaintext attack is a brute force attempt at obtaining key by trying all possible key
values.

for(each potential key value, k in the key space)


{
Proceed=true;
i=1;
While(proceed==true && i<=m)
{
If(ci!=Ek(pi))
proceed=false;
i++;
}
If(i=m+1)
Print(“key value is k”);

Swetha K H, Asst. prof., ISE Dept., AIT Page 15


Cryptography, Network security and Cyber laws Notes 2019-2020

Elementary substitution ciphers


There are 2 types in elementary substitution ciphers

1)Monoalphabetic ciphers
2) Polyalphabetic ciphers

1)Monoalphabetic ciphers:
Let Σ denote the set of alphabets {A,B,.....Z}. A monoalphabetic substitution cipher defines a
permutation of the elements in Σ .


The simplest substitution cipher is one that replaces each alphabet in a text by the
alphabet k positions away.
• Ex: k=3
The substitutions are D for A, E for B etc.
This scheme is also called as caesar cipher.

Plaintext: WHAT IS THE POPULAT ION OF MARS

Ciphertext: ZKDW LV WKH SRSXODWLRQ RI PDUV

2) Polyalphabetic ciphers: In this, The ciphertext corresponding to a particular character in


plaintext is not fixed.

Two examples of such ciphers are:


i) Vigenere cipher
ii) Hill cipher
iii) One time pad

i) Vigenere cipher: It is a polyalphabetic cipher that uses a multi-digit key, k1,k2,k3,....km.


Here k1,k2,k3,....km are integers.
• The plaintext is split into non-overlapping blocks each containing m consecutive
characters.
• The first letter of each block is replaced by letter k1 positions to its right, the 2nd letter of
each block replaced by letter k2 positions and so on.

Ex:
Plaintext: wishing you much success
Key: 4 19 3 22 7 12 5 11 4 19 3 22 7 12 5 11 4 19 3 22 7
Ciphertext: A B V D P Y L JS N PQJ T XFGVHOZ

Swetha K H, Asst. prof., ISE Dept., AIT Page 16


Cryptography, Network security and Cyber laws Notes 2019-2020

ii) Hill cipher: it is polyalphabetic cipher proposed by Lester Hill.


• Plaintext is broken into blocks of size m.
• The key is a m x m matrix of integers between 0 and 25.
• Each character in ciphertext is a function of all the characters in that block.

C1=p1*k11+p2*k21+....+pmkm1 mod 26
C2=p1*k12+p2*k22+....+pmkm2 mod 26
.
.
Cm=p1*k1m+p2*k2m+....+pmkmm mod 26
C=Pk
P=Ck-1

Problems on hill cipher

Problem 1: encrypt and decrypt the plaintext “HI” where key


k= 3 7
15 12 using Hill cipher technique.
Ans: Encrypted msg is “L P”

Problem 2: Encrypt and decrypt the Plaintext “HELP” , where key


k= 3 3
2 5 using Hill cipher technique.
Ans: Encrypted msg is “DPLE”

Problem 3: Encrypt the plaintext “CRYPTOGRAPHY” where key is


K= 9 4
5 7 using hill cipher technique.
Ans: Encrypted msg is “ZXFTHSJNXBBO”

iii) One time pad: The most secure cipher is a one time pad.
• Encryption is similar to vigenere cipher technique, but in one time pad, key size will be
same as plaintext size.
• There is no repeating of keys.
• Each character is encrypted with a random key.

Elementary Transposition cipher

• A transposition cipher shuffles, rearranges or permutes the bits in a block of plaintext.


• (Here we work with characters rather than bits.)
• Ex: plaintext: Begin operation at noon

Swetha K H, Asst. prof., ISE Dept., AIT Page 17


Cryptography, Network security and Cyber laws Notes 2019-2020

arrange this plaintext in a matrix row by row


b e g i
n o p e
r a t i
o n a t
n o o n

Rearrange the rows as follows


Row 1-> 3, Row 2-> 5, Row 3-> 2, Row 4-> 1, Row 5-> 4.
The resulting matrix is:
o n a t
r a t i
b e g i
n o o n
n o p e

Now rearrange the column as follows:


Column 1 -> 4, Column 2 -> 3, Column 3-> 1, Column 4 -> 2
The resulting matrix is:
a t n o
t i a r
g i e b
o n o n
p e o n

The cipher text thus generated is:

ATNOTIARGIEBONONPEON

To decrypt the message, cast the cipher text in a 5 x 4 matrix, reverse the column shuffles and
then reverse the row shuffles.

Other cipher properties

1) Confusion and diffusion


2) Block ciphers and stream ciphers

1) Confusion and diffusion: Confusion is property of cipher which provides no clue


regarding the relationship between the ciphertext and the key.

Swetha K H, Asst. prof., ISE Dept., AIT Page 18


Cryptography, Network security and Cyber laws Notes 2019-2020

• Diffussion is concerned with the relationship between the plaintext and the corresponding
ciphertext. Block of plaintext scattered across the block of cipher text.

• If block of plaintext is scattered across block of ciphertext, changing a single bit in


plaintext block will have effect on changing each bit of ciphertext block by probability of
0.5.

• Strong substitution function enhances confusion while transposition is used to enhance


diffusion.
• Usually both substitution and transpositions are combined to create product ciphers

2) Block ciphers and stream ciphers: in block ciphers plaintext is split into fixed size
chunks called blocks and each block is encrypted separately.
• Examples for block ciphers are: DES,AES,RSA and ECC
• Block cipher size are: 64 bits in DES, 128 bits in AES, 768 or more bits in RSA, 200 bits
in ECC.
• Stream ciphers operate on bits. They generate pseudo random keystream and a per
message bit string.
• Ex: One time pad, RC4
• Stream ciphers are vulnerable to attacks.

MODULE -1’s Chapter 3 completed

Swetha K H, Asst. prof., ISE Dept., AIT Page 19


Cryptography, Network security and Cyber laws Notes 2019-2020

Chapter 4
Secret Key Cryptography

There are two types of secret key ciphers:


1) Stream ciphers
2) Block ciphers

Most of the secret key ciphers are based on product cipher.

PRODUCT CIPHERS
• A cipher which is obtained by cascading S-boxes and P-boxes alternately is called as
product cipher.
• There are three operations that takes place in sequence,
1) An operation involving a function of the encryption key.
2) Substitution and
3) Permutation.

Three-round SPN network

• These 3 operations are repeated over many rounds.

Swetha K H, Asst. prof., ISE Dept., AIT Page 20


Cryptography, Network security and Cyber laws Notes 2019-2020

• The first operation involves ⨁ (XOR) ing input of that round (iteration) and the round
key. The round key is function of bits in encryption key.

• The second operation is Substitution, which is done using s-box.


• S-box is a substitution box, which is a device that takes as input a binary string of length
m and returns as output string of length n. (most of the time m=n).
• S-box is implemented using table of 2m rows with each row containing n-bit value.
• The input to the S-box is used to index the table which returns the n-bit output.

• If the block size of cipher is b, the size of table that implements b x b s-box is b x 2b bits.
• To save table space, single s-box is broken into multiple s-boxes.
• If ‘s’ is the number of s-boxes, the number of inputs to each s-box is ‘b/s’. So the
corresponding table will be of size b/s x 2b/s bits.
• S-box injects non linearity.

• Third round is permutation, which is done using p-box.


• P-box is permutation box, which performs a permutation or re-arrangement of the bits in
its input.
• So it diffuses or spreads contiguous bits of input across the block.

DES CONSTRUCTION
• DES is the successor to lucifer cipher, Lucifer cipher was designed by IBM in 1960s.

Fiestal structure:

• The DES block size is 64 bits.


• DES uses either 56 or 128 bits keys.
• A single block of plaintext is converted to ciphertext after passing through following
stages.

1) An initial permutation
2) 16 rounds of a given function.
3) A 32-bit left –right swap and
4) A final permutation.

Swetha K H, Asst. prof., ISE Dept., AIT Page 21


Cryptography, Network security and Cyber laws Notes 2019-2020

DES operations

• Each of the 16 rounds is functionally identical.


• Structure of each round in DES is as follows,
• Let Li-1 and Ri-1 be the left and right halves of the input to round i.
Li=Ri-1
Ri=Li-1 f(Ri-1,Ki)

• The function `f `is called as round function.


• Ki is the round key derived from DES key

• The decryption involves obtaining Li-1 and Ri-1 from Li and Ri. It proceeds from bottom to
top.
Ri-1 = Li
Li-1 = Ri f(Li , Ki)

• The function ‘f’ in DES does not have to be invertible (f-1) to decrypt.
• The cipher having such non-invertible structure is called as fiestel cipher.

Round Function:

A round function involves four operations:


1) Expansion
2) ⨁ (XOR) with the round key
3) Substitution
4) Permutation

Swetha K H, Asst. prof., ISE Dept., AIT Page 22


Cryptography, Network security and Cyber laws Notes 2019-2020

• The input to the round function is Ri-1, a 32-bit quantity.


• This is expanded to 48 bits by repeating some bits or interchanging their positions.

• The 48 bit quantity is then ⨁ ed with the round key.


• The result of ⨁ operation is divided into eight 6-bit chunks.
• Each chunk is substituted by 4-bit chunk.
• 8 different s-boxes provide 8 substitutions. (where s-box size is 4 X16)
• 2 bits of ith chunk serve as row index and remaining 4 bits serve as column index.
• The output of the s-box is 4-bit string pointed to by the row and column indices.

S-box implementation using table lookup

MODULE 1 Chapter 4 completed

MODULE 1 Completed

Swetha K H, Asst. prof., ISE Dept., AIT Page 23

You might also like