0% found this document useful (0 votes)
42 views56 pages

CNS Unit 1

Uploaded by

vinaydarling063
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)
42 views56 pages

CNS Unit 1

Uploaded by

vinaydarling063
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/ 56

CRYPTOGRAPHY AND NETWORK SECURITY

UNIT-1
ATTACKS ON COMPUTERS AND COMPUTER SECURITY
INTRODUCTION:
Computer data often travels from one computer to another, leaving the safety of its protected
physical surroundings. Once the data is out of hand, people with bad intention could modify or
forge your data, either for amusement or for their own benefit.
Cryptography can reformat and transform our data, making it safer on its trip between
computers. The technology is based on the essentials of secret codes, augmented by modern
mathematics that protects our data in powerful ways.
Computer Security: Generic name for the collection of tools designed to protect data and to
thwart hackers.
Network Security: Measures to protect data during their transmission.
Internet Security: Measures to protect data during their transmission over a collection of
interconnected networks.

NETWORK SECURITY
Network security consists of policies and practices adopted to prevent monitor from
unauthorized access, misuse, modification, denial of a computer network and network
accessible resources.
It involves the authorization of access to data in a network, which can be modified by the
network administrator. There are three main aspects of the network security prevention,
protection and security.

There are basically 14 types of network security.

1. Firewalls

2. Email Security

3. Anti- virus and Anti-Malware software’s

4. Network Segmentation

5. Access Control

6. Application Security

7. Behavioral analytics
8. Data loss prevention

9. Intrusion Prevention system

10. Mobile device security

11. Security Information

12. VPN

13. Web security

14. Wireless security

1. Firewalls: - Firewalls put up a barrier between your trusted internal networks and
untrusted outside networks, such as the internet. A firewall can be hardware, software, or,
both. Cisco offers unified threat management (UTM) devices and threat- focused next
generation firewalls.

2. Email Security: - Email gateways are the number one threat vector for a security breach.
Attackers use personal information and social engineering tactics to build sophisticated
phishing campaigns to deceive recipients and send them to sites serving up malware.

3. Anti-virus and Anti-Malware Software’s :- “Malware“, short for “malicious software”,


includes viruses, worms, Trojans, ransom ware, and spyware. Sometimes malware will infect a
network but lie dormant for days or even weeks.

4. Network Segmentation:-Software-defined segmentation puts network traffic into


different classifications and makes enforcing security policies easier. Ideally, the classifications
are based on endpoint identity, not mere IP addresses.

5. Access Control: - Not every user should have access to your network. To keep out
potential attackers, you need to recognize each user and each device. Then you can enforce
your security policies. You can block noncompliant endpoint devices or give them only limited
access. This process is network access control (NAC).
6. Application Security: - Any software you use to run your business needs to be protected,
whether your IT staff builds it or whether you buy it. Unfortunately, any application may
contain holes, or, vulnerabilities, that attacker can use to infiltrate your network.

7. Behavioral Analysis: - To detect abnormal network behavior, you must know what
normal behavior looks like. Behavioral analytics tools automatically discern activities that
deviate from the norm. Your security team can then better identify indicators of compromise
that pose a potential problem and quickly remediate threats.
8. Data Loss Prevention : - Organizations must sure that their staff does not send sensitive
information outside the network. Data loss prevention, or DLP, technologies can stop people
from uploading.

9. Intrusion Prevention System: - An intrusion system (IPS) scans network traffic to


actively block attacks. Cisco Next- Generation IPS (NGIPS) appliances do this by correlating huge
amounts of global threat intelligence to not only block malicious activity but also track the
progression of suspect files and malware across the network to prevent the spread of
outbreaks and reinjection.

10. Mobile Device Security: - Cybercriminals are increasingly targeting mobile devices and
apps. Within the next 3 years, 90 percent of IT organizations may support corporate
applications on personal mobile devices.

11. Security Information: - SIEM products pull together the information that your security
staff needs to identify and respond to threats.

12. VPN: - A virtual private network encrypts the connection from an endpoint to a network
often over the internet. Typically, a remote-access VPN uses IPSec or Secure Sockets Layer to
authenticate the communication between device and network.

13. Web Security: - A web security solution will control your staff’s web use, block web
based threats, and deny access to malicious websites. It will protect your web gateway on site
or in the cloud. “Web security “also refers to the steps you take to protect your own website.

14. Wireless Security: - Wireless networks are not as secure as wired ones. Without
stringent security measures, installing a wireless LAN can be like putting Ethernet ports
everywhere, including the parking lot.

Steps to improve Network Security:


Establish and enforce a proven password strategy
 Use a secure backup plan
 Purchase some protection
 Create a security culture.

TYPES OF NETWORK SECURITY DEVICES


Active Devices
These security devices block the surplus traffic. Firewalls, antivirus scanning devices, and
content filtering devices are the examples of such devices.
Passive Devices
These devices identify and report on unwanted traffic, for example, intrusion detection
appliances.

Preventive Devices
These devices scan the networks and identify potential security problems. For example,
penetration testing devices and vulnerability assessment appliances.

Unified Threat Management (UTM)


These devices serve as all-in-one security devices. Examples include firewalls, content filtering,
web caching etc.

Firewalls
A firewall is a network security system that manages and regulates the network traffic based on
some protocols. A firewall establishes a barrier between a trusted internal network and
internet.
Firewalls exist both as software that run on a hardware and as hardware appliances. Firewalls
that are hardware- based also provide other functions like acting as a DHCP server for that
network.
Most personal computers use software- based firewalls to secure data from threats
from the internet. Many routers that pass data between networks contain firewall components
and conversely, many firewalls can perform basic routing functions.
Firewalls are commonly used in private networks or interact to prevent unauthorized access
from the internet. Every message entering or leaving the internet goes through the firewall to
be examined for security measures.
An ideal firewall configuration consists of both hardware and software based devices. A
firewall also helps in providing remote access to a private network through secure
authentication certificates and logins.

Hardware and software Firewalls


Hardware firewalls are standalone products. These are also found in broadband routers. Most
hardware firewalls provide a minimum of four network ports to connect other computers. For
larger networks-e.g.; for business purpose - business networking firewall solutions are
available.
Software firewalls are installed on your computers. Software firewall protects your
computer from internet threats.

Antivirus
An antivirus is a tool that is used to detect and remove malicious software. It was originally
designed to detect and remove viruses from computers.
Modern antivirus software provides protection not only from virus, but also
from worms, Trojan-horses, adware, spywares, key loggers etc. Some products also provide
protection from malicious URLs, spam, phishing attacks, bonnets, DDoS, attacks, etc.
Content Filtering
Content filtering devices screen unpleasant and offensive emails and WebPages.. These are
used as a part of firewalls in corporation as well as in personal computers. These devices
generate the message "Access Denied" when someone tries to access any unauthorized web
pages or email.
Content is usually screened for pornographic content and also for violence-or-
hate-oriented content. Organizations also exclude shopping and job related contents.
Content filtering can be divided into the following categories:

Web Filtering
Screening of websites or pages
E-mail filtering
Screening of e-mail for spam
Other objectionable content

Intrusion Detection Systems


Intrusion Detection Systems, also known as Intrusion Detection and Prevention Systems, are
the appliances that monitor malicious activities in a network, log information about such
activities , take steps to stop them, and finally report them.
Intrusion Detection Systems help in sending an alarm against any malicious activity
in the network, drop the packets, and reset the connection to save the IP address from any
blockage. Intrusion Detection Systems can also perform the following actions-

Correct Cyclic Redundancy Check (CRC) errors


Prevent TCP sequencing issues
Clean up unwanted transport and network layer options

MODEL FOR NETWORK SECURITY


Symmetric and public key algorithms
Encryption/Decryption methods fall into two categories.
Symmetric key
Public key
In symmetric key algorithms, the encryption and decryption keys are known both to sender and
receiver. The encryption key is shared and the decryption key is easily calculated from it. In
many cases, the encryption and decryption keys are the same.
In public key cryptography, encryption key is made public, but it is computationally infeasible to
find the decryption key without the information known to the receiver.
A message is to be transferred from one party to another across some sort of internet. The two
parties, who are the principals in this transaction, must cooperate for the exchange to take
place. A logical information channel is established by defining a route through the internet from
source to destination and by the cooperative use of communication protocols (e.g., TCP/IP) by
the two principals.
Using this model requires us to:
- Design a suitable 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.

Using this model requires us to:


- Select appropriate gatekeeper functions to identify users
- Implement security controls to ensure only authorized users access designated information or
resources
 Trusted computer systems can be used to implement this model

SECURITY ATTACKS:
Interruption: This is an attack on availability.
Interception: This is an attack on confidentiality.
Modification: This is an attack on integrity.
Fabrication: This is an attack on authenticity.

SECURITY SERVICES:
Security service is a service that enhances the security of data processing systems and
information transfers. A security service makes use of one or more security mechanism.

The main objective of security services is to achieve:


 Confidentiality (privacy) of data.
 Authentication (who created or sent the data)
 Integrity of data where the data has not been altered by unauthorized entity.
 Non-repudiation (the order is final)
 Access control is to prevent misuse of resources.
 Availability of data means data should be continuously transmitted without
interruptions and will protect data from Denial of Service Attacks and Virus that deletes
files.
SECURITY MECHANISMS
A mechanism that is designed to detect, prevent, or recover from a security attack is a Security
mechanism. Figure below shows the taxonomy of security mechanisms.

Encipherment
Encipherment, hiding or covering data can provide confidentiality. It can also be used to
complement other mechanisms to provide other services.
Data Integrity
Information needs to be changed constantly. Integrity means that changes need to be done
only by authorized entities and through authorized mechanisms.
Authentication Exchange
In authentication exchange, two entities exchange some messages to prove their identity to
each other.
Digital Signature
A digital signature is a means by which the sender can electronically sign the data and the
receiver can electronically verify the signature. The sender uses a process that involves showing
that he owns a private key related to the public key to prove that the message is indeed signed
by the public key that she has announced publicly. The receiver uses the sender's public
key to prove that the message is indeed signed by the sender who claims to have sent the
message.
Traffic Padding
Traffic padding means inserting some bogus data into the data traffic to thwart the
adversary's attempt to use the traffic analysis.
Routing Control
Routing control means selecting and continuously changing different available routes between
the sender and the receiver to prevent the opponent from eavesdropping on a particular note.
Notarization
Notarization means selecting a third trusted party to control the communication between two
entities. This can be done to prevent repudiation. The receiver can involve a trusted party to
store the sender request in order to prevent the sender from later denying that he has made
such a request.
Access Control
Access Control uses methods to prove that a user has access rights to the data or resources
used by a system.
Example: use of login passwords and PINs.

NEED FOR SECURITY


Most initial computer applications had no or at best, very little security. This continued for a
number of years until the importance of data was truly realized. Until then, computer data was
considered to be useful, but not something to be protected. When computer applications were
developed to handle financial and personal data, the real need for security was felt like never
before. People realized that data on computers was an extremely important aspect of modern
life. Therefore, various areas in security begin to gain prominence. Two typical examples of such
security mechanism were as follows:
 Provide a user id and password to every user and use that information to authenticate a
user.
 Encode information stored in the databases in some fashion so that it is not visible to
users who do not have the right permissions.

Now, an attacker can simply succeed in accessing this database and gain access to all the credit
card numbers stored therein! One Russian attacker (called as maxim) actually managed to
intrude into a merchant internet site and obtained 300,000 credit card numbers from its
database. He then attempted extortion by demanding protection money ($ 100,000) from the
merchant. The merchant refused to oblige. Following this, the attacker published about 25,000
of the credit card numbers on the internet! Some banks reissued all the credit cards at a cost of
$20 per card and others forewarned their customers about unusual entries in their statements.
In 1995, a Russian hacker broke into Citibank’s computers remotely, stealing $ 12 million.
Although the attacker was traced, it was very difficult to get him extradited for the court case.
Network security is an activity designed to protect the usability and integrity of our network
and data. It includes both hardware and software technologies. It targets a variety of threads it
prevents them from entering or spreading our network. The aim of network security is the
confidentiality and accessibility of the data and network.

SECURITY APPROACHES
Trusted Systems
A Trusted System is a computer system that can be trusted to a specified extent to enforce a
specified security policy.
Trusted systems were initially of primary interest to the military. However, these days, the
concept has spanned across various areas, most prominently in the banking and financial
community, but the concept never caught on.

Trusted systems often use the term reference monitor. This is an entity that is at the heart of
the computer system. It is mainly responsible for all the decisions related to access signals.
Naturally, the following are the expectations from the reference monitor.

 It should be tamperproof
 It should always be invoked
 It should be small enough so that it can be independently tested
Security Models:
An organization can take several approaches to implement its security model.
 No security: In this simplest case, the approach could be a decision to implement no
security at all.
 Security through obscurity: In this model, a system is secure simply because nobody
knows about its existence and contents. This approach cannot work for too long, as
there are many ways an attacker can come to know about it.
 Host Security: In this scheme, the security for each host is enforced individually. This is a
very safe approach, but the trouble is that it cannot scale well. The complexity and
diversity of modern sites/organizations makes the task even harder.
 Network Security: Host security is tough to achieve as organizations grow and become
more diverse. In this technique, the focus is to control network access to various hosts
and their services, rather than individual host security. This is a very efficient and
scalable model.
Security management practices
Good Security management practices always talk of a security policy being in place, putting a
security policy in place is actually quite tough. A good security policy and its proper
implementation go a long way in ensuring adequate security management practices. A good
security policy generally takes care of four keys aspects, as follows:
 Affordability: Cost and effort in security implementation
 Functionality: Mechanism of providing security
 Cultural issues: Whether the policy gels well with people’s expectations, working style
and beliefs.
 Legality: Whether the policy meets the legal requirements.

PRINCIPLES OF SECURITY
There are 4 chief principles of security along with access control and availability.
1. Confidentiality:
The principle of confidentiality specifies that only the sender and the intended recipient should
be able to the accessance the contentment of message confidentiality gets compromised if an
unauthorized person is able to access a message. The following figure indicates the loss of
confidentiality.
In the above diagram, ‘A’ is sender, ’B’ is intended receiver but that secret message is READ by
‘C’ is the third person. So, it is said to be loss of confidentiality that type of attack is called
interception.
Interception causes loss of confidentiality.
2. Authentication:
Authentication mechanism helps establish proof of identifying the authentication process
ensures that origin of an electronic message is document is correctly identified. If an
unauthenticated person can access the message this type of attack is called Fabrication.
Fabrication is possible in the absence of proper authentication mechanism. Lack of
authentication is called Fabrication.

3. Integrity:
When the content of message is changed before it reaches the intended recipient, we saw that
the integrity of the message is loss. This type of attack is called Modification. Modification
causes loss of message integrity. Consider the diagram.

4. Non-Reputation:
There are some situations where a user sends a message and later or refuses that he has sent
that message.
For ex: A could send a fund to transfer request a bank B over the internet. After the request a
bank B over the internet. After the bank
Performs the funds transfer as per A’s instruction, A could claim that never sent the fund
transfer instruction to bank.
A Non reputation does not allow the sender of a message to refuse the claim of not sending
that message.
5. Access control:
The principle of access control determines who should be able to access what. For instance, we
should be able to specify that user A can view the records in the database but cannot update
them. However, user B might be allowed to make updates as well. Because access control
mechanism can be setup to ensure this finally, access control specifies and controls which user
can access what.
6. Availability:
The principle of availability states that resources(information) should be available to authorized
parties at all times. Under some circumstances an authorized user may not be able to contact a
server computer. This type of attack is said to be an interruption. In one word, interruption puts
the availability of resources in danger.
Ex: Trojan horse

TYPES OF ATTACKS
An attack is an attempt by the unauthorized access to an organization network and with the
objective of stealing data or performs other malicious activity. In other words, an attack is one
of the biggest security threats in information technology. It comes in different forms. Attacks
can cause slow network performance, uncontrolled traffic or viruses etc.

We shall classify attacks with respect to 2 views.


1. The common person’s view
2. A Technologist view
1. The common person’s view:
In common person’s view, attacks can be classified into 3 types:
a. Criminal Attacks
b. Publicity Attacks
c. Legal Attacks
 Criminal Attacks: The criminal attacks are the simplest to understand. Here the soul aim
of the attackers is to maximize financial gain by attacking computer systems. For
example, fraud scams, destruction, identify theft, intellectual property theft and brand
theft etc.
 Publicity Attacks: Publicity attacks occur because the attackers want to see their names
appear on television news channels and newspapers.
 Legal Attacks: This form of attacks is quite novel and unique. Here, the attacker tries to
make the judge or jury doubtful about the security of the computer system.
2. A Technologist view:
From the technical point of view, we can classify the types of computer network systems into 2
categories:
a. Theoretical concepts behind these attacks
b. Practical approach used by the attackers
 Theoretical concepts behind these attacks: These attacks are generally classified into 4
categories.
 Intersection: loss of message confidentiality.
 Fabrication: Absence of proper authentication mechanism.
 Modification: loss of message integrity.
 Interruption: put the available resources in danger.
These are classified into: 1. Passive attacks
2. Active attacks

1. Passive Attacks:
Passive attacks are those wherein the attacker indulges in eaves dropping or monitoring of data
transmission. In other words, the attacker aims to obtain information that is in transmitted. The
term “passive” indicates that the attacker does not attempt to perform any modifications to
data. It is very difficult to identify. It is a better solution to prevent the message rather than
detection and correction.
For example, loss of confidentiality comes from under passive attacks. Again, the passive
attacks are classified into 2 types.
 Release of message content: When we send a confidential message to our friend. We
feel he is the desired person to open that message. But it should be opened by others.
So, is loss of confidentiality.
 Traffic Analysis: Depending on the transmission of same type of pattern, the attacker
can guess and analysis the messages to come up with likely patterns or the works of the
traffic analysis attack.

2. Active Attacks:
Unlike passive attacks, the active attacks are based on modification of the original
message in some other manner (or) the creation of a false message. These attacks cannot be
prevented easily. These attacks can be in the form of four Categories:
⦁ Masquerade (Interruption)
⦁ Modification
⦁ Fabrication (Daniel of Service).
⦁ Replay attacks
Consider the diagram

 Masquerade (Interruption): Masquerade is caused when an unauthorized entity


pretends to be another entity." For example: - ‘A ‘sends a message to ‘B’. But user 'c'
Can capture the security that means user "c" might pose as User ‘A’ and send a message
to user B'. But 'B' Might be led to believe that the message intended Come from user A.
In masquerade attacks an entity poses another entity. As an instance the attack may
involve capture the user authentication Sequence that is user I’d and password.
 Modification: At the time of data transmission, the attacker can capture the secret
information and change the content of the message and change the content of the
message and sends to the sender. It is also said to be a loss of integrity.
Modification is of 2 types:
a. Replay attack
b. Alteration
a) Replay Attack: In replay attack, a user captures sequence of events (or) some data units and
resends them for instance. Suppose user A wants to transfer some amount to user C’s bank
account. Both user A and C have accounts with bank B. User ‘A’ might send an electronic
message to bank B, requesting for the funds transfer. User ‘C’ could capture this message and
send a second copy of the same message to bank ‘B’. Bank B would have no idea that it was an
unauthorized message and would treat it as a new one. So, the same transaction will be
performed twice. One is authorized and the second is replay attack.
b) Alteration: Alteration of message involves some changes to original message. For example:
Suppose user ‘A’ sends an electronic message transfer $1000 to D’s account in bank B. ‘C’ can
capture that information and perform the change from $10000 to C’s account.
C) Fabrication (Daniel of service): Daniel of service attacks makes an attempt to prevent
legitimate users from accessing some services.

CRYPTOGRAPHY AND ITS TECHNIQUES


Cryptography: Cryptography is the art and science of achieving security by encoding
messages to make them Non-readable.

Crypt analysis: Crypt analysis is the technique of decoding the message from Non-readable
format back to the readable without knowing how they were initially converted from readable
format to non-readable format.

Cryptology: Cryptology is the combination of cryptography and cryptanalysis.

Cryptography

+ = Cryptology

Cryptanalysis

Cipher text:

When a plain text message is codify using any suitable scheme, the resulting message is called
cipher text.
For ex: A scheme for codifying message by replacing each alphabet with an alphabet 3 places
down the line.

For ex:

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
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

I AM GOING TO PICTURE

L DP JRLUJ UR SLFWXUH

Caesars Cipher:
The scheme of replacing the alphabets with the 3 places down the line was first proposed by
Julius Caesar and it is termed as Caesar cipher. It was first example of substitution cipher. In the
substitution cipher technique, the characters of the plain text messages of replaced by
characters, numbers or symbols.

Caesars cipher is a special case of substitution techniques where in each alphabet in a


message is replaced by an alphabet 3 places down the line.

EXAMPLE:

I AM GOING TO PICTURE

L DP JRLUJ WR SLFWXUH

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
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Clearly, the Caesar cipher is a very weak scheme of hiding plain text messages it is a very
easy to identify how the message has to be converted from planning text to cipher text. The
procedure is:

STEP-1: Read each alphabet in the cipher text message, and search for second row of the
replacement table.

STEP-2: When a month is found, replace the alphabet in the cipher text with the
corresponding alphabet. In the same column that is the first row of the table.

EXAMPLE: If the cipher text letter is ‘J’ the corresponding letter in the planning text is ‘G’.

STEP-3: Repeat the process for all alphabets in the cipher text message.

Cipher text: L DP JRLUJ WR SLFWXUH


L D P J R L U J W R S L F W X U H
I A M G O I N G T O P I C T U R E

Modified version Caesars cipher:

Caesar cipher is good in theory but not good in practice so it should be converted into little bit
difficult to attackers they have introduced version of Caesars cipher. In modify version the
cipher text alphabets corresponding to the original plain text alphabet may not necessary be 3
places down the line. But instant, it can be any placed down the line that means it can be
replaced by any valid alphabet that is ‘E’ or by ‘G’ and so on. Instant of ‘D’. Once the
replacement scheme is decided, it would be constant and will be all another alphabets in the
message. As we know English language contain 26 alphabets by B to Z(Any alphabet).That
means for each alphabet we have 25 permutations are possibilities of replacement. Even
though it is little bit critical then Caesar cipher. It is also possible to break this modify version
also.

Procedure:

Algorithm to break the modified Caesars cipher.

Step-1: let 'k' be a number=1

Step-2: Read the complete cipher text message

Step-3: Replace each alphabet in the cipher text message with an alphabet
that is 'k' positions down the order.

Step-4: Increment k/1

Step-5: If 'k' is less than 26 then go to step 2. Otherwise stop the process

Step-6: The original text message corresponding to the cipher text message is one of the 25
possibilities produced by the above steps.

Cipher Text K W U M P M Z M

1 L X V N Q N A N
2 M Y W O R O B O
3 N Z X P S P C P
4 O A Y Q T Q D Q
5 P B Z R U R E R
6 Q C A S V S F S
7 R D B T W T G T
8 S E C U X U H U
9 T F D V Y V I V
10 U G E W Z W J W
11 V H F X A X K X
12 W I G Y B Y L Y
13 X J H Z C Z M Z
14 Y K I A D A N A
15 Z L J B E B O B
16 A M K C F C P C
17 B N L D G D Q D
18 C O M E H E R E
19 D P N F I F S F
20 E Q O G J G T G
21 F R P H K H U H
22 G S Q I L I V I
23 H T R J M J W J
24 I U S K N K X K
25 J V T L O L Y L

SUBSTITUTION AND AFFINE CIPHER


AFFINE CIPHER:

The affine cipher is a type of monoalphabetic substitution cipher, where each letter in
an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical
function, and converted back to a letter. The formula used names that each letter encrypts to
one other letter, and back again, meaning the cipher is essentially a standard substitution
cipher with a rule governing which letter goes to which. As such, it has the weakness of all
substitution ciphers. Each letter is encrypted with the function (ax + b) mod 26, where b is the
magnitude of the shift.

Description: Here, the letters of an alphabet of size m are first mapped to the integers in the
range 0....m-1. It then uses modular arithmetic to transform the integer that each plaintext
letter corresponds to into another integer that corresponds to a cipher text letter. The
encryption function for a single letter is :

E(x) = (ax + b) mod m

Where modulus m is the size of an alphabet and a and b are the keys of the cipher. The value
a must be chosen such that a and m are co prime. The decryption function is:

D(x) = a -1(x - b) mod m


Where a-1 is the modular multiplicative inverse of a modulo m. i.e.., Its satisfies the equation.

1 = aa-1 mod m

The multiplicative inverse of a only exists if a and m are co-prime. Hence without the restriction
on a, decryption might not be possible. It can be shown as follows that decryption function is
the inverse of the encryption function.

D(E(x)) = a-1 (E(x) - b) mod m

=a-1 (((ax + b) mod m) - b) mod m

= a-1 (ax + b - b) mod m

=a-1 ax mod m

= x mod m

Since the affine cipher is still a monoalphabetic substitution cipher, it inherits the weakness of
that class of ciphers. The Caesar cipher is an Affine cipher with a = 1 since the encrypting
function simply reduces to a linear shift. The Abash cipher uses a = -1.

Considering the specific case of encrypting messages in English (i.e. m = 26) there are a total of
286 non-trivial affine ciphers, not counting the 26 trivial Caser ciphers. This number comes from
the fact there are 12 numbers that are co prime with 26 that are less than 26 (these are the
possible value of a). Each value of a can have 26 different addition shifts (the b value)
therefore, there are 12*26 or 312 possible keys. This lack of variety renders the system as
highly insecure when considered in light of Kirchhoff’s' principle.

The cipher's primary weakness comes from the fact that if the cryptanalyst can discover (by
means of frequency analysis, brute force, guessing or otherwise) the plaintext of two cipher
text characters then the key can be obtained by solving a simultaneous equation. Since we
know a and m are relatively prime this can be used to rapidly discard many "false" keys in an
automated system.

The same type of transformation used in affine ciphers is used in linear congruential
generators, a type of pseudorandom number generator. This generator is not a
cryptographically secure pseudorandom number generator for the same reason that the affine
cipher is not secure.

Example In this example showing encryption and decryption, the alphabet is going to be the
letters A through Z, and will have the corresponding values found in the following table.
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
0 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

Encryption

Plain text A F F I N E C I P H E R
x 0 5 5 8 13 4 2 8 15 7 4 17

In this encrypting example, the plaintext to be encrypted is "AFFINE CIPHER" using the table
mentioned above for the numeric values of each letter, taking a to be 5, b to be 8, and m to be
26 since there are 26 characters in the alphabet being used. Only the value of a has a
restriction since it has to be co prime with 26. The possible values that a could be
1,3,5,7,9,11,15,17,19,21,23,and 25. The values for b can be arbitrary as long as a does not equal
1 since this is the shift of the cipher. Thus, the encryption function for this example, will be
y=E(x )= (5x + 8) mod 26. The first step in encrypting the message is to write the numeric values
of each letter.

Now, take each value of x, and solve the first part of the equation, (5x + 8). After finding the
value of (5x + 8) for each character, take the remainder when dividing the result of (5x + 8) by
26. The following table shows the first four steps of the encrypting process.

The final step in encrypting the message is to look up each numeric value in the table for the
corresponding letters. In this example, the encrypted text would be IHHWVCSWFRCP. The table
below shows the completed table for encrypting a message in the Affine cipher.

Plain text A F F I N E C I P H E R
x 0 5 5 8 13 4 2 8 15 7 4 17
(5x+8) 8 33 33 48 73 28 18 48 83 43 28 93
(5x+8)mod 8 7 7 22 21 2 18 24 5 17 2 15
26
Decryption:

In this decryption example, the cipher text that will be decrypted is the cipher text
from the encryption example. The corresponding decryption function. D(y) = 21(y - b) mod 26

Where a-1 is calculated to be 21 and b is 8. To begin, write the numeric equivalents to each
letter in the cipher text, as shown in the table below.
Cipher I H H W V C S W F R C P
text

y 8 7 7 22 21 2 18 22 5 17 2 15

Now, the next step is to compute 21(y - 8), and then take the remainder when that result is
divided by 26. The following table shows the results of both computations.

Cipher text I H H W V C S W F R C D
y 8 7 7 22 21 2 18 22 5 17 2 15
2(y-8) 0 -21 -21 294 273 -126 210 294 -63 189 -126 147
2(y-8)mod 26 0 5 5 8 13 4 2 8 11 7 4 17

The final step in decrypting the cipher text is to use the table to convert numeric values back
into letters the plaintext in the decryption is AFFINECIPHER. Below is the table with the final
step completed.

Cipher text I H H W V C S W F R C P
y 8 7 7 23 21 2 12 22 5 17 2 15
21(y-8) 0 -21 -21 294 273 -126 210 294 -67 189 -126 147
21(y-8)mod 26 0 5 5 8 13 4 2 8 11 7 4 17
Plain text A F F I N E C I P H E R

POLY-ALPAHABETIC CIPHER AND THEIR CRYPTANALYSIS


Polyalphabetic substitution cipher:
Leon Battista invented the Polyalphabetic Substitution Cipher in 1568.
This cipher has been broken many times and yet it has been used extensively. The Vigenère
Cipher and the Beaufort Cipher are examples of Polyalphabetic substitution Cipher.
This Cipher uses multiple one-character keys. Each of the keys encrypts one plain text
character. The first key encrypts the first plain text character; the second key encrypts the
second plain text character and so on. After all the keys are used, they are recycled. Thus, if we
have 30 one-letter keys, every 30th character in the plain text would be replaced with the same
key. This number (in this case, 30) is called as the period of the cipher.
The main features of Polyalphabetic Substitution Cipher are:
 It uses a set of related monoalphabetic substitution rules.
 It uses a key that determines which rule is used for which transformation.
 For example, let us discuss Vigenère Cipher, which is an example of this cipher. In this
algorithm, 26 Caesar ciphers make up the monoalphabetic substitution rules. There is a
shifting mechanism, from a count of 0 to 25. For each plain text letter, we have a
corresponding substitution, which we call as the key letter. For instance, the key value is
e for a letter with shift as 3. To understand this technique, we need to take a look at a
table, which is formally known as Vigenère tableau. This is shown in table. The logic for
encryption is quite simple. For key letter p and plain text letter q, the corresponding
cipher text letter is at the intersection of row titled p and column titled q. For this very
particular case, the cipher text, therefore, would be F, based on the above table. By
now, it should be clear that for encrypting a plain text message, we need a key whose
length is equal to that of the plain text message. Usually, a key that repeats itself is
used.

I A M G O I N G T O P I C T U R E
B E S T B E S T B E S T B E S T B

Vigenère Table:
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
a 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
b 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 A
c C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
d D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
e E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
f F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
g G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
h H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
i I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
j J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
k K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
l L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
m M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
n N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
o O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
p P Q R S T U V W X Y Z A B C D E F G H I J K L M N 0
q Q R S T U V W X Y Z A B C D E F G H I J K L M N 0 P
r R S T U V W X Y Z A B C D E F G H I J K L M N 0 P Q
s S T U V W X Y Z A B C D E F G H I J K L M N 0 P Q R
t T U V W X Y Z A B C D E F G H I J K L M N 0 P Q R S
u U V W X Y Z A B C D E F G H I J K L M N 0 P Q R S T
v V W X Y Z A B C D E F G H I J K L M N 0 P Q R S T U
w W X Y Z A B C D E F G H I J K L M N 0 P Q R S T U V
x X Y Z A B C D E F G H I J K L M N 0 P Q R S T U V W
y Y Z A B C D E F G H I J K L M N 0 P Q R S T U V WX
z Z A B C D E F G H I J K L M N 0 P Q R S T U V WX Y

The Caesar and the multiplication Cipher are not


Cipher text K F F A Q N G A V T I C E Y N L G
Key B E S T B E S T B E S T B E S T B
Decryption
Consider the Encryption message and keyword again and identify the consider letter for plain
text.
Cipher text K F F A Q N G A V T I C E Y N L G
key B E S T B E S T B E S T B E S T B
plaintext I A M G O I N G T O P I C T U R E

ENCRYPTION USING THE LINEAR CIPHER


Secure Ciphers. To improve the security of an encrypted document we combine the Caesar and
the multiplication cipher: we first multiply each plain letter by an integer a as done in the
multiplication cipher and consequently shift it by b positions. We therefore obtain the following

Definition of the linear cipher:


The linear Cipher encodes each plain letter P to a Cipher letter C using the following
encoding function:
C=a*P + b MOD M
Where the encoding key consists of the pair of integers (a, b).
We call a the factor key and b the shift key.
Example
Let’s start by checking the factor key a=2 and the shift key b=4. Thus, we use the
encryption function C=2*P + 4 MOD 26 to encode the virus carrier message as follows:
PLAIN A N T I S T H E C A R R I E R
TEXT
P 0 13 19 8 18 19 7 4 2 0 17 17 8 4 17
2*P 0 0 12 16 10 12 14 8 4 0 8 8 16 8 8
C=2*P+4 4 4 16 20 14 16 18 12 8 4 12 12 20 12 12
MOD 26
Cipher e e q u o q s m i e m m u m m
text

We observe that this encryption does not produce the desired unique encryption .I.e. both the
A and the N encode to the cipher letter e, also both R and E encode to m. The recipient does
not know for sure how to decode the cipher letters e and m resulting in ambiguous messages.
What causes the ambiguity? Is it the factor key a=2? Or the shift b=4?
The answer is easy. Shifting each letter never causes ambiguity. However, the factor key a =2
turns A=0 and N= 13 into a = 0 making the cipher code not unique. The same will happen for
any other factor key was a bad key in the Multiplication Cipher. Vice versa, if we choose the bad
factor key
a=13 and the shift key b=4. The corresponding encoding function is
C=13*P+ 4 MOD 26.
PLAIN TEXT A N T I S T H E C A R R I E R
0 13 19 8 18 19 7 4 2 0 17 17 8 4 17
↓↓↓↓↓
↓↓↓↓↓
↓↓↓↓↓

13*P 0 13 13 0 0 13 13 0 0 0 13 13 0 0 13
C=13*P+4 4 17 17 4 4 17 17 4 4 4 17 17 4 4 17
Cipher text e r r e e r r e e e r r e e r
The multiplication with the factor key a=13 only yields 0 and 13. The final shift of 4 then
produces the two ciphers letters 4=e and 17=r which makes the cipher code impossible to
decode.

Recall that a=3 was a good key for the Multiplication cipher MOD=26, so that we now encode
the virus message using the good factor key a=3 and the final shift b=4. Thus, using the
encoding function C=3*P+4 MOD 26 we obtain the following:

PLAIN A N T I S T H E C A R R I E R
TEXT
0 13 19 8 18 19 7 4 2 0 17 12 8 4 17
↓↓↓↓↓
↓↓↓↓↓
↓↓↓↓↓
3*P 0 13 5 24 2 5 21 12 6 0 25 25 24 12 25
C=3*P +4 4 17 9 2 6 9 25 16 10 4 3 3 2 16 3
Cipher e r j e g j z q k e d d c q d
text
Exercise 1: Identify the key pairs (a, b) that produce unique encryptions.

Exercise 2: Can you guess a decoding function for any encoding function? Hint: it will be again a
linear cipher.

Further questions to investigate:

1. The good keys of the Multiplication cipher serve as good factor keys for the Linear cipher.
Does this implies that there are again (M) good factor keys for a given alphabet length M?
2. How many encryptions does the linear cipher therefore allow? Do they make the linear
cipher a secure cipher?

3. We have to set up the decoding function so that the recipient can decode the encrypted
message.

4. How could an eavesdropper possibly crack linear cipher- encoded message?

PLAY FAIR
The Play fair cipher also called Play fair square, is a Cryptography technique that is used for
manual encryption of data. This scheme was invented by Charles Wheatstone in 1854.
However, eventually the scheme came to be known by the name of lord Play fair who was the
friend of Wheatstone. Play fair made this scheme popular and hence his name was used.

This Play fair name was used by the British army in world war- I and by the Australian army in
world war - 2. This was possible because play fair is quite too fast to use and does not demand
any special equipment to use. In today's world play fair cryptography technique is outdated but
now used for academic purpose for crossword identification. The play fair encryption scheme
uses 2 main processes I.e.;

Play fair

Step 1: Creation and population matrix

Step 2: Encryption process

The play fair cipher makes use of a 5x5 matrix table which is used for storing keywords or phase
that becomes the key for encryption and decryption. The way this is entered into 5x5 Matrix is
based on some simple rules.

Rule 1: Enter the keyword in the matrix row wise, left to right and top to bottom.

Rule 2: Drop duplicate letters

Rule 3: Fill the remaining boxes in the matrix with the rest of the English alphabets A-Z.
That was not a part of why doing so combine i and j in the same cell of the table. In other
words, if i and j is a part of keyword, this regard both i and j while filling the remaining slots.

Example: play fair Example


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 Process:

Step1: Because executing these steps, the plain text message that we want to encrypt needs to
be broken down into groups of 2 alphabets.

Step2: If both alphabets are the same (or only is left) add an 'X' after the first alphabet. Encrypt
the new pair and continue.

Step3: If both the alphabets in the pair appear in the same row of our matrix. Replace them
with alphabets to their immediate right respectively. If the original pair is on the right side of
the row, then wrapping around to the left side of the row happens.

Step4: If both alphabets in the pair appear in the same column of a matrix, replace them with
alphabets immediately below them respectively. If the original pair is on bottom side of the
row, then wrapping around to the topside of the row happens.

Step5: If the alphabets are not in the same row (or) column replace them with the alphabets in
the same row respectively, but at the other pair of corners of the rectangle defined by the
original pair. The order is quite significant here. The first encrypted alphabet of the pair is the
one that is present on the same row as the first plain text alphabet.

step6: The encryption message is "My name is Atul". First we have to encrypt the pair is "My".

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

We see that the alphabets M and Y do not occur in the same row (or) column. Therefore, we
need to apply step5 of our play fair cipher encryption process. This means that we need to
replace this text with the text diagonally opposite to it. In this case, this text is XF instead of MY.

Therefore, MY=XF.

step7: In our text box we have to encrypt NA. So, both NA are not in same row and in the same
column. Now, the same step5 is to be applicable to encrypt the plaintext N and A I .e;
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
Here, the encryption letters of N and A is O and L. So, NA=OL.

So, we have to encrypt the letters M and E. Here, we have to observe that both M and E are in
the same row of play fair matrix table. Here, step3 is applicable. So, based on our logic M and E
will be encrypted by X and I .Therefore, ME=IX.

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
Now, we have to encrypt I and S. So, both I and S are not in the same row and same column. So,
as per the logic step-5 will be applicable.

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
Therefore, I and s will be encrypted by M and K. Therefore, IS=MK.

Now, we have to encrypt the letters A and T these 2 letters are not in the same row and same
column. So, as per the logic step5 will be applicable.

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
So, A and T will be encrypted by P and V. Therefore, AT=PV. Finally , we have to encrypt the
pair of alphabets U and L. As per the logic these 2 alphabets are in same column. Step4 of the
encryption process will be applicable to convert U and L I .e;

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
UL should be encrypted by LR. Therefore, UL=LR. Now, the encryption are:

"MY NA ME IS AT UL"(plaintext)

"XF OL IX MK PV LR"(cipher text)

It is to be noted that we have to follow the same reverse process to decrypt message.

Plaintext: XF OL IX MK PV LR

Cipher text: MF NA ME IS AT UL

HILL CIPHER
Hill Cipher is works on multiple letters at the same time. Hence, it is a type of Poly graphic
Substitution Cipher. Lester hill invented this technique in 1929. Hill cipher has it roots in matrix
theory of mathematic. But, Hill cipher is vulnerable to the known plaintext attack. The
procedure of hill cipher is:

Step1: Treat every letter in a plaintext message as a=0, b=1, c=2----z=25.

Step2: The plain text message is organized as a matrix of numbers based on the above
conversion.

19

For example: If our plaintext message is CAT, based on the above stack we know
that C=2, A=0, T=19. Therefore, our plaintext message should write in the form of
matrix i.e.

Step3: Now, our plaintext matrix is multiplied by a matrix randomly chosen keys.
The key matrix consists of size n*n where n is the number of rows in our plaintext
matrix.

6 24 1

13 16 10

20 17 15

For example: We have to take the key matrix is:


Now, multiply the 2 matrix
6 24 1 12 + 0 + 19 31
2

13 16 10 26 + 0 + 190 216
0
* = =
20 17 15 40 + 0 + 285 325
19

Now, compute a mod26 value of the above matrix i.e.; Take the remainder after dividing the
above matrix values by 26.

31 5

216 Mod 26 = 8

325 13

Now, translating the result matrix i. e 5,8,13 into plaintext which is said to be a Cipher text i. e;

5=F, 8=I, 13=N

Therefore, our cipher text is FIN.

Decryption process:

For decryption of the encrypted message take the cipher text matrix and multiply it by the
inverse of the original key matrix. The inversed result is:

8 5 10

21 8 21

21 12 8

Step1: Take the inverse of the key matrix and multiply with cipher text matrix I. e;

8 5 10 5 40 + 40 + 130 210

21 8 21 * 8 = 150 + 64 + 273 = 442

21 12 8 13 105 + 96 + 104 305


The, we have to perform modular division with 26 of above result.

210
mod 26 = 2
442
0
305
19

Now, convert this result matrix of 2, 0, 19 into plaintext i.e; 2=C, 0=A, 19=T.

Transposition Technique:

It technique is differ from substitution technique in the way that they don't simply
replace one alphabet into another. They also perform some permutations over the plaintext
alphabets.

Rail fence Technique:

It involves writing plaintext as sequence of diagonals and then read it row by row to
procedure cipher text.

The procedure is:

Step1: Write down the plaintext as a sequence of diagonal.

Step2: Read the plaintext written in step1 as a sequence of row.

Example: Our original text is “come home tomorrow” a sequence of diagonals is follows i. e; it
look like zigzag sequence as shown below:

Now read the text row by row and write sequentially.

Cipher Text: c m h m t m r o o e o e o o r w
Simple column Transposition Technique:

In this technique simply arrange the plaintext as a sequence of row of a rectangle that
are read in columns randomly.

 It is also quite simple to break it.

 It is a matter of trying at a few permutations and combinations of column orders to get


hold of the original plaintext.

Procedure:

Step1: Write the plaintext message row by row in a rectangle of predefined size.

Step2: Read the message column by column. However, it need not be in the order of column
1,2,3,---- etc.

Step3: The message thus obtained in the cipher text message.

Example: 1. our encrypted plaintext message is “come home tomorrow ". Let us consider a
rectangle with 6 columns. Therefore, when we write the message in the rectangle row by row.
It would look like as follows:

Column 1 Column 2 Column 3 Column 4 Column 5 Column 6

C O M E H O
M E T O M O
R R O W

2. Now, let us consider or decide the order of columns as some random order. That is 4,6,1,2,5
and 3 then read the text in the order of these columns.

3. The cipher text does obtained would be " E O W O O C M R O E R H M M T O ".

4. Simply we have to follow the reverse order carefully to decrypt the encrypted message.

BLOCK CIPHER
In Block cipher, rather than encrypting one byte at a time, a block of bytes is encrypted at
one time. For ex; we have to encrypt the message "Today-is-holiday". In this plaintext first we
have to divide into blocks, and then encrypt the plaintext message. Using the block cipher first
we have to encrypt the word holiday. Instead of single letter encryption, using block cipher,
block of characters gets encrypted at a time. During decryption, each block would be translated
back to the original form. In actual practice, the communication takes place only in bits.
Therefore, today actually means binary equivalent of the ASCII characters. After any algorithm
encrypts these, the result bits are converted back to their ASCII equivalent.

For example, consider the diagram:

Plain text
Today -is- Holiday

Encrypt Encrypt Encrypt

Ciphertext

V%$#K *Y%+$ #%$K*

In the above diagram, a block cipher takes a block of plaintext bits and generates block of
cipher text bits generally of same size. The size of block is fixed in the given scheme. The choice
of block size does not directly effect to the strength of encryption scheme. The strength of
cipher depends upon the key length.

Block Size:

Though analyze of block is acceptable but it is to be noted that we have to take precautions
before going to take the size of the block.

1. Avoid very small size block:

Suppose, the block size is "m" bits, then the possible plaintext combinations are 2 m. If the
attacker discovers the plaintext blocks corresponding to some previously sent cipher text block,
then the attacker can launch a type of "dictionary attack" by building up a dictionary of
plaintext public Cipher text sent using that encryption key.

2. Do not have very large block size:

When the block size is very large, the cipher becomes inefficient in operate. Such plaintext will
need to be padded before being encrypted.

3. Multiples of 8 bits:

A preferred block size is a multiple of 8 as it is easy for implementation and almost all computer
processes handle data in multiple of 8 bits.
4. Padding in block cipher:

In block cipher's process blocks are of fixed size, let assume block size is 64 bit here. If 150 bits
of plaintext provides 2 blocks of 64 bits each and rest of the 22 bits are in a separate block. The
last block of bits needs to be padded up with redundant information. So that, the length of final
blocks equals to the size of the remaining blocks. That means, here 22 bits block need to have
additional 42 bits of redundant bits added to provide a complete block. This process of adding
bits to the last block is referred to as padding. To much padding makes the system inefficient
and insecure. Because redundant bits contains same information.

5. Block cipher schemes:

There are number of block cipher schemes are available. Many of them are publicly known.
Some of most popular (or) prominent blocks ciphers are listed below. They are:

a. Data encryption standard: The most popular block cipher of 1990's. It is now considered as
broken cipher due to small key size.

b. Triple DES: It is a variant scheme based on the repeated DES applications.

DES (DATA ENCRYPTION STANDARDS)


The most widely used encryption scheme is based on the data encryption standard. DES is
adopted by national institute of standards technology in the year 1997. The overall scheme for
DES encryption is there are two inputs to the encryption function: the plaintext to be encrypted
and the key. In this case, the plaintext must be 64 bits in length and the key is 56 bits in length.
This algorithm itself is referred to as data encryption algorithm (DEA). For DES the data are
encrypted in 64 bits using a 56 bit key. That means first the plaintext has to be divided into 64
bit block. Then it has to be removed every 8th bit of each and every block and prepare 56 bit
key. The algorithm transforms 64 bit input in a series of steps into 64 bit output. The same
steps with the same key, are used to decrypt the message. The general description of DES
encryption algorithm is as follows:
The left -hand side of the figure, we can see that the processing of the plaintext proceeds in
three phases. First, the 64-bit plaintext passes through an initial permutation (IP) that
rearranges the bits to produce the permuted input. This is followed by a phase consisting of
sixteen rounds of the same function, which involves both permutation and substitution
functions. The output of the last (sixteen) round consists of 64 bits that are a function of the
input plaintext and the key. The left and right halves of thee output swapped to produce the
preoutput. Finally, the preoutput is passed through a permutation (IP-1) that is the inverse of
the initial permutation function, to produce the 64-bit cipher text, with the exception of the
initial and final permutations. DES has the exact structure of a Feisal cipher.

DES consists of inverse of 16 steps each of which is called as round. Each round performs the
steps of substitution and transposition the process of conversion of 64 bit plaintext into 64 bit
cipher text is as follows.

1. In the first step, the 64 bit plaintext is handed over to initial permutation (IP) function.

2. The initial permutation is performed on plaintext.

3. Next the initial permutation (IP) Produces to half’s of the permitted block which said to
be a left plaintext(LPT) and right plaintext(RPT).

4. Now each of LPT and RPT go through 16 rounds of encryption process in the end the LPT
and RPT rejoined to a final permutation (FP) is performed on the combined block.

5. Finally the result of this process produces 64 bit cipher text.

Initial permutation (IP)

The initial permutation happens only once and it happens before the first round. Here IP
changes position of the bits of original plaintext. It is nothing but jugglery of bit positions of the
original plaintext. For ex; first bit changes its position to 58th bit, second bit changes its position
to 60 th bit.... likewise. Consider the following table

58 50 42 34 22 15 10 2 60 32 14 34 28 20 12 4
62 54 46 38 30 32 14 6 64 56 48 40 32 24 16 8
37 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

After IP is done the resulting 64 permitted test block is divided into 2 half block consists of 32
bits which is called left plaintext (LPT) and right plain text(RPT). Now 16 rounds are performed
on these two blocks. This process is described below. Each of the 16 rounds, in turn, consists of
the broad level steps given below. Details of one round in DES:
Key transformation
Key transformation

Expansionpermitation
Permutation
Expansion

s-box
S-boxsubstitution
substitution

P- Bar permotation
P-Bar permutation

XOR
XORand
andswap
swap

Key Transformation:

We have noted that the initial 64 bit key is transformed into a 56 bit key by
discarding every 8th bit of the initial key. Thus for each round, a 56 bit key is available. From this
56 bit key, a different 48 bit sub key is generated during each round using a process called as
key transformation. For this the 56 bit key is divided into 2 half’s each of 28 bits. These half’s
are circularly shifted left by one or two positions depending on rounds. For ex, if the round
number is 1, 2, 9 or 16 the shift is done by only 1 position. For other rounds the circular shift is
done by two positions. The number of key bits rounded is shown below.

Round 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
No. of 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1
keys
bits
shifted
When we perform the appropriate shifting the 48 of the 56 bits are selected for instance after
the shift, bit number 14 is moves into the 1st position, bit number 17 is on 2nd position and bit
number 11 is in 3rd position.... and so on. The following table indicates only 48 bits are available
that means bit number 18 is discarded, like 7 other numbers so to reduce 8 bits from 56 bit key
and finally 48 bit sub key is generated it is called compression permutation. Consider the
following table.
14 17 11 34 1 5 3 28 45 6 21 10
23 19 12 4 26 8 16 7 27 20 13 2
41 32 31 37 47 55 30 40 51 45 33 48
44 49 39 56 34 53 46 42 50 36 29 32

Expansion permutation:

After initial permutation we have to divide these 64 bits into 32 bit block which is said to be a
Left plaintext (LPT) and Right plaintext (RPT). During expansion permutation the 32 bit size
should be increased to 48 bit size, hence the name expansion permutation then the process of
expansion permutation is 1. The 32 bit RPT should be divided into 8 equal size blocks. Each
block size is 4 bits.

The 4 bit block size can be expanded to 6 bit block size by the expansion permutation that
means two more bits will be added to 4 bit block.

Finally the 32 bit block should be expanded to 48 bit block. Consider the diagram:

S Box Substitution:
S- box substitution is a process that accept the 48 bit input and perform the XOR operation and finally
produced 32 bit output by using s-box substitution technique. The substitution is performed by 8
substitution boxes. Each of the s-boxes has 6 bits input and 4 bits output. Finally the 48 bit input should
be compressed to 32 bit output.

P-Box permutation:

The output of s-box consist of 32 bits these 32 bits are permitted using p-box. This sight
forward permutation mechanism involves simple permutation i. e; replacement of one bit by
another bit. There is no any expansion or compression in p-box permutation. So this sight
forward mechanism is said to be a p-box permutation. Consider the table.

16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9 19 30 6 22 11 4 13 25

XOR and SWAP:

Till now we have performed the operations on 32 bit RPT. The LPT was untouched so far the left
half portion of the 64 bit plaintext XOR with the output produced by the p-box permutation.
The result of this XOR operation becomes new right of which is said to be a process of
swapping. That means the old RPT moves to the left portion and the result of XOR operation
will become the RPT. Consider the diagram:
Final permutation:

At the end of the 16 rounds the final permutation performed only once. This is simple
transposition that is for instance 40th bit appear in 1st position, 8 bit in 2nd position ,17 bit in 62th
position and finally 25 bit in 64th position. The output of final permutation in 64 bit encrypted
block.

2 DES (Double DES)


Double DES does twice what DES normally does only once. Double DES uses 2 keys which is said
to be k1, k2. It 1st performs on the original plaintext using k1 to get the encrypted text. It again
performs DES on the encrypted text, but the 2nd time with the outer key k2. The final output is
the encrypted text that is the original plaintext encrypted twice with two different keys.
Consider the diagram:

There is no reason why double encryption cannot be applied to other cryptographic algorithms
as well. However, in the case of DES, it is already quite popular, therefore, we have discussed
the decryption process would work in exactly the reverse order, as shown below:
The doubly encrypted cipher text block is first decrypted using the key k 2 to produce the singly
encrypted cipher text. This cipher text block is then decrypted using the key k1 to obtain the
original plaintext block.

If we use a key of just 1 bit, there are two possible keys (0 and 1). If we use a 2-bit key, there
are four possible key values (00, 01, 10 and 11). In general, if we use an n-bit key, the
cryptanalyst has to perform 2n operations to try out all the possible keys. If we use two
different keys, each consisting of n bits, the cryptanalyst would need 22n attempts to crack the
key. Therefore, on the face of it, we may think that since the cryptanalyst for the basic version
of DES requires a search of 256 keys, Double DES would require a key search of (22*56) i. e; 2128
keys. However, it is not quite true. Markel and Hellman introduced the concept of the meet-in-
the-middle attack. This attack involves encryption from one end, decryption from the other and
matching the results in the middle, hence the name meet-in-the-middle attack. Let us
understand how it works.

Suppose that the cryptanalyst knows two basic pieces of information (a plain text block) and C
(the corresponding final cipher text block) for a message. we are using Double DES, the
mathematical equivalents of these are also shown. The result of the first encryption is called as
T and is denoted as T=Ek1(p)[I .e; encrypt the block p with key k1]. After this encrypted block is
encrypted with another key k2, we denote the result as c=Ek2(Ek1(P))[I .e; encrypt the already
encrypted block T, with a differently key k2 and call the final cipher text as c].

Step 1: For all possible values (256) of key k1, the cryptanalyst would use a large table in the
memory of the computer and perform the following two steps:

1. The cryptanalyst would encrypt the plaintext block P by performing first encryption
operation, i. e, Ek1 (P). That is, it will calculate T.
2. The cryptanalyst would store the output of the operation E k1 (P),i. e, the temporary cipher
text (T), in the next available row of the table in the memory.

Step 2: Thus, at the end of the above process, the cryptanalyst will have the table of cipher text
as shown in the figure. Next, the cryptanalyst will perform the reverse operation. That is, she
will now decrypt the known cipher text C with all the possible values of k2 [i.e, perform DK2(C)
for all possible values of k2].

3 DES (Triple DES)


Although the meet-in-the-middle attack on Double DES is not quite practical yet, in
cryptography, it is always better to take the minimum possible chances. Consequently, Double
DES seemed inadequate, paving the way for Triple DES. As we can imagine, Triple DES is DES-
three times. It comes in two flavors: one that uses three keys and the other that uses two keys.
We will study both, one-by-one.

 Triple DES with three keys The idea of Triple DES with three keys is illustrated. As we
can see, the plain text block P is first encrypted with a key k1, then encrypted with a
second key k2 and finally with a third key k3, where k1,k2 and k3 are all different from
each other.
Triple DES with three key is used quite extensively in many products, including PGP and
S/MIME. To decrypt the cipher text C and obtain the plain text P 1 we need to perform the
operation P=Dk3 (DK2 (DK1(C))).

 Triple DES with two keys Triple DES with three keys is highly secure. It can be denoted
in the form of equation as C=EK3 (EK2 (EK1 (P))). However, Triple DES with three keys also
has the drawback of requiring 56*3=168 bits for the key, which can be slightly difficult
to have in practical situations. A workaround suggested by Tuchman uses just two keys
for Triple DES. Here, the algorithm works as follows:

1. Encrypt the plaintext with key k1. Thus, we have EK1 (P).

2. Decrypt the output of step 1 above with key K2. Thus, we have DK2(EK1(P)).

3. Finally, encrypt the output of step 2 again with the keyk1. Thus, we have EK1(DK2(EK1(P))).

To decrypt the cipher text C and obtain the original plain text P, we need to perform the
operation P=DK1(EK2(DK1(C))).

There is no special meaning attached to the second step of decryption. Its only significance is
that it allows Triple DES to work with two, rather than three keys. This is also called as Encrypt-
Decrypt-Encrypt(EDE) mode. Triple DES with two keys is not susceptible to the meet in the
middle attack, unlike Double DES as k1 and k2 alternate here.

DIFFERENTIAL AND LINEAR CRYPTANALYSIS


Cryptanalysis is the process of transforming or decoding communications from non-readable to
readable format without having access to the real key. OR we may say it is the technique of
retrieving the plain text of the communication without having access to the key. Cryptanalysis is
the art, science, or practice of decrypting encrypted messages. The secret key used for
encryption and decoding is considered to be unknown to the cryptologists, mathematics, and
other scientists participating in the process. In contrast to a brute force attack, this form of
analysis seeks vulnerabilities in a cryptosystem.

Cryptanalysis frequently comprises a direct evaluation of the cryptosystem in use, which is


essentially an advanced concentrated mathematical attempt at decryption utilizing knowledge
about the encryption scheme that is already available. They can employ intercepted encrypted
messages (cipher text), intercepted complete, partial, likely, or similar original messages
(plaintext), or information (encrypted or original) that is known to be used adaptively in
subsequent trials.

Cryptanalysis is used to break Cryptographic security systems and gain access to the contents of
the encrypted messages, even if the cryptographic key is unknown.

Different forms of Cryptanalysis:

Cryptanalysis basically has two forms:

1. Linear Cryptanalysis:

Linear cryptanalysis is a general type of cryptanalysis based on discovering affine


approximations to a cipher's action in cryptography. Block and stream ciphers have both been
subjected to attacks. Linear cryptanalysis is one of the two most common attacks against block
ciphers, with differential cryptanalysis being the other:

2. Differential Cryptanalysis:

Differential cryptanalysis is a sort of cryptanalysis that may be used to decrypt both block and
stream ciphers, as well as cryptographic hash functions. In the widest sense, it is the study of
how alterations in information intake might impact the following difference at the output. In
the context of a block cipher, it refers to a collection of strategies for tracking differences across
a network of transformations, finding where the cipher displays non-random behavior, and
using such attributes to recover the secret key (cryptography key).
Difference between Linear Cryptanalysis and Differential Cryptanalysis

S.NO Linear Cryptography Differential Cryptanalysis

1. Linear Cryptanalysis was basically invented Differential cryptanalysis was first defined in the
by Matsui and Yamagishi in the year 1992. year 1990 by Eli Biham and Adi Shamir.

Linear cryptanalysis always works on a single Differential cryptanalysis can work on multiple bits
2. bit (one bit at a time). at a time.

In the case of Linear cryptanalysis, cipher


3. text attack is a very big disadvantage. In the case of differential cryptanalysis plain text
attack is a very big disadvantage.
The use of linear cryptanalysis is to figure out
4. what is the linear relationship present The use of differential cryptanalysis is to get clues
between some plaintext bits, cipher text bits, about some critical bits, reducing the need for
and unknown key bits very easily. extensive search.

Subsets of input attributes refer to the The underlying structure of each individual input is
5. internal structures of a single input. unimportant in the case since the input attributes
are differential.

The cryptanalyst decrypts each cipher text After several encryption rounds, Cryptanalyst
6. using all available sub keys and analyses the analyses the changes in the intermediate cipher
resultant intermediate cipher text to text obtained. The practice of combining assaults is
determine the random outcome for one known as differential linear cryptanalysis.
encryption cycle.

7. Any random plaintext is selected in linear Plaintext is carefully chosen in differential


cryptanalysis. cryptanalysis.

8. Plaintext is used one by one in linear Plaintext is used in pairs in Differential


Cryptanalysis. Cryptanalyst.

9. Complexity of attack is low in linear Complexity of attack is High in Differential


cryptanalysis. Cryptanalysis.

10. Mathematical relation between plaintexts Mathematical relation between plaintexts used has
used has Linear approximation (such as a specific differences (such as XOR).
series of XOR operations).

11. Goal of the attack is to identify the linear Goal of the attack is to identify some bits of the
relation between some bits of the plaintext, unknown key.
some bits of the cipher text and some bits of
the unknown key.
BLOCK CIPHER DESIGN PRINCIPLES
Block ciphers are built in the Feistel cipher structure. Block cipher has a specific number of
rounds and keys for generating cipher text. Block cipher is a type of encryption algorithm that
processes fixed-size blocks of data, usually 64 or 128 bits, to produce cipher text. The design of
a block cipher involves several important principles to ensure the security and efficiency of the
algorithm. Some of these principles are:

1. Number of Rounds - The number of Rounds is regularly considered in design criteria, it just
reflects the number of rounds to be suitable for an algorithm to make it more complex, in DES
we have 16 rounds ensuring it to be more secure while in AES we have 10 rounds which makes
it more secure.

2. Design of function F- The core part of the Feistel Block cipher structure is the Round
Function. The complexity of cryptanalysis can be derived from the Round function i.e. the
increasing level of complexity for the round function would be greatly contributing to an
increase in complexity. To increase the complexity of the round function, the avalanche effect is
also included in the round function, as the change of a single bit in plain text would produce a
mischievous output due to the presence of avalanche effect.

3. Confusion and Diffusion: The cipher should provide confusion and diffusion to make it
difficult for an attacker to determine the relationship between the plaintext and cipher
text. Confusion means that the cipher text should be a complex function of the key and
plaintext, making it difficult to guess the key. Diffusion means that a small change in the
plaintext should cause a significant change in the cipher text, which makes it difficult to analyze
the encryption pattern.

4. Key Size: The key size should be large enough to prevent brute-force attacks. A larger key
size means that there are more possible keys, making it harder for an attacker to guess the
correct one. A key size of 128 bits is considered to be secure for most applications.

5. Key Schedule: The key schedule should be designed carefully to ensure that the keys used for
encryption are independent and unpredictable. The key schedule should also resist attacks that
exploit weak keys or key-dependent properties of the cipher.

6. Block Size: The block size should be large enough to prevent attacks that exploit statistical
Patterns in the plaintext. A block size of 128 bits is generally considered to be secure for most
applications.

7. Non-linearity: The S-box used in the cipher should be non-linear to provide confusion. A
linear S-box is vulnerable to attacks that exploit the linear properties of the cipher.

8. Avalanche Effect: The cipher should exhibit the avalanche effect, which means that a small
change in the plaintext or key should cause a significant change in the cipher text. This ensures
that any change in the input results in a complete change in the output.

9. Security Analysis: The cipher should be analyzed for its security against various attacks such
as differential cryptanalysis, linear cryptanalysis, and brute-force attacks. The cipher should also
be tested for its resistance to implementation attacks, such as side-channel attacks.
Overall, a good block cipher design should be resistant to various attacks, efficient, and easy to
implement.

BLOCK CIPHER MODES OF OPERATION


An algorithm mode is a combination of a series of the basic algorithm steps on block cipher and
some kind of feedback from the previous step. It forms the basis for the computer based
security algorithms. There are four important algorithm modes, namely, Electronic Code Book
(ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB) and Output Feedback (OFB).

Electronic Code Book (ECB) is the simplest mode of operation. Here, the incoming plain text
message is divided into blocks of 64 bits each. Each such block is then encrypted independently
of the other blocks. For all blocks in a message, the same key is used for encryption. This
process is shown:

At the receiver's end, the incoming data is divided into 64-bit blocks and by using the same key
as was used for encryption, each block is decrypted to produce the corresponding plain text
block. This process is shown :
In ECB, since a single key is used for encrypting all the blocks of a message, if a plain text block
repeats in the original message, the corresponding cipher text block will also repeat in the
encrypted message. Therefore, ECB is suitable only for encrypting small messages.

Cipher Block Chaining (CBC) Mode A plain text block always produces the same cipher text
block. Thus, if a block of plain text occurs more than once in the input, the corresponding cipher
text block will also occur more than once in the output, thus providing some clues to a
cryptanalyst. The Cipher Block Chaining (CBC) mode ensures that even if a block of plain text
repeats in the input, these two (or more) identical plain text blocks yield totally different cipher
text blocks in the output.

Chaining adds a feedback mechanism to a block cipher. In Cipher Block Chaining (CBC), the
results of the encryption of the previous block are fed back into the encryption of the current
block. The encryption process of CBC is depicted.

Cipher Feedback (CFB) Mode Not all applications can work with blocks of data. Security is
also required in applications that are character-oriented. The Cipher Feedback (CFB) mode is
useful in such cases. In this mode, data is encrypted in units that are smaller (e.g. they could be
of size 8 bits, i.e. the size of a character typed by an operator) than a defined block size (which
is usually 64 bits).

Output Feedback (OFB) Mode The output Feedback(OFB) mode is extremely similar to the
CFB, the cipher text is fed into the next stage of encryption process. But in the case of OFB, the
output of the IV encryption process is fed into the next stage of encryption process.
Counter (CTR) Mode The Counter (CTR) mode is quite similar to the OFB mode, with one
variation. It uses sequence numbers called as counters as the inputs to the algorithm. The size
of the counter block is the same as that of the plain text block.

For encryption, the counter is encrypted and then XORed with the plain text bleak to get the
cipher text. No chaining process is used. On the other hand, for decryption, the same sequence
of counters is used. Here, each encrypted counter is XORed with the corresponding cipher text
block to obtain the original plain text block.
BLOW FISH
Blow fish was developed by Bruce Schneier and has the reputation of being a very strong
symmetric key cryptographic algorithm. According to Schneier, Blowfish was designed with the
following objectives in mind.

 Fast - Blowfish encryption rate on 32-bit microprocessors is 26 clock cycles per byte.
 Compact - Blowfish can execute in less than 5 kb memory.
 Simple - Blowfish uses only primitive operations, such as addition, XOR and table
lookup, making its design and implementation simple.
 Secure- Blowfish has a variable key length up to a maximum of 448 bits long, making it
both flexible and secure.

Blowfish suits applications where the key remains constant for a long time (e.g.
communications link encryption), but not where the key changes frequently.

Data Encryption and Decryption The encryption of a 64-bit block plain text input X is shown
in an algorithmic fashion. We use the P-arrays and S-boxes during the encryption and
decryption processes.

1. Divide X into two blocks: XL and XR, of equal sizes. Thus, both XL and XR will consist of
32 bits each.

2. For i = 1 to 16

XL = XL XOR Pi

XR=F (XL) XOR XR

Swap XL, XR

Next i

3. Swap XL, XR (i.e. undo last swap).

4. XL= XL XOR P18.

5. Combine XL and XR back into X.


The function F is as follows:

(i) Divide the 32-bit XL block into four 8-bit sub-blocks, named a, b, c and d.

(ii) Compute F [a, b, c, d] = ((S1,a + S2,b) XOR S3,c) + S4,d. For example, if a = 10, b = 95, c = 37
and d = 191, then the computation of F would be:

F [a, b, c, d] = ((S1,10 + S2,95) XOR S3,37) + S4,191

The diagrammatic view of the function F is shown:


ADVANCED ENCRYPTION STANDARD (AES)

AES stands for advanced for advanced encryption standards.AES is a block cipher intended to
replace des for commercial applications. In the year 1990 the US government wanted to
standard as a cryptography algorithm, which was to be used universally by them it was to be
called Advanced Encryption Standards. Many proposals have come after a long debate Rijndael
was accepted. Rijndael was developed by John daemen and Vincent Rijmen from Belgium. The
Rijndael is the surname of Rijmen and daemen. The specification for the encryption of
electronic data established by the NIST (National Institute of standards and technology) in the
year 2001.AES widely used today as it is DES and triple DES. This despite being hardware to
implement. The following points are to be consider to select provide opportunity to Lizdell
algorithm i.e;

 AES is a block cipher the key size can be 128/192/256.


 Encrypts the data blocks of 128 bit each.
 That means it will take 128 bit as input and encrypt the information and generate 128
bit output cipher text.
 AES does not use a Feistel structure instead each full round consists of four separate
functions.
1. Bite Substitution
2. Permutation
3. At arithmetic operations
4. Exoll with a key

AES performs operation on bytes of data rather than in Beats. Since the block size is 128 bit (16
byte) of the input data. Depends on the key line that is 128 bit (10 rounds) 192 bit (12 rounds)
256 bit (14 rounds). Creation of round keys a key schedule algorithm is used to calculate all the
round key from the key. So the initial key used to initiate many round keys which will be used in
the corresponding round of the encryption. Consider the diagram:
Plain Text (128 bits)

Pre-round Key 0
Transformation

Round 1 Key 1
Key expansion

Round 2
Key 2

Key N
Round N

Cipher text (128 bits)

Operation:
The basics of Rijndael are in a mathematical concept called as Galoic field theory. Similar to the
way DES functions Rijndael also uses the basic technique of substitution and transposition (i.e
permutation). Here, the key size and the plain text block size decide how many rounds need to
be executed the minimum number of rounds is 10, if both key size and plain text block size is
128bits. The maximum number of rounds is 14. If the plain text block size is 128 and key block
size is 256. The major difference between DES and Rijndael is that the DES can perform
operations on bits and Rijndael perform operation on bytes.

Expand the 16 bite key to get the actual key block to be used:

The inputs to the algorithm are the key and the plaintext, asual. The key size is 16
bytes, in this case here this step expands this 64byte key into 11 arrays, each array contains 4
rows and 4 columns. The expansion process can be defeated as follows.
Expanded into 11 arrays, each of size 4*4. In other words the original 16 byte key array is
expanded into a key containing 11*4*4=176 bytes. One of these 11 arrays is used in the
initialization process and the other 10 arrays are used in the 10 rounds, one array per round. In
the context of AES a "WORD" means 4 bytes. Therefore, our 16 byte initial key is 4 word key
(16/4) will be expanded into 176 bytes key i.e.; 44 words (176/4).The general of structure of
AES encryption process is as follows.

Which can be considered round 0. Each transformation takes one or more 4*4 matrices as input
and produces a 4*4 matrix as output.

Four different stages are used, one of permutation and three of substitution:

 Substitute bytes: Uses an s-box to perform a byte-by-byte substitution of the block.


 Shift Rows: A simple permutation
 Mix Columns: A substitution that makes use of arithmetic over GF(28)
 Add Round key: A simple bitwise XOR of the current block with a portion of the
expanded key.

The final round of both encryption and decryption consists of only three stages. Again, this is a
consequence of the particular structure of AES and is required to make the cipher reversible.

You might also like