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

Chapter1 -Introduction & Number Theory

The document provides an overview of computer and network security, focusing on key concepts such as the CIA triad (Confidentiality, Integrity, Availability), threats, vulnerabilities, and attacks. It discusses various security mechanisms and services defined by ITU-T, including data confidentiality, integrity, authentication, nonrepudiation, and access control. Additionally, it outlines the OSI security architecture and the relationship between security services and mechanisms.

Uploaded by

manavp.p5050
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)
4 views

Chapter1 -Introduction & Number Theory

The document provides an overview of computer and network security, focusing on key concepts such as the CIA triad (Confidentiality, Integrity, Availability), threats, vulnerabilities, and attacks. It discusses various security mechanisms and services defined by ITU-T, including data confidentiality, integrity, authentication, nonrepudiation, and access control. Additionally, it outlines the OSI security architecture and the relationship between security services and mechanisms.

Uploaded by

manavp.p5050
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/ 139

Chapter 1

Introduction and
Number Theory

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 1


Content
Services, Mechanisms and attacks
The OSI security architecture
Network security model
Classical Encryption techniques (Symmetric cipher models, substitution techniques, transposition techniques)
Number theory
Groups, Rings, Fields
Modular arithmetic
Euclid's algorithm-Finite fields-Polynomial Arithmetic
Prime numbers-Fermat’s and Euler’s theorem
Chinese Remainder theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 2


Computer and Network Security
The NIST Computer Security Handbook defines the term
computer security as:
“the protection afforded to an automated information system
in order to attain the applicable objectives of preserving the
integrity, availability and confidentiality of information system
resources”
(resources includes hardware, software, firmware,
information/data, and telecommunications)

Computer and Network Security consists of:


“measures to deter, prevent, detect, and correct security
violations that involve the transmission of information”

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 3


Security Goals/ CIA Triad
❑ Confidentiality:
1. Preserving authorized restrictions on information access and
disclosure, including means for protecting personal privacy and
proprietary information.
2. A loss of confidentiality is the unauthorized disclosure of
information.
❑ Integrity:
1. Guarding against improper information modification or destruction,
including ensuring information nonrepudiation and authenticity.
2. A loss of integrity is the unauthorized modification or destruction
of information.
❑ Availability:
1. Ensuring timely and reliable access to and use of information.
2. A loss of availability is the disruption of access to or use of
information or an information system.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 4


Confidentiality
This term covers two related concepts:
❑Data confidentiality: Assures that private or confidential
information is not made available or disclosed to
unauthorized individuals.
❑Privacy: Assures that individuals control or influence what
information related to them may be collected and stored and
by whom and to whom that information may be disclosed.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 5


Integrity
This term covers two related concepts:
❑Data integrity: Assures that information (both stored and in
transmitted packets) and programs are changed only in a
specified and authorized manner.
❑System integrity: Assures that a system performs its intended
function in an unimpaired manner, free from deliberate or
inadvertent unauthorized manipulation of the system.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 6


ASSURES THAT SYSTEMS

Availability WORK PROMPTLY AND


SERVICE IS NOT DENIED
TO AUTHORIZED USERS.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 7


Threats, Vulnerabilities, and Attacks

A THREAT IS ANY POTENTIAL A VULNERABILITY IS A WEAKNESS THAT AN ATTACK IS AN ACTION THAT EXPLOITS A
OCCURRENCE, MALICIOUS OR MAKES A THREAT POSSIBLE. THIS MAY VULNERABILITY OR ENACTS A THREAT.
OTHERWISE, THAT COULD HARM AN BE BECAUSE OF POOR DESIGN, EXAMPLES OF ATTACKS INCLUDE SENDING
ASSET. IN OTHER WORDS, A THREAT IS CONFIGURATION MISTAKES, OR MALICIOUS INPUT TO AN APPLICATION OR
ANY BAD THING THAT CAN HAPPEN TO INAPPROPRIATE AND INSECURE CODING FLOODING A NETWORK IN AN ATTEMPT TO
DENY SERVICE.
YOUR ASSETS. TECHNIQUES.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 8


Example for Threat and
Vulnerability
• Here, a wall is holding water back.
• The water to the left of the wall is a threat to the man on the right
of the wall: The water could rise, overflowing onto the man, or it
could stay beneath the height of the wall, causing the wall to
collapse.
• So, the threat of harm is the potential for the man to get wet, get
hurt, or be drowned.
• For now, the wall is intact, so the threat to the man is unrealized.
• However, we can see a small crack in the wall—a vulnerability that
threatens the man’s security.
• If the water rises to or beyond the level of the crack, it will exploit
the vulnerability and harm the man.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 9


THE OSI SECURITY
ARCHITECTURE
The OSI security architecture focuses on security attacks,
mechanisms, and services. These can be defined briefly as
❖ Security attack: Any action that compromises the security of
information owned by an organization.
❖Security mechanism: A process (or a device incorporating such a
process) that is designed to detect, prevent, or recover from a
security attack.
❖Security service: A processing or communication service that
enhances the security of the data processing systems and the
information transfers of an organization. The services are
intended to counter security attacks, and they make use of one or
more security mechanisms to provide the service.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 10


Threats to Security Goals

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 11


Attacks Threatening
Confidentiality
❑Snooping:

1. Snooping refers to unauthorized access to or interception of data.

2. For example, a file transferred through the Internet may contain confidential
information. An unauthorized entity may intercept the transmission and use the
contents for her own benefit.

3. To prevent snooping, the data can be made non-intelligible to the intercepter by


using encipherment techniques.

❑Traffic Analysis

1. Although encipherment of data may make it non-intelligible for the intercepter,


she can obtain some other type information by monitoring online traffic.

2. For example, she can find the electronic address (such as the e-mail address) of
the sender or the receiver. She can collect pairs of requests and responses to help
her guess the nature of transaction.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 12


Attacks Threatening Integrity

Modification: After intercepting Masquerading: Masquerading, or Replaying: The attacker Repudiation: Repudiation occurs
or accessing information, the spoofing, happens when the attacker obtains a copy of a message when a user or entity denies having
attacker modifies the impersonates somebody else. sent by a user and later tries performed an action, and there's
information to make it Examples: Email spoofing to send to replay it. Examples: insufficient evidence to prove
beneficial to herself. Examples: messages appearing to be from Replaying authentication otherwise. Examples: Denying
Changing the amount on trusted sources, DNS spoofing to credentials, Resending having sent a particular message or
financial transactions, Altering redirect users to malicious websites. financial transactions. email, Claiming a transaction was
database records. unauthorized.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 13


Modification

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 14


Masquerading

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 15


Replaying

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 16


Attacks
Threatening
Availability
A Denial of Service attack aims to make
resources unavailable to legitimate users
by:
❖Overwhelming network bandwidth
❖Exhausting system resources (CPU,
memory, disk space)
❖Flooding servers with requests
❖Disrupting network protocols
❖Crashing applications or services

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 17


Active Attack Vs Passive Attack
On the basis of Active attack Passive attack

In active attacks, the attacker intercepts the In passive attacks, the attacker observes the
Definition connection and efforts to modify the message's messages, then copy and save them and can use it for
content. malicious purposes.

In an active attack, the attacker modifies the


Modification In passive attacks, information remains unchanged.
actual information.

In active attacks, the victim gets notified about Unlike active attacks, in passive attacks, victims do not
Victim
the attack. get informed about the attack.
Hacker modifies the message from Bob to Alice

The damage done with active attacks can be


System's impact The passive attacks do not harm the system.
harmful to the system and its resources.

In active attacks, the system resources can be In passive attacks, the system resources remain
System resources
changed. unchanged.

They are dangerous for the integrity and They can be dangerous for confidentiality of the
Dangerous for
availability of the message. message.

Emphasis on In active attacks, attention is on detection. In active attacks, attention is on prevention.

Active attacks involve Masquerade,


Types Modification of message, Repudiation, Replay, It involves traffic analysis, the release of a message.
and Denial of service.

Active attacks are tough to restrict from Unlike active attacks, passive attacks are easy to
Prevention entering systems or networks. prohibit.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 18


Categorization of passive and active attacks

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 19


Security Services
The International Telecommunication Union-Telecommunication Standardization Sector (ITU-T)
(X.800) has defined five services related to the security goals and attacks we discussed earlier.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 20


Data Confidentiality
❖Data confidentiality is designed to protect data from disclosure attack.
❖The service as defined by X.800 is designed to prevent snooping and traffic analysis attack.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 21


Data Integrity
❖ Data integrity is designed to protect data from modification, insertion, deletion, and replaying
by an adversary.
❖It may protect the whole message or part of the message.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 22


Authentication
❖This service provides the authentication of the party at the other end of the line.
❖In connection-oriented communication, it provides authentication of the sender or receiver
during the connection establishment (peer entity authentication).
❖In connectionless communication, it authenticates the source of the data (data origin
authentication).

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 23


Nonrepudiation
❖Nonrepudiation service protects against repudiation by either the sender or the receiver of the
data.
❖In nonrepudiation with proof of the origin, the receiver of the data can later prove the identity of
the sender if denied.
❖In nonrepudiation with proof of delivery, the sender of data can later prove that data were
delivered to the intended recipient.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 24


Access Control
❖Access control provides protection against unauthorized access to data.
❖The term access can involve reading, writing, modifying, executing programs, and so on.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 25


Security
Mechanisms
ITU-T (X.800) also recommends some security
mechanisms to provide the security services
discussed previously.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 26


Security Mechanisms
❖Encipherment
1. Encipherment means hiding or covering data.
2. It can provide confidentiality.
3. Today two techniques: cryptography and steganography are used for enciphering.

❖ Data Integrity
1. The data integrity mechanism appends to the data a short checkvalue that has been created by a
specific process from the data itself.
2. The receiver receives the data and the checkvalue. He creates a new checkvalue from the received
data and compares the newly created checkvalue with the one received.
3. If the two checkvalues are the same, the integrity of data has been preserved.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 27


Security Mechanisms
❖ Digital Signature
1. A digital signature is a means by which the sender can electronically sign the data and the receiver
can electronically verify the signature.
2. The sender uses a process that involves showing that she owns a private key related to the public
key that she has announced publicly.
3. 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.
❖ Authentication Exchange
1. In authentication exchange, two entities exchange some messages to prove their identity to each
other.
2. For example, one entity can prove that she knows a secret that only she is supposed to know.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 28


Security Mechanisms
❖ Traffic Padding
1. Traffic padding means inserting some bogus data into the data traffic to thwart the adversary’s attempt to use the traffic analysis.
❖ Routing Control
1. 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 route.
❖ Notarization
1. Notarization means selecting a third trusted party to control the communication between two entities. This can be done, for
example, to prevent repudiation.
2. The receiver can involve a trusted party to store the sender request in order to prevent the sender from later denying that she has
made such a request.
❖ Access Control
1. Access control uses methods to prove that a user has access right to the data or resources owned by a system.
2. Examples of proofs are passwords and PINs.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 29


Relationship
Between
Security
Services and
Mechanisms

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 30


Network Security Model
This model shows that there are four basic tasks in
designing a particular security service:
1. Design an algorithm for performing the
security-related transformation.
2. Generate the secret information to be used with the
algorithm.
3. Develop methods for the distribution and sharing of
secret information.
4. Specify a protocol to be used by the two principals
that make use of the security algorithm and the
secret information to achieve a particular security
service.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 31


Network Access Security Model

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 32


Classical Encryption Techniques
❖ Basic Terminologies
1. Plaintext: The original message
2. Ciphertext: The coded message
3. Enciphering or Encryption: Process of converting from plaintext to ciphertext
4. Deciphering or Decryption: Restoring the plaintext from the ciphertext
5. Cryptography: Study of encryption
6. Cryptanalysis (breaking the code): Techniques used for deciphering a message without any
knowledge of the enciphering details
7. Cryptology: Study of cryptography and cryptanalysis together

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 33


Symmetric
Encryption
A symmetric encryption scheme has five ingredients:
• Plaintext: This is the original intelligible message or data that is fed
into the algorithm as input.
• Encryption algorithm: The encryption algorithm performs various
substitutions and transformations on the plaintext.
• Secret key: The secret key is also input to the encryption algorithm.
The key is a value independent of the plaintext and of the
algorithm. The algorithm will produce a different output
depending on the specific key being used at the time.
• Ciphertext: This is the scrambled message produced as output. It
depends on the plaintext and the secret key. For a given message,
two different keys will produce two different ciphertexts.
• Decryption algorithm: This is essentially the encryption algorithm
run in reverse. It takes the ciphertext and the secret key and
produces the original plaintext.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 34


Asymmetric Encryption

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 35


Types of Attacks on Encrypted
Messages
1. cipher text t only
◦ only know algorithm / cipher text t, statistical, can identify plaintext
2. known plaintext
◦ know/suspect plaintext & cipher text t to attack cipher
3. chosen plaintext
◦ select plaintext and obtain cipher text t to attack cipher
4. chosen cipher text t
◦ select cipher text and obtain plaintext to attack cipher
5. chosen text
◦ select either plaintext or cipher text t to en/decrypt to attack cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 36


Sr. No. Symmetric Key Cryptography Asymmetric Key Cryptography
1. It only requires a single key for both It requires two key one to encrypt and the other one to
encryption and decryption. decrypt.
2. The size of cipher text is same or smaller than The size of cipher text is same or larger than the original
the original plain text. plain text.
3. The encryption process is very fast. The encryption process is slow.
4. It is used when a large amount of data is It is used to transfer small amount of data.
required to transfer.
5. It only provides confidentiality. It provides confidentiality, authenticity and
non-repudiation.
6. Examples: AES, DES, Triple DES and RC4 Examples: RSA, Diffie-Hellman, Elliptical Curve
Cryptography and El Gamal Algorithm
7. In symmetric key encryption, resource In asymmetric key encryption, resource utilization is
utilization is low as compared to high.
asymmetric key encryption.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 37


2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 38
Substitution Ciphers

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 39


Substitution Ciphers
❖ In a Substitution cipher, any character of plain text from the
given fixed set of characters is substituted by some other
character from the same set depending on a key.
❖For example, with a shift of 1, A would be replaced by B, B
would become C, and so on.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 40


Monoalphabetic Cipher
❖ In monoalphabetic substitution, a character (or a symbol) in the plaintext is
always replaced by the same character (or a symbol) in the ciphertext irrespective
of its position in the plaintext.
❖ For example, if the algorithm says that letter A in the plaintext is replaced by
letter D in the ciphertext, then every letter A is replaced by letter D.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 41


Additive Cipher
❖ The additive cipher is the simplest monoalphabetic cipher.
❖ The additive cipher is also called a shift cipher or Caesar cipher.
❖A special case of Substitution cipher is known as Caesar cipher where the key is taken
as 3.
❖The general formula of encryption using Additive cipher is : C = (P + K) mod 26
❖ The general formula of decryption using Additive cipher is: P = (C – K) mod 26
❖ If in any case during decryption, P value becomes negative (-ve), then add 26 in the
negative value.
❖ Here, C denotes the letter in ciphertext, P denotes the letter in plaintext, K is the shift
value (3 in case of Caesar Cipher).
❖The value of K can range from 0 to 25.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 42


Additive Cipher
❖ For finding C and P, assign a numerical equivalent to each letter as shown in
Figure.

Plaintext 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 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
Value → 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 43


Use the Caesar cipher to encrypt and
decrypt the message "COMPUTER".

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 44


2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 45
Polyalphabetic Cipher
❖ In polyalphabetic substitution, a character (or a symbol) in the plaintext is not
always replaced by the same character (or a symbol) in the ciphertext.
❖The replacement depends upon an algorithm or a function.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 46


Playfair Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 47


Playfair Cipher
❖ The Playfair Cipher comprises a 5 by 5 matrix of letters (the key
table), with no duplicates.
❖ The letters I and J are considered the same letter.
❖ We create the key table by arranging the unique letters of a
keyword in sequence, followed by the remaining letters of the
alphabet.
❖ Consider the word SECURITY as the key. First, we record the
letters of that phrase in the first squares of a 5 x 5 matrix.
❖ The remaining squares of the matrix are then filled with the
remaining alphabet letters, in alphabetical sequence.
❖ However, since there are 26 letters and only 25 squares
available, we allocate both I and J to the same square.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 48


Playfair Cipher Encryption Rules
1. First, split the plaintext into digraphs (pair of two letters). If the plaintext has the odd number of letters, append
the letter Z at the end of the plaintext. It makes the plaintext of even. For example, the plaintext MANGO has five
letters. So, it is not possible to make a digraph. Since, we will append a letter Z at the end of the plaintext,
i.e. MANGOZ.
2. After that, break the plaintext into digraphs (pair of two letters). If any letter appears twice (side by side),
put X at the place of the second occurrence. Suppose, the plaintext is COMMUNICATE then its digraph
becomes CO MX MU NI CA TE. Similarly, the digraph for the plaintext JAZZ will be JA ZX ZX, and for
plaintext GREET, the digraph will be GR EX ET.
3. Three criterias for encrypting letters within the same pair:
•If the two letters in the pair are in the same row of the key square, we replace them with the letter to their
right.
•If both letters in the pair are found in the same column of the key square, we will replace each letter with the
letter below it.
•If the letters are in different rows and columns, we form a rectangle with them and change each letter with the
letter in the opposite corner.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 49


2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 50
Vigenere Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 51


Vigenere Cipher
❖The Vigenère Cipher is a method of encrypting alphabetic text using a simple form of
polyalphabetic substitution. It employs a keyword to determine which Caesar cipher to
use for each letter of the plaintext. This cipher is more secure than a basic Caesar cipher
because it introduces variability.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 52


Vigenere Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 53


Vigenere Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 54


Vigenere Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 55


Vigenere Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 56


PLAINTEXT: ENGINEERING
KEY: COLLEGE

IF KEY SIZE < PLAINTEXT, THEN REPEAT THE KEY


CHECK COLUMN E (PT) AND ROW C (KEY)
THEIR INTERSECTION IS CHARACTER G
LIKEWISE THE FINAL CIPHERTEXT IS:
GBRTRKITWYR

For Decryption,

Check the Key Row and find the corresponding


ciphertext character. Check the corresponding
Column to find the Plaintext character.
Repeat the same.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 57


Vernam Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 58


Vernam Cipher
The Vernam Cipher, also known as the One-Time Pad (OTP) when implemented correctly, is a
symmetric key cipher that performs encryption by combining plaintext and key characters using the
XOR operation. This cipher is theoretically unbreakable if the key is random, as long as the key is as
long as the plaintext, and is used only once.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 59


Vernam Cipher
How It Works:

1.Key: A random key of the same length as the plaintext is generated.


2.Encryption: Each character in the plaintext is XORed with the corresponding character in the key.
3.Decryption: The ciphertext is XORed with the same key to recover the original plaintext.

Encryption Process:
1.Convert the plaintext and key into their binary ASCII representations.
2.Perform the XOR operation between each pair of corresponding bits.
3.Convert the resulting binary back into characters for the ciphertext.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 60


Vernam Cipher
Example 1: Text Message Encryption

1.Plaintext: "HELLO"
2.Key (randomly generated): "XMCKL" (same length as the plaintext)
3.Encryption: Convert each letter of the plaintext and key into their binary equivalents (ASCII or Unicode
values):
1. Plaintext: H = 72, E = 69, L = 76, L = 76, O = 79
2. Key: X = 88, M = 77, C = 67, K = 75, L = 76
4.Perform a bitwise XOR (exclusive OR) between each pair of corresponding characters:

H (72) XOR X (88) = 16 (encrypted value)


E (69) XOR M (77) = 8
L (76) XOR C (67) = 15
L (76) XOR K (75) = 3
O (79) XOR L (76) = 3

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 61


Vernam Cipher
Example 1: Text Message Encryption

Ciphertext (in binary form): 16, 8, 15, 3, 3

Decryption: To decrypt, you apply the same key to the ciphertext:

16 XOR 88 = 72 (H)
8 XOR 77 = 69 (E)
15 XOR 67 = 76 (L)
3 XOR 75 = 76 (L)
3 XOR 76 = 79 (O)

The original message "HELLO" is recovered.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 62


Vernam Cipher
Example 2: Binary Data Encryption:

1. Plaintext (binary data): 10101010 11001100 11110000


2. Key (random binary key): 11001010 01110011 00101100
3. Encryption (bitwise XOR):
10101010 XOR 11001010 = 01100000
11001100 XOR 01110011 = 00111111
11110000 XOR 00101100 = 11011100
4. Ciphertext: 01100000 00111111 11011100
5. Decryption (apply the same key):
01100000 XOR 11001010 = 10101010
00111111 XOR 01110011 = 11001100
11011100 XOR 00101100 = 11110000
The original data is restored.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 63


Vernam Cipher
Key Characteristics of OTP:

•Key Length: The key must be as long as the message.


•Randomness: The key must be truly random and kept secret.
•One-time Use: The key can only be used once, after which it must be discarded.
•Security: When used correctly, the OTP is mathematically proven to be secure.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 64


Hill Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 65


Hill Cipher
The Hill Cipher is a
poly-alphabetic substitution
cipher that encrypts plaintext
characters in groups using linear
algebra. It was invented by Lester
S. Hill in 1929 and is based on
matrix multiplication.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 66


Hill Cipher – Encryption Example
Plain-text:
SHORT EXAMPLE
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 67


Hill Cipher – Encryption Example
Plain-text:
SHORT EXAMPLE
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 70


Hill Cipher – Encryption Example
Plain-text:
SHORT EXAMPLE
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 71


Hill Cipher – Encryption Example
Plain-text:
SHORT EXAMPLE
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 82


Hill Cipher – Decryption Example
Ciphertext
APADJTFTWLFJ
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 83


Hill Cipher – Decryption Example
Ciphertext
APADJTFTWLFJ
Key:
HILL

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 85


Transposition Ciphers

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 100


Transposition Cipher
❖ A Transposition Cipher is a type of encryption method where the positions of the
characters in the plaintext are changed based on a specific system or key, while the
actual characters remain unchanged.
❖This type of cipher focuses on rearranging the order of the letters rather than substituting
them with different ones.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 101


Transposition Cipher
❖ A Transposition Cipher is a type of encryption method where the positions of the
characters in the plaintext are changed based on a specific system or key, while the
actual characters remain unchanged.
❖This type of cipher focuses on rearranging the order of the letters rather than substituting
them with different ones.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 102


Keyless - Rail Fence Cipher
❖Encryption
❖ To encrypt a message using the Rail Fence Cipher, you have to write your message in zigzag lines
across the page, and then read off each row.
❖ Firstly, you need to have a key, which for this cipher is the number of rows you are going to
have.
❖ You then start writing the letters of the plaintext diagonally down to the right until you reach
the number of rows specified by the key.
❖ You then bounce back up diagonally until you hit the first row again. This continues until the end
of the plaintext.
❖ The ciphertext is then read off by writing the top row first, followed by the bottom row.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 103


Rail Fence Cipher
For example, the plaintext "defend the east wall" is written as shown below,
with all spaces removed.

The ciphertext is "DFNTEATALEEDHESWL"

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 104


Rail Fence Cipher
❖ For the plaintext we used above, "defend the east wall", with a key of 3, we get the encryption
process shown below.

❖ Note that at the end of the message we have inserted two "X"s. These are called nulls, and act
as placeholders.
❖ We do this to make the message fit neatly into the grid (so that there are the same number of
letters on the top row, as on the bottom row.
❖Although not necessary, it makes the decryption process a lot easier if the message has this
layout.
❖ The ciphertext is read off row by row to get "DNETLEEDHESWLXFTAAX".

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 105


Rail Fence Cipher
Decryption
❖ We start by making a grid with as many rows as the key is, and as many columns
as the length of the ciphertext.
❖ We then place the first letter in the top left square, and dashes diagonally
downwards where the letters will be.
❖When we get back to the top row, we place the next letter in the ciphertext.
❖Continue like this across the row, and start the next row when you reach the
end.
❖ Example: Consider the ciphertext "TEKOOHRACIRMNREATANFTETYTGHH",
encrypted with a key of 4.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 106


Rail Fence Cipher

From this we can now read the


plaintext off following the
diagonals to get

"they are attacking from the


north".

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 107


Simple Columnar Transposition Cipher
The Columnar Transposition Cipher is a transposition cipher that encrypts a message by writing it
in rows under a keyword, then reading the columns in a defined order. It involves rearranging
the plaintext based on a keyword, creating a grid-like structure.

Steps to Encrypt using the Columnar Transposition Cipher:


1.Choose a Keyword: The keyword is a sequence of letters that will determine the order in which the
columns will be read.
2.Write the Plaintext: Write the plaintext message in rows under the letters of the keyword. If the
message doesn't fit perfectly, add extra characters (often 'X') to fill in the last row.
3.Create the Grid: The number of columns corresponds to the length of the keyword.
4.Read Column-wise: After filling the grid, the ciphertext is created by reading the columns in the order
determined by the alphabetical order of the letters in the keyword.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 108


Simple Columnar Transposition Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 109


Simple Columnar Transposition Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 110


Simple Columnar Transposition Cipher

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 111


Simple Columnar Transposition Cipher
To decrypt the message, the receiver
must know the keyword, the number of
rows, and the column order. The process
is the reverse of encryption:

1.Write the ciphertext in a grid of columns


based on the keyword's order.

2.Rearrange the columns back to their


correct positions.

3.Read the rows to get the original


plaintext.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 112


Simple Columnar Transposition Cipher
with Multiple Rounds (Double
Transposition)
In the Multiple Rounds Columnar Transposition Cipher, the encryption process involves
repeating the Columnar Transposition Cipher several times, often with different
keywords for each round. This added layer of encryption makes the cipher more complex
and secure because it increases the permutations and obfuscates the original message
more effectively.
Steps for Multiple Rounds of Columnar Transposition Cipher:
1.Choose multiple keywords: Select different keywords for each round of encryption. These can be chosen
randomly or based on a secret known to both the sender and the receiver.
2.Encrypt the plaintext in rounds:
1. The plaintext is first encrypted using the first keyword.
2. After each round, the output (ciphertext from the previous round) is used as the input for the next round.

3.Repeat the process: Continue applying the Columnar Transposition Cipher with different keywords until the
desired number of rounds is reached.
4.Decrypting: Decryption is simply the reverse process, where you decrypt the ciphertext in reverse order of the
encryption rounds and use the corresponding keywords in reverse order.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 113


Simple Columnar Transposition Cipher
with Multiple Rounds (Double
Transposition)

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 114


Simple Columnar Transposition Cipher
with Multiple Rounds (Double
Transposition)

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 115


Number Theory and
Modular Mathematics

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 116


Relatively Prime
Integers
Definition:
Two integers a and b are relatively prime if
gcd(a, b) = 1.

Examples:
Are 15 and 28 relatively prime?
Yes, gcd(15, 28) = 1.
Are 55 and 28 relatively prime?
Yes, gcd(55, 28) = 1.
Are 35 and 28 relatively prime?
No, gcd(35, 28) = 7.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 117


Relatively Prime Integers
Definition:

The integers a1, a2, …, an are pairwise relatively prime if


gcd(ai, aj) = 1 whenever 1 ≤ i < j ≤ n.

Examples:

Are 15, 17, and 27 pairwise relatively prime?


No, because gcd(15, 27) = 3.

Are 15, 17, and 28 pairwise relatively prime?


Yes, because gcd(15, 17) = 1, gcd(15, 28) = 1 and gcd(17, 28) =
1.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 118


Least Common Multiples
Definition:

The least common multiple of the positive integers a and b is the smallest positive integer that is
divisible by both a and b. We denote the least common multiple of a and b by lcm(a, b).
Examples:

lcm(3, 7) = 21

lcm(4, 6) = 12

lcm(5, 10) = 10

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 119


Least Common Multiples
Using prime factorizations:

a = p1a1 p2a2 … pnan , b = p1b1 p2b2 … pnbn ,


where p1 < p2 < … < pn and ai, bi ∈ N for 1 ≤ i ≤ n
lcm(a, b) = p1max(a1, b1 ) p2max(a2, b2 ) … pnmax(an, bn )
Example:
a = 60 = 22 31 51 lcm(a, b) = 22 33 51 = 4*27*5 = 540

b = 54 = 21 33 50

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 120


GCD and LCM
a = 60 = 22 31 51

b = 54 = 21. 33 50

gcd(a, b) = 21 31 50 =6

lcm(a, b) = 22 33 51 = 540

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 121


Modular Arithmetic
Let a be an integer and m be a positive integer.
We denote by a mod m the remainder when a is divided by m.

Examples: 9 mod 4 = 1

9 mod 3 = 0

9 mod 10 = 9

-13 mod 4 = 3

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 122


-13 mod 4 = ?
To calculate −13 mod 4:
1.Divide −13 by 4: −13÷4=−3.25
2.Take the integer part of the division (−3) and multiply it by 4:
−3×4=−12
3.Subtract this result from −13:
−13−(−12)=−13+12=−1
4.To express the modulo result as a non-negative remainder
(standard convention):
Add 4 to −1:
−1+4=3
Thus, −13 mod 4 = 3.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 123


Congruences
Let a and b be integers and m be a positive integer. We say that a is
congruent to b modulo m if m divides a – b.

We use the notation a ≡ b (mod m) to indicate that a is congruent to


b modulo m.

In other words:
a ≡ b (mod m) if and only if a mod m = b mod m.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 124


Congruences
Examples:
Is it true that 46 ≡ 68 (mod 11) ?
Yes, because 11 divides (46 – 68).
Is it true that 46 ≡ 68 (mod 22)?
Yes, because 22 | (46 – 68).
For which integers z is it true that z ≡ 12 (mod 10)?
It is true for any z∈{…,-28, -18, -8, 2, 12, 22, 32, …}

Theorem: Let m be a positive integer. The integers a and b are congruent


modulo m if and only if there is an integer k such that a = b + km.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 125


The Euclidean Algorithm
The Euclidean Algorithm finds the greatest common divisor of two integers a
and b.
For example, if we want to find gcd(287, 91), we divide 287 by 91:
287 = 91⋅3 + 14

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 126


The Euclidean Algorithm
Here's the logic broken down:
Division: 287÷91 gives a quotient of 3 and a remainder of 14. This is expressed as:
287=91⋅3+14
Property of Divisors: If a number a divides b and also divides c, then a must also divide (b−c) or
(b+c). This property ensures that any common divisor of 287 and 91 must also divide 14.
Reduction: The problem of finding gcd(287,91) is now reduced to finding gcd(91,14), which
simplifies the computation.
Recursive Step: The algorithm can continue by dividing 91 by 14 to get a new remainder, and so
on, until the remainder becomes 0. The divisor at that step will be the GCD.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 127


The Euclidean Algorithm
In the next step, we divide 91 by 14:
91 = 14⋅6 + 7
This means that gcd (14, 91) = gcd (14, 7).

So we divide 14 by 7:
14 = 7⋅2 + 0
We find that 7 divides 14, and thus gcd(14, 7) = 7.

Therefore, gcd (287, 91) = 7.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 128


The Euclidean Algorithm - SUMMARY
If a number a divides b and a divides c, then a must also divide any linear
combination of b and c, such as (b−c) or (b+c).
In this specific case:
The property being used is b−c.
For the given example:
b=287, c=91⋅3=273
So, 287−273=14.
Thus, any common divisor of 287 and 91 must also divide 14.
Hence GCD is 7
Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 129
Finite Fields

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 130


What is a Finite Field?
A finite field is like a "number system" that has only a limited (finite) amount of numbers, where
we can do addition, subtraction, multiplication, and division (except dividing by zero), and all
the results stay within that system.
Think of it as a game where we have special rules about how numbers behave, and everything
wraps around when we hit a certain limit.

Sridhar Iyer NUMBER THEORY AND MODULAR MATHS 131


Example of a Simple Finite Field
Let’s say we have a field with only 5 numbers: {0,1,2,3,4}. This is called GF(5),
which just means "a finite field with 5 elements"
Addition Rule: Add numbers as usual, but if the sum is 5 or more, wrap it back to
the beginning (mod 5).

Example:
3+4=7, but since 7 is too big, we subtract 5 to "wrap it around," so 3+4=2.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 132


Example of a Simple Finite Field
Multiplication Rule: Multiply numbers as usual, but if the product is 5 or more,
wrap it around (mod 5).

Example:
3×4=12, but 12 is too big, so we divide by 5 and take the remainder: 3×4=2.
This keeps everything inside the set {0,1,2,3,4}.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 133


Finite Field – A Technical
Definition
A finite field, also known as a Galois field, is a field that contains a finite number of elements. It is a set equipped
with two operations: addition and multiplication, which satisfy the following field axioms:

1.Closure: The set is closed under addition and multiplication.


2.Associativity: Both addition and multiplication are associative.
3.Commutativity: Both addition and multiplication are commutative.
4.Distributivity: Multiplication distributes over addition.
5.Identity Elements:
1. There exists an additive identity (0).
2. There exists a multiplicative identity (1).
6.Additive Inverses: Every element has an additive inverse.
7.Multiplicative Inverses: Every non-zero element has a multiplicative inverse.
8.No Zero Divisors: The product of any two non-zero elements is non-zero.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 134


Order of a Finite Field
The order (size) of a finite field is always pn, where:
•p is a prime number (called the characteristic of the field),
•n is a positive integer.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 135


Types of Finite Fields
1.Prime Fields (GF(p):
1. These are finite fields with p elements, where p is a prime number.
2. Elements are {0,1,2,…,p−1}, and arithmetic is performed modulo p.

2.Extension Fields (GF(p):


1. These are finite fields with pn elements, where n>1.
2. They are constructed using polynomials over GF(p), where arithmetic is performed modulo an
irreducible polynomial of degree n.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 136


Example 1: GF(5) (A Prime Field)
Elements: {0,1,2,3,4}

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 137


Example 2: GF(2 ) (An Extension
2

Field)

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 138


Applications of Finite Fields
1.Cryptography:
Used in algorithms like RSA, Elliptic Curve Cryptography (ECC), and AES.

2.Error Detection and Correction:


Reed-Solomon codes and BCH codes rely on finite fields.

3.Computer Science:
Used in hash functions, pseudo-random number generators, and computational algebra.

4.Geometry and Coding Theory:


Projective geometries and linear codes are based on finite fields.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 139


Fermat’s and Euler’s
Theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 140


Fermat's Little Theorem
Fermat's Little Theorem is a fundamental concept in number theory, widely used in cryptography
and modular arithmetic. It states:
Theorem: If p is a prime number and a is an integer such that p does not divide a, then:

ap-1 ≡1 (mod p)
This means that when a is raised to the power p−1, and divided by p, the remainder is
always 1.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 141


Fermat's Little Theorem - Example

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 142


Fermat's Little Theorem - Applications

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 143


Euler’s Theorem
Euler's Theorem is an important result in number theory that generalizes Fermat's Little
Theorem. It provides insights into modular arithmetic and is widely used in cryptography.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 144


Euler’s Theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 145


Euler’s Theorem - Example

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 146


Euler’s Theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 147


Euler’s Theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 148


Chinese Remainder
Theorem

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 149


Chinese Remainder Theorem (CRT)
The Chinese Remainder Theorem is a fundamental theorem in modular arithmetic. It provides a
way to solve systems of simultaneous congruences (modular equations) with different moduli.
This theorem is widely used in number theory, cryptography, and computer science.

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 150


2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 151
2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 152
2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 153
Chinese Remainder Theorem –
Applications

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 154


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 155


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 156


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 157


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 158


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 159


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 160


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 161


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 162


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 163


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 164


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 165


How to Solve Large Exponents?

2/26/2025 PROF. SRIDHAR IYER, DJSCE, MUMBAI 166

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy