Cryptography and Network Security
Cryptography and Network Security
ir
es
D
Cryptography
u
Ed
&
Network Security
This pdf is only designed for B.Tech students of all Engineering Colleges affiliated
with Dr APJ Abdul Kalam Technical University.
This pdf provides help in the exam time for a quick revision in sorting the time.
Compiled by
Sanjeev Yadav
Edu Desire
Computer & Technology
Follow me
EduDesire 1
e
ir
es
D
Security Attack:
u
Ed
EduDesire 2
e
ir
es
D
● Only download software from trusted sources.
u
Ed
Security Services:
These are essentially the desired security outcomes you seek to
achieve. They define the objectives and what needs to be protected.
Think of them as the "what" in cybersecurity.
EduDesire 3
e
ir
es
D
● Non-repudiation: Proving that a specific action was taken by a
u
Ed
Security Mechanisms:
These are the tools and techniques used to implement the desired
security services. They're the "how" in cybersecurity. Think of them as
the specific locks, alarms, and security personnel that safeguard the
treasure chest.
EduDesire 4
e
ir
es
D
● Intrusion Detection/Prevention Systems (IDS/IPS):
u
Ed
What is Encryption?
Encryption is a process of cryptography. It is used to keep the user's data
secret. This is a method that is used to convert data and information into
secret codes called ciphertext. Cipher text is a text that no one can
understand and the original data that we have is called plain text that
everyone can read and understand.
1. The main purpose of encryption is to keep the data secure.
2. To read encrypted data you must have a public key.
What is Decryption?
Decryption is a process of cryptography. It is used to decrypt encrypted
data. Decrypted data or original data is called plain text. That is,
converting Ciphertext to plain text is called Decryption. To convert
Cipher text to plain text we need a key so that we can convert the data
into readable form.
EduDesire 5
e
ir
es
D
Types of Encryption
u
Ed
● Symmetric Encryption
● Asymmetric Encryption
EduDesire 6
e
ir
es
D
Public key: Key which is known to everyone. Ex-public key of A is 7, this
u
Ed
1. Active Attacks:
● Active attacks are the type of attacks in which, The attacker makes
efforts to change or modify the content of messages.
● Active Attack is dangerous to Integrity as well as availability.
● Due to active attack systems are always damaged and System
resources can be changed.
● The most important thing is that, In an active attack, Victim gets
informed about the attack.
EduDesire 7
e
ir
es
D
u
Ed
2. Passive Attacks:
● Passive Attacks are the type of attacks in which, The attacker
observes the content of messages or copies the content of
messages.
● Passive Attack is a danger to Confidentiality.
● Due to passive attack, there is no harm to the system.
● The most important thing is that In a passive attack, Victim does
not get informed about the attack.
EduDesire 8
e
ir
es
D
u
EduDesire 9
e
ir
es
D
u
The prevention possibility of The prevention possibility of
Ed
Steganography:
● Steganography is like hiding a secret message in plain sight.
● Instead of encrypting the message, you hide it within another
seemingly innocent file, like an image, audio file, or even a text
document.
● The goal is to conceal the existence of the message, making it
difficult for others to detect.
2. Using a Cover File: This normal file (like the cat picture) is called
the "cover file." You then embed your secret message into this file
without changing how it looks or sounds much.
EduDesire 10
e
ir
es
D
3. Steganographic Tools: Special tools or techniques are used to
u
Ed
embed the secret message and later extract it. These tools make tiny,
subtle changes to the cover file that are hard to notice.
Introduction to Ciphers
● Cryptography generally protects a system from cyber attackers by
securing communication between two systems.
● A cryptographic process starts with a given plaintext.
● We generate an encrypted ciphertext from the given plaintext
using an encryption algorithm.
● In order to get back the original plaintext message, we utilise a
decryption algorithm:
EduDesire 11
e
ir
es
D
u
Ed
1. Stream Cipher
● Stream cipher comes under the category of the symmetric cipher. It
encrypts a given plain text to a cipher text using a secret key.
● It utilises a key (128/256 bits) and a nonce digit (64-128 bits) to
convert the plaintext to ciphertext. Both the key and nonce digit
creates a keystream of pseudorandom bits. Additionally, it uses
time-varying transformations on the given plaintext and works
bit-by-bit basics.
● Finally, we perform the XOR operation between each bit of
keystream and plaintext in order to generate the ciphertext:
We repeat this whole process for all the bits of the plaintext.
Additionally, it’s essential not to use the same key and nonce
combination throughout the process. Using the same combination can
result in a duplicate keystream.
EduDesire 12
e
ir
es
D
u
Ed
2. Block Cipher:
● Like a stream cipher, a block cipher encrypts a block of given
plaintext using a key and a cryptographic algorithm.
● In contrast to a stream cipher, a block cipher takes fixed-size
blocks of plaintext and produces fixed-size blocks of ciphertext.
● Generally, the size of the plaintext blocks is either 64 or 128 bits:
EduDesire 13
e
ir
es
D
u
Ed
Need less time hence simple. Need more time hence complex.
Use one key for one time. One key can be used multiple
times.
EduDesire 14
e
ir
es
D
u
Ed
EduDesire 15
e
ir
es
D
u
Ed
EduDesire 16
e
ir
es
D
u
Ed
EduDesire 17
e
ir
es
D
u
Ed
5. Counter Mode:
● The Counter Mode or CTR is a simple counter-based block cipher
implementation.
● Every time a counter-initiated value is encrypted and given as
input to XOR with plaintext which results in a ciphertext block.
● The CTR mode is independent of feedback use and thus can be
implemented in parallel.
EduDesire 18
e
ir
es
D
u
Ed
What is Confusion?
● Confusion is a cryptographic mechanism that is utilised to increase
the obscurity of the ciphertext.
● In simple words, the technique assures that the ciphertext has no
information about the plaintext.
● The confusion technique keeps the relationship between the
encrypted text's statistics and the encryption key's value as
complex as possible.
EduDesire 19
e
ir
es
D
● Even if the attacker gains some control over the ciphertext's
u
Ed
What is Diffusion?
● Diffusion may be used to define the property that the repetition in
the plaintext statistics "dissipates" in the ciphertext statistics.
● In diffusion, the output bits must be challengingly dependent on
the input bits so that if the plaintext is modified by only one bit,
the ciphertext must change in an unanticipated or unreliable way.
● The statistical technique of the plaintext is utilized up into
high-range data of the ciphertext during diffusion.
● It is achieved by influencing the value of some ciphertext digits
with each plaintext digit, and it is frequently similar to having
certain plaintext digits impact each ciphertext digit.
EduDesire 20
e
ir
es
D
u
Modifications If one bit in secret is If one image within the
Ed
The DES algorithm takes the plain text of 64-bit as input & produces a
ciphertext of 64-bit using a key of 56 bits. Initially, a 64-bit key length is
used but an 8-bit is discarded.
EduDesire 21
e
ir
es
D
DES is a Feistel Block Cipher implementation, known as LUCIFER. It uses
u
Ed
a Feistel structure with 16 rounds, where a different key is used for each
round.
EduDesire 22
e
ir
es
D
6. Finally Left Plain Text (LPT) is combined with Right Plain Text
u
Ed
Characteristics
● AES has keys of three lengths which are of 128, 192, 256 bits.
● It is flexible and has implementations for software and hardware.
EduDesire 23
e
ir
es
D
● It provides high security and can prevent many attacks.
u
Ed
Advantages
● It can be implemented on both hardware and software.
● It provides high security to the users.
● It provides one of the best open source solutions for encryption.
● It is a very robust algorithm.
Disadvantages
● It requires many rounds for encryption.
● It is hard to implement software.
● It needs much processing at different stages.
● It is difficult to implement when performance has to be considered.
EduDesire 24
e
ir
es
D
u
Ed
[ b0 | b4 | b8 | b12 |
| b1 | b5 | b9 | b13 |
| b2 | b6 | b10| b14 |
| b3 | b7 | b11| b15 ]
EduDesire 25
e
ir
es
D
SubBytes : This step implements the substitution.
u
Ed
In this step each byte is substituted by another byte. Its performed using
a lookup table also called the S-box. This substitution is done in a way
that a byte is never substituted by itself and also not substituted by
another byte which is a complement of the current byte. The result of
this step is a 16 byte (4 x 4 ) matrix like before.
The next two steps implement the permutation.
ShiftRows:
This step is just as it sounds. Each row is shifted a particular number of
times.
● The first row is not shifted
● The second row is shifted once to the left.
● The third row is shifted twice to the left.
● The fourth row is shifted thrice to the left.
(A left circular shift is performed.)
[ b0 | b1 | b2 | b3 ] [ b0 | b1 | b2 | b3 ]
| b4 | b5 | b6 | b7 | -> | b5 | b6 | b7 | b4 |
| b8 | b9 | b10 | b11 | | b10 | b11 | b8 | b9 |
[ b12 | b13 | b14 | b15 ] [ b15 | b12 | b13 | b14 ]
MixColumns:
This step is basically a matrix multiplication. Each column is multiplied
with a specific matrix and thus the position of each byte in the column is
changed as a result.
EduDesire 26
e
ir
es
D
Add Round Keys : Now the resultant output of the previous stage is
u
Ed
XOR-ed with the corresponding round key. Here, the 16 bytes is not
considered as a grid but just as 128 bits of data.
After all these rounds 128 bits of encrypted data is given back as output.
This process is repeated until all the data to be encrypted undergoes this
process.
Decryption :
The stages in the rounds can be easily undone as these stages have an
opposite to it which when performed reverts the changes.Each 128
blocks goes through the 10,12 or 14 rounds depending on the key size.
EduDesire 27
e
ir
es
D
The decryption process is the encryption process done in reverse so i will
u
Ed
Inverse SubBytes :
Inverse S-box is used as a lookup table and using which the bytes are
substituted during decryption.
Applications:
AES is widely used in many applications which require secure data
storage and transmission. Some common use cases include:
EduDesire 28
e
ir
es
D
financial records, and other confidential data from unauthorised
u
Ed
EduDesire 29
e
ir
es
D
u
Designed By DES (Data Encryption AES (Advanced
Ed
EduDesire 30
e
ir
es
D
Double DES:
u
Ed
The double encrypted cipher-text block is first decrypted using the key
K2 to make the single encrypted cipher text. This ciphertext block is
then decrypted using the key K1 to acquire the original plaintext block.
Triple DES:
● Triple DES is also called a TDES.
● It is a symmetric key block cipher, defining that the same key can
be used to encrypt and decrypt information in fixed-length set of
bits known as blocks.
● It is known as "Triple DES" because it uses the DES cipher three
times when encrypting data.
When DES was originally invented in 1976, it needed a key size of 56 bits,
which was an adequate level of security to oppose brute-force attacks.
Because then, computers have become economical and more strong,
EduDesire 31
e
ir
es
D
allowing the 3DES algorithm to use DES three times successively,
u
Ed
Authentication Requirements:
● Authentication is a crucial aspect of information security, ensuring
that individuals, systems, or entities are who they claim to be
before granting access to resources or services.
● Authentication requirements vary depending on the context, the
level of security needed, and the specific system or application.
EduDesire 32
e
ir
es
D
u
Ed
1. Identification:
● Users must provide a unique identifier, such as a username or email
address, to distinguish themselves from others.
● This identification is the first step in the authentication process.
2. Authentication Factors:
● Knowledge Factors: Something the user knows, such as a password,
PIN, or passphrase.
● Possession Factors: Something the user possesses, such as a
security token, smart card, or mobile device.
● Biometric Factors: Something inherent to the user, such as
fingerprints, retina scans, or facial recognition.
EduDesire 33
e
ir
es
D
● The use of two or more authentication factors for increased
u
Ed
security.
● For example, a combination of a password (knowledge factor) and a
one-time code from a mobile app (possession factor).
4. Password Policies:
● Complexity Requirements: Mandating the use of strong passwords
with a mix of uppercase and lowercase letters, numbers, and
special characters.
● Password Length: Specifying a minimum password length to
enhance security.
● Password Expiry: Requiring users to change their passwords
regularly.
6. Session Management:
● Implementing mechanisms to manage user sessions securely,
including timeout periods, automatic logouts, and the ability to
revoke sessions remotely.
7. Secure Transmission:
Protecting authentication credentials during transmission by using
secure protocols (e.g., HTTPS) to prevent interception or tampering.
EduDesire 34
e
ir
es
D
u
Ed
EduDesire 35
e
ir
es
D
● The keyed hash function is another name for the message
u
Ed
EduDesire 36
e
ir
es
D
u
Ed
The sender and receiver share the same secret key to produce a Message
Authentication Code or Cryptographic Checksum. This generated MAC is
appended to the message and sent to the receiver. At the receiving end,
the receiver also generates the Message Authentication Code (MAC) with
the same shared key which is compared with the MAC generated by the
sender. If both the MACs are equal, then the message is valid and coming
from the correct sender, otherwise, the message is invalid.
Hash Function:
● Cryptographic Hash is a Hash function that takes random size
input and yields a fixed-size output.
● It is easy to calculate but challenging to retrieve the original data.
● It is strong and difficult to duplicate the same hash with unique
inputs and is a one-way function so revert is not possible.
● Hashing is also known by different names such as Digest, Message
Digest, Checksum, etc.
EduDesire 37
e
ir
es
D
Properties Of Cryptography Hash Function:
u
Ed
EduDesire 38
e
ir
es
D
u
Ed
EduDesire 39
e
ir
es
D
u
Ed
The characteristics of SHA 512 are almost similar to SHA 256, with the
difference of the following!
● The length of the produced hash or digest is 512 bits.
● The input message is broken down into block sizes that will be in
multiples of 1024 bits.
● The message should be irreversible. The plaintext should not be
retrievable if the digest is available or vice versa.
SHA Description
Versions
SHA-0 Block size: 512 bits, Hash digest: 128 bits, Collision
level: High, Rounds of operations: 64, Weaknesses:
Vulnerable to collisions, Security level: Low
Applications: It is used to verify the integrity of files.
SHA-1 Block size: 512 bits, Hash digest: 160 bits, Collision
level: Medium, Rounds of operations: 80, Weaknesses:
Vulnerable to collisions, Security level: Low,
Applications: It is used for HMAC.
EduDesire 40
e
ir
es
D
SHA-3 Block size: 1152/1088/8, Hash digest: 224/256/384/512
u
Ed
Note: Among the explained versions, the SHA-2 and SHA-3 are the safest
SHA algorithm versions.
EduDesire 41
e
ir
es
D
Hash Size The hash size of SHA 256 is The hash size of SHA 512 is
u
Ed
Let us consider n = 2.
P(Two people have the same birthday) = 1 – P(Two people having
different birthday)
EduDesire 42
e
ir
es
D
= 1 – (365/365)*(364/365)
u
Ed
= 1 – 1*(364/365)
= 1 – 364/365
= 1/365.
So for n people, the probability that all of them have different birthdays
is:
Digital Signature
A digital signature is a mathematical technique used to validate the
authenticity and integrity of a message, software, or digital document.
1. Key Generation Algorithms:
EduDesire 43
e
ir
es
D
● Ensure authenticity and integrity of digital signatures in electronic
u
Ed
transactions.
● Essential for verifying the sender's identity in digital transactions.
● Protect against data alteration and impersonation.
2. Signing Algorithms:
● Create a digital signature by generating a one-way hash of the
electronic data.
● Encrypt the hash value using the private key to form the digital
signature.
● Append the digital signature, along with other information, to the
data.
● Efficiently use hashing to sign shorter hash values instead of entire
messages.
EduDesire 44
e
ir
es
D
● Form the digital signature as the result of the encryption process:
u
Ed
6. Integrity Check:
● The receiver independently computes the message digest from the
received message.
● Ensure that the computed message digest matches the one
obtained through decryption on the digital signature.
● Matching message digests confirm the integrity of the transmitted
message.
EduDesire 45
e
ir
es
D
u
Ed
2. Sales Contracts:
● Authentication of seller and buyer identities through digital
signing of contracts.
● Legally binding signatures provide assurance that agreement terms
remain unchanged.
3. Financial Documents:
● Finance departments use digital signatures on invoices for
trustworthy payment requests.
● Prevents fraudulent attempts, ensuring payment requests come
from legitimate sources.
4. Health Data:
● In healthcare, digital signatures safeguard patient records and
research data.
EduDesire 46
e
ir
es
D
● Ensures confidentiality by verifying data integrity during
u
Ed
transmission.
5. Government Agencies:
● Digital signatures optimise productivity in government processes,
adhering to strict policies.
● From permits to timesheets, ensures the right person is involved
with proper approvals.
Digital Certificate
● Digital certificate is issued by a trusted third party which proves
sender’s identity to the receiver and receiver’s identity to the
sender.
● A digital certificate is a certificate issued by a Certificate Authority
(CA) to verify the identity of the certificate holder.
● The CA issues an encrypted digital certificate containing the
applicant’s public key and a variety of other identification
information.
● Digital certificate is used to attach a public key with a particular
individual or an entity.
Digital certificate is also sent with the digital signature and the message.
EduDesire 47
e
ir
es
D
u
Ed
EduDesire 48
e
ir
es
D
Digital certificate vs digital signature:
u
Ed
EduDesire 49
e
ir
es
D
u
Ed
Key Points:
● SET safeguards electronic credit card transactions using
encryption and hashing.
● Developed with support from major entities like Visa, Mastercard,
Microsoft, and Netscape.
● Focuses on securing payments made over the internet through
credit cards.
● Prevents the exposure of credit card details to merchants,
enhancing protection against hackers.
● Incorporates Certification Authorities for standard Digital
Certificates (e.g., X.509 Certificate).
● A collaborative effort to restrict unauthorised access to sensitive
credit card information.
● General electronic transaction scenario involves client, payment
gateway, client financial institution, merchant, and merchant
financial institution.
EduDesire 50
e
ir
es
D
● Message Integrity: Resist unauthorised modifications to
u
Ed
transmitted content.
● Interoperability: Ensure compatibility for seamless
communication across systems.
● Optimal Security Mechanisms: Employ the best-available security
measures for robust protection.
Where
● PI stands for payment information
● OI stands for order information
● PIMD stands for Payment Information Message Digest
● OIMD stands for Order Information Message Digest
EduDesire 51
e
ir
es
D
● POMD stands for Payment Order Message Digest
u
Ed
Here
● PI, OIMD, OI all have the same meanings as before.
● The new things are :
● EP which is symmetric key encryption
● Ks is a temporary symmetric key
● KUbank is public key of bank
● CA is Cardholder or customer Certificate
● Digital Envelope = E(KUbank, Ks)
EduDesire 52
e
ir
es
D
u
Ed
2. Payment Capture:
● Process where the merchant receives payment.
● Involves generating request blocks to the gateway, and the
payment gateway issues payment to the merchant.
Kerberos:
● Kerberos provides a centralised authentication server whose
function is to authenticate users to servers and servers to users.
EduDesire 53
e
ir
es
D
● In Kerberos Authentication server and database is used for client
u
Ed
authentication.
● Kerberos runs as a third-party trusted server known as the Key
Distribution Center (KDC). Each user and service on the network is
a principal.
Kerberos Overview:
EduDesire 54
e
ir
es
D
2. Authentication Server Verification:
u
Ed
2. Mutual Authentication:
● Enables mutual authentication between service systems and users.
EduDesire 55
e
ir
es
D
● Throughout the process, both parties are assured of each other's
u
Ed
authenticity.
4. Reusable Authentication:
● Authentication in Kerberos is durable and reusable.
● Users authenticate once, and throughout the ticket's lifetime,
reauthentication doesn't require personal information reentry.
5. Security Measures:
● Multiple secret keys, third-party authorization, and cryptography
enhance security.
● Passwords aren't transmitted over networks, and encrypted secret
keys make impersonation challenging for attackers.
Kerberos Version 5
Features Kerberos Version 4
Key salt Uses the principal name Uses the entire principal
algorithm partially. name.
Uses the
Uses the ASN.1 coding
Encoding “receiver-makes-right”
system.
encoding system.
EduDesire 56
e
ir
es
D
u
Well extended.
Ed
Facilitates forwarding,
Ticket support Satisfactory
renewing and
postdating tickets.
Transitive
Reasonable support
cross-realm No present support for
present for such
authentication the cause.
authentication.
support
EduDesire 57
e
ir
es
D
● Firstly, the PGP encryption generates a random session key by
u
Ed
using one of two main algorithms. This key is only used once and
this key is a huge number that cannot be guessed.
● Now, the next step is to encrypt the session key. This can be
achieved by using the public key of the intended recipient of the
message. The public key is tied to a particular person’s identity,
which can be used by anyone to send them a message.
● Now the encrypted PGP session key is sent to the recipient by the
sender, and they can decrypt the same by using their private key.
The recipient can decrypt the actual message using this session
key.
The above figure demonstrates the working of PGP, and that is.
● User A wants to send the message via email to User B.
● Therefore, User B generates the Two keys which are public and
private.
● User B sends the public key to User A.
● Then, User A encrypts the message with that public key and sends
that message to user B.
● User B then decrypts the message by using the private key.
EduDesire 58
e
ir
es
D
● It was first developed by Netscape in the mid-1990s, the main
u
Ed
TLS or Transport Layer Security, the descendent of the SSL, has provided
security and encryption, because of which all modern internet commerce
and communications are possible. It provides continuous updates to
keep pace or an eye on the sophisticated attacker.
Why do we need SSL?
SSL follows these types of security information.
● Data Integrity: It checks for the safety of data, its consistency,
accuracy, and completeness.
● Encryption: It is used to protect the transmission of data for
example server to server, browser to the server, application to the
server, etc.
● Authentication: It checks whether you are connected to the
correct server or not.
EduDesire 59
e
ir
es
D
SSL works with the following two concepts and that is:
u
Ed
1. Asymmetric Cryptography
2. Symmetric Cryptography
EduDesire 60
e
ir
es
D
Now, in the end, both the client and the server have a valid session key
u
Ed
that they can use for further communication and encrypt and decrypt
the actual data.
What is Firewall?
● A firewall is a system or software that provides security to the
network.
● It monitors the internal security by filtering the outgoing and
ingoing network traffic i.e., both in and out based on several rules
implemented by the user.
● They eliminate or in some cases reduce the existence of waste or
unwanted communication, and will only give permission to the
useful information and communications that are taking place in the
network.
The firewall provides a very simple way to involve or add security in the
system which can prevent our system from malicious attacks. It provides
security by involving an Intrusion Detection System or Intrusion
Prevention System, and many other security providers within the
network.
The firewall has become essential to be installed in our system and also
many businesses are using the same so that all their data and files should
be safe and not interrupt by the attacker because security is something
that is a very essential part of the business.
EduDesire 61
e
ir
es
D
u
Ed
Software Firewalls
● Software firewalls are used in local devices or host devices.
● They work by creating an in-depth defence path.
● These are also called host firewalls.
● They can access any type of resource for their work from the
device in which they are installed.
Hardware Firewalls
● Hardware firewalls are a type of physical device that can be found
between a gateway and a computer network.
● It is also known as an Appliance firewall.
● They act as traffic routers.
EduDesire 62
e
ir
es
D
● These are basically security guards that are assigned for the
u
Ed
separate hardware.
● They have their own resources, they don’t need any types of
resources from the system just like the software firewalls.
Proxy Firewalls
● Proxy firewalls are also known as cloud firewalls and
Application-level gateways.
● These firewalls operate with no filter traffic in the application layer.
● They make the traffic and examine all types of data that are passing
through.
EduDesire 63
e
ir
es
D
● These have the special power to check the packet connections in
u
Ed
more depth.
Next-Generation Firewalls
● Next-generation firewalls, by the name, only suggest that all the
newly originated firewalls are considered in this category.
● These come with all the above-combined features and provide
better security.
● These firewalls monitor the full transactions of data, including all
the contents of the packet and header and many other resources
included.
● These firewalls provide higher security than the firewall above
mentioned.
EduDesire 64
e
ir
es
D
Intrusion detection systems can be deployed in any network and hence
u
Ed
are mainly classified into two types. So, let’s see what they are.
EduDesire 65
e
ir
es
D
u
Ed
1.Signature-based detection
● Signature-based detection is designed for detecting special designs
or patterns or we can say that they use a fingerprint of the
malicious virus or threats to identify them i.e., if any virus or threat
has been acknowledged then it will store the signature of that
threat so that in future it can identify easily about that threat and
comes up with full accuracy.
The main thing in this is it can easily detect the known threat but it
becomes difficult or almost impossible to detect the new threat, which
was not detected previously, i.e., they are limited to detect only known
threats.
2. Anomaly-based detection
● Anomaly-based detection is a new technology based on a Machine
learning algorithm, that is usually made for normal behaviour of
EduDesire 66
e
ir
es
D
the system, and now all other behaviour is compared to this tech
u
Ed
model and generates the alert if any types of threat are detected.
● This model can suffer from false positives (i.e., incorrect alerts) and
false negatives (i.e., missed detection).
3. Hybrid detection
● In a hybrid detection system, a hybrid itself means it is a mixture or
combination.
● So, here it is the combination of signature-based detection and
anomaly-based detection.
● The motive of this attack is to lower the error rate and to detect
more potential attacks.
Monoalphabetic Cipher
● The monoalphabetic cipher, also known as the simple substitution
cipher, is one of the earliest and most straightforward encryption
techniques.
● In a monoalphabetic cipher, each letter in the plaintext will always
be replaced by the same letter in the ciphertext.
Explanation:
To illustrate, let’s create a simple monoalphabetic cipher. Suppose we
assign each letter of the alphabet a corresponding letter three positions
ahead:
● Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
● Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Example:
EduDesire 67
e
ir
es
D
● Plain: HELLO
u
Ed
● Cipher: KHOOR
Monoalphabetic ciphers are easy to understand and implement, making
them suitable for beginners.
Polyalphabetic Cipher:
● In contrast to monoalphabetic ciphers, polyalphabetic ciphers
introduce an element of complexity by using multiple substitution
alphabets.
● Instead of each letter being replaced by a single, fixed letter,
different letters within the same message may be substituted with
different letters. This complexity adds a layer of security, making
polyalphabetic ciphers more resistant to traditional cryptanalysis
techniques.
Explanation:
One of the most famous polyalphabetic ciphers is the Vigenère cipher. In
the Vigenère cipher, a keyword is used to determine the shift value for
each letter. For example, if we want to encrypt the word “ENCRYPT” with
the keyword “KEY,” the process would look like this:
● Plain: E N C R Y P T
● Keyword: K E Y K E Y K
● Cipher: R I J X P W X
Example:
● Plain: ENCRYPT
● Keyword: KEYKEYK
● Cipher: RIJXPWX
EduDesire 68
e
ir
es
D
u
Less secure More secure than a
Ed
Monoalphabetic cipher.
The space between words is left The space between the words are
blank. also mapped to some letters.
The same alphabet in the message The same alphabet in the code may
will be made up of similar code or may not be made of similar code
letters. letters.
RSA algorithm:
● The RSA algorithm in Cryptography was developed by 3 founders:
Ron Rivest, Adi Shamir, and Leonard Adleman in 1978, and hence,
this algorithm was named RSA (Rivest, Shamir, and Adleman)
algorithm.
● The RSA algorithm in Cryptography is a public key cryptography
algorithm used for converting plaintext into ciphertext.
● It is also known as asymmetric-key cryptography because two
different keys i.e., a public key and a private key are used for
encrypting and decrypting the message or data.
● As the name implies, the Public Key is made available to anyone,
while the Private Key remains secret or private i.e., not shared with
anyone.
● The public key is used by the sender to encrypt the message or
plain text and a private key is used by the receiver to decrypt the
encrypted message or ciphertext.
EduDesire 69
e
ir
es
D
u
Ed
EduDesire 70
e
ir
es
D
● Finding a Private key
u
Ed
The private key consists of two numbers n & d, i.e., (n, d).
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p = 13
q = 17
EduDesire 71
e
ir
es
D
Step 2: Multiply these numbers to find n = p x q, where n is called the
u
Ed
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (13 - 1) x (17 - 1)
φ (n) = 12 x 16
φ (n) = 192
g.c.d (35, 192) = 1
EduDesire 72
e
ir
es
D
d = 11
u
Ed
Algorithm of CRT
● We will use the following algorithm to code the CRT.
● Calculate M as the product of all moduli, i.e., M = m[0] * m[1] * ... *
m[k-1].
● Calculate the array Mi, where each Mi[i] is equal to M divided by
m[i].
● Calculate the array Zi, where each Zi[i] is the inverse modulo m[i] of
Mi[i]. This can be done using a simple loop that increments a
counter until (Zi[i] * Mi[i]) mod m[i] equals 1.
● Compute the solution X as the sum of (y[i] * Mi[i] * Zi[i]) for all i,
modulo M.
Return X as the final answer.
EduDesire 73
e
ir
es
D
u
Ed
where m1, m2, ..., mn are co-prime (pairwise relatively prime) integers, and
y1, y2, ..., yn are arbitrary integers.
M1 = M/m1
= (m1 * m2 * m3 … * mn)/ m1
= m2 * m3 … * mn
Similarly,
M2 = m1 * m3 … * mn
M3 = m1 * m2 * … * mn
And so on.
EduDesire 74
e
ir
es
D
Similarly,
u
Ed
Example 1
Consider the following system of congruences
X ≅ 1 (mod 5)
X ≅ 1 (mod 7)
X ≅ 3 (mod 11)
Here,
y1 = 1, y2 = 1, y3 = 3,
m1 = 5, m2 = 7, m3 = 11
Since 5, 7, and 11 are relatively prime numbers to one another. So, we can
find X. We can use CRT to find the unique solution to this system of
congruences. The steps to do so are:
Next, we compute Mi
M₁ = M / m1
= m2*m3 (here, M = m1*m2*m3 / m1)
EduDesire 75
e
ir
es
D
= 7 * 11
u
Ed
= 77
M₂ = M / m2
= m1*m3 (here, M = m1*m2*m3 / m2)
= 5 * 11
= 55
M₃ = M / m3
= m1*m2 (here, M = m1*m2*m3/m3)
= 5*7
= 35
Find the modular inverses (Zi) of M₁, M₂, and M₃ modulo 5, 7, and 11,
respectively.
M1Z1 ≅ 1(mod m1)
M1Z1(mod m1) = 1
77*Z1(mod 5) = 1
77 * 3(mod 5) = 1
So, Z1 = 3
55*6(mod 7) = 1
So, Z2 = 6
EduDesire 76
e
ir
es
D
u
Ed
35*6(mod 11) = 1
So, Z3 = 6
Therefore, X = 36.
Now let us look at a real-life example to see where we can use this
theorem.
Example 2
Ninja has a friend, Alice, who has a secret number she wants to share
with him. But instead of giving the number directly, she decided to give
him the remainder of the number when divided by two different factors,
say 5 and 7. Let's say her number has a remainder of 1 when divided by 5
and a remainder of 2 when divided by 7
To find the number, Ninja can use the Chinese Remainder Theorem to
combine the remainders in a certain way to get a unique solution that
satisfies both equations.
The equation that he can form from this will be:
X ≅ 1 (mod 5)
X ≅ 2 (mod 7)
EduDesire 77
e
ir
es
D
X is Alice’s secret number.
u
Ed
Before moving to the solution, try to find X yourself so the concept of the
Chinese Remainder Theorem will be clear to you.
Here,
y1 = 1, y2 = 2
m1 = 5, m2 = 7
Calculating M:
M = m1*m2
=5*7
= 35
Finding Mi:
M₁ = M / m1
= m2 (here, M = m1*m2 / m1)
=7
M₂ = M / m2
= m1 (here, M = m1*m2 / m2)
=5
Calculating X:
EduDesire 78
e
ir
es
D
= (1 * 3 * 7 + 2 * 3 * 5) mod 35
u
Ed
Edu Desire
Computer And Technology
Thank You!
Follow me
EduDesire 79