CNS Notes 1 & 2
CNS Notes 1 & 2
01
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.
Cryptography is the art and science of making a cryptosystem that is capable of providing information security.
Cryptography deals with the actual securing of digital data. It refers to the design of mechanisms based on mathematical
algorithms that provide fundamental information security services. Cryptography is the study of secure communications
techniques that allow only the sender and intended recipient of a message to view its contents. The term is derived from the
Greek word kryptos, which means hidden.
• Cryptanalysis (code breaking) - the study of principles/ methods of deciphering cipher text without knowing key
❖ Types of cryptography
❖ Symmetric key cryptography : It is the simplest kind of encryption techniques that involves only one
key to encrypt and decrypt (or cipher and decipher ) information . It is also called as secret key
cryptography / private key cryptography . The most popular symmetric key cryptography system is DES
(Data encryption system ). During this process, data is converted to a format that cannot be read or
inspected by anyone who does not have the secret key that was used to encrypt it.
The success of this approach depends on the strength of the random number generator
that is used to create the secret key. Symmetric Key Cryptography is widely used in today's Internet and
primarily consists of two types of algorithms, Block and Stream. Some common encryption algorithms include
the Advanced Encryption Standard (AES) and the Data Encryption Standard (DES). This form of encryption is
traditionally faster than Asymmetric however it requires both the sender and the recipient of the data to have the
secret key. Asymmetric cryptography does not rely on sharing a secret key and forms the basis of the FIDO
authentication framework.
Symmetric Cryptography:
Asymmetric Cryptography:
Both symmetric and asymmetric cryptography have their strengths and weaknesses, and they are often used
together in hybrid encryption schemes to take advantage of their respective benefits.
❖ SECURITY GOALS:
In the context of cryptography, security goals refer to the fundamental objectives that cryptographic techniques and
systems aim to achieve. Cryptography is the practice of securing communication and data by converting plaintext
into ciphertext using various mathematical algorithms. The security goals in cryptography include:
1. Confidentiality: The primary goal of cryptography is to ensure the confidentiality of information. It involves
encrypting data in such a way that only authorized parties can decrypt and access the original information.
Unauthorized individuals or attackers who intercept the encrypted data should not be able to understand its
content.
2. Integrity: Cryptography aims to maintain the integrity of data, meaning that the information remains
unaltered during transmission or storage. By using cryptographic techniques such as digital signatures and
message authentication codes (MACs), recipients can verify that the data they receive has not been tampered
with or corrupted.
3. Authentication: Cryptography provides mechanisms for verifying the identity of communicating parties.
Through digital signatures and authentication protocols, users can confirm the authenticity of messages and
the identity of the sender.
4. Non-repudiation: Non-repudiation ensures that a sender cannot deny sending a message, and a recipient
cannot deny receiving it. Digital signatures are commonly used to achieve non-repudiation by providing
evidence of the origin and integrity of a message.
5. Availability: While not a primary goal of cryptography, it is essential to consider availability in cryptographic
systems. Poorly designed or implemented cryptographic solutions can lead to denial-of-service (DoS) attacks
that disrupt the availability of services.
6. Key Management: Effective key management is critical to maintaining the security of cryptographic systems.
The goals related to key management include ensuring secure key generation, distribution, storage, and
revocation.
7. Forward Secrecy: This goal aims to protect past communication even if long-term secret keys are
compromised in the future. Forward secrecy ensures that the compromise of a current key will not allow an
attacker to decrypt previously encrypted messages.
8. Backward Secrecy: Backward secrecy, also known as perfect forward secrecy, guarantees that the
compromise of long-term secret keys will not allow an attacker to decrypt past communications encrypted
with those keys.
9. Resistance to Attacks: Cryptographic algorithms should be resistant to various attacks, such as brute force
attacks, known plaintext attacks, chosen plaintext attacks, and more. The security of a cryptographic system
relies on the algorithm's ability to withstand these attacks.
10. Performance Efficiency: While maintaining security is essential, cryptographic algorithms should also be
efficient enough to perform computations in a reasonable amount of time, especially in resource-constrained
environments.
Understanding these security goals helps in selecting appropriate cryptographic algorithms and protocols for specific
use cases, ensuring that the data and communication remain protected against potential threats and unauthorized
access.
❖ Cryptographic attacks:
Cryptographic attacks can be broadly categorized into two distinct types: 1.Cryptanalytic and 2.Non-
cryptanalytic.
❖ Cryptanalytic attacks: These attacks are combination of statistical and algebraic techniques aimed at
ascertaining the secret key of a cipher.
• These methods inspect the mathematical properties of the cryptographic algorithms and aims at finding
distinguishers of the output distribution of cryptographic algorithms form uniform distributions.
• The objective of cryptanalysis is to find properties of the cipher which does not exist in a random
function.
• Here distinguishers means that all attacks are fundamentally distinguishers.The attacker thus guesses the
key and looks for the distinguishing property.If the property is detected,the guess is correct otherwise the
next guess is tried.
• The guessing complexity is lesser than the brute force search complexity.
❖ Non-cryptanalytic attacks:
• The other types of attacks are non-cryptanalytic attacks, which do not exploit the mathematical weakness of the
cryptographic algorithm. The three goals of security---confidentiality,integrity,and availability---can be threatened
by security attacks.
➢ Attacks threatening confidentiality: In general , two types of attacks threaten the confidentiality of
information: snooping and traffic analysis.
Snooping:
• It refers to unauthorized access to or interception of data.For example,a file transferred through the
internet may contain confidential information.
• An unauthorized entity may interrupt the transmission and use the contents for her own benefit.
• To prevent snooping, the data can be made nonintelligible to the intercepter by using
encipherment technique .
Traffic analysis:
• Although encipherment of data may it non intelligible for the intercepter, she can obtain some
other type information by monitoring online traffic.
• For example, she can find the electronic address of the sender or the receiver.
➢ Attacks threatening integrity: The integrity of data can be threatened by several kinds of attacks:
modification, masquerading, replaying and repudiation.
Modification:
• After intercepting or accessing information, the attacker modifies the information to make it
beneficial to herself.
• For example, a customer sends a message to a bank to do some transaction. The attacker
intercepts the message and changes the type of transaction to benefit herself.
Masquerading:
• For example, a user tries to contact a bank, but another site pretends that it is the bank and
obtains some information from the user.
Replaying:
• The attacker obtains a copy of a message sent by a user and later tries to replay it.
• For example , a person sends a request to her bank to ask for payment to the attacker, who has done a job for her. The
attacker intercepts the message and sends it again to receive another payment from the bank.
Repudiation:
• This type of attack is different from others because it is performed by one of the two parties in
the communication:sender and the receiver.
• The sender of the message might later deny that she has sent the message; the receiver of
themessage might later deny that she has received the message.
Denial of service:
• It is very common attack.It may slow down or totally interrupt the service of a system.
• The sender sends so many bogus requests to a server that the server crashes because of
heavyload.
Passive attacks:
• The attackers goal is just to obtain information.This means that the attack does not
modifydata or harm the system.
• The system continues with its normal operation.The attack may harm the sender or
thereceiver of the message.
• Attacks that threaten confidentiality--snooping and traffic analysis ---are passive attacks.
Active atacks:
❖ Mathematics of Cryptography:
Cryptography is based on some specific areas of mathematics, including number theory, linear algebra and
algebraic structures.
Set of Integers: The set of integers, denoted by Z, contains all integral numbers(with no fraction)from negative
infinity to positive infinity.
z={.......,-2,-1,0,1,2. .... }
Binary operations: In cryptography , we are interested in three basic operations applied to the set of
integers.A binary operation takes two inputs and creates one output.
• Three basic operations are addition, subtraction and multiplication. Each of these operations takes
2inputs and creates 1 output.
• The two inputs come from the set of integers; the output goes into the set of integers.
➢ Integer Division:
In integer arithmetic, if we divide a by n, we get q and r. The relationship between these four integers
can be shown as
a=q×n+r
In this relation , a is called the dividend; q, the quotient; the divisor; and r, the remainder.
Two Restrictions: For our purpose,we impose two restrictions.First,we require that the divisor be a
positive integer(n>0). Second,we require that the remainder be a non-negative integer(r ≥ 0).
➢ Divisibility: If a is not zero and we let r=0 in the division relation, we get
a=q×n
we say that n divides a.we can also say that a is divisible by n.when we are not interested in the value of q,we
can write the above relationship as a|n.If the remainder is not zero,then n does not divide a and we can write
therelationship as a×n.
Properties:
Example:
➢ Greatest Common Divisor: One integer often needed in cryptography is the greatest common divisor of two
positive integers. Two positive integers may have many common divisors, but only one greatest common divisor.
fig:Common divisors of two integers
Note: The greatest common divisor of two positive integers is the largest integer that can divide both integers
➢ Euclidean Algorithm: Finding the greatest common divisor (gcd) of two positive integers by listing allcommon
divisors is not practical when two integers are large.
Fact 1: gcd(a,0)=a
gcd(36,10)=gcd(10,6)=gcd(6,4)=gcd(4,2)=gcd(2,0)=2
• we use two variables r1 and r2, to hold the changing values during the process of reduction.They
areinitialized to a and b.
• In each step, we calculate the remainder of r1 divided by r2 and store the result in the variable r.we
thenreplace r1 by r2 and r2 by r.
• The steps are continued until r2 becomes 0.At this moment,we stop. The gcd(a,b) is
r1.when gcd(a,b) = 1, we say that a and b are relatively prime
sol:
Given two integers a and b,we often need to find other two integers, s and t, such
thats×a+t×b=gcd(a,b)
The Extended euclidean algorithm can calculate the gcd(a,b) and at the same time calculate the value of s and
t.The algorithm and the process is shown below diagram.
• The extended euclidean algorithm uses the same number of steps as the Euclidean algorithm.
Howeverin each step , we use three sets of calculations and exchange instead of one.
• The algorithm uses three sets of variables, r's, s's and t's.
• In each step r1,r2 and r have the same values in the Euclidean algorithm.
• The variables r1 and r2 are initialized to the values of a and b respectively.
• The variables s1 and s2 are initialized to 1 and 0 respectively.
• The variables t1 and t2 are initialized to 1 and 0 respectively.
• The calculations of r, s and t are similar, with one warning.
Although r is the remainder of dividing r1 and r2, there is no such relationship between the other two
sets.There is only one quotient, q, which is calculated r1|r2 and used for the other two calculations.
b.Algorithm
r=r1-q×r2 s=s1-q × s2 t=t1-q × t2
Although we will see a very important application of the extended Euclidean algorithm. One immediate
applications is to find the solutions to the linear Diophantine equations of two variables, an equation of type
ax+by+c.we need to find integer values for x and y that satisfy the equation.This type of equation has either no
solution or an infinite number of solutions.
If d|c , then we have an infinite number of solutions. one of them is called the particular; the
rest, general
➢ MODULAR ARITHMETIC:
• The division relationship (a=q × n+r) has two inputs (a and n) and two outputs (q and r).
• In modular arithmetic , we are intereted in only one of the outputs, the remainder r.we don't care
aboutthe quotient q.
• In other words , we want to know what is the value of r when we divide a by n.
• This implies that we can change the above relation into a binary operator with two inputs a and n
andone output r.
Modulo Operator:
• The above mentioned binary operator is called the modulo operator and is shown as mod.
• The second input (n) is called the modulus. The output r is called the residue.
• The below figure shows , the modulo operator (mod) takes an integer (a) from the set z and a
positivemodulus (n) .The operator creates a nonnegative residue (r) .we can say
a mod n = r
Set of Residues: Zn
• The result of the modulo operation with modulus n is always an integer between 0 and n-1.
• In other words, the result of a mod n is always a nonnegative integer less than n.
• we can say that the modulo operation creates a set, which in modular arithmetic is referred to as
theset of least residues modulo n, or Zn.
• We have infinite instances of the set of residues (Zn),one for each value of n.
• The below figure shows the set Zn and three instances, Z2,Z6, and Z11.
Congruence:
• The congruence operator looks like the equality operator, but there are differences. First, an equality
operator maps a member of Z to itself; the congruence operator maps a member from Z to member
of Zn. Second, the equality operator is one-to-one ; the congruence operator is many-to-one.
• The phrase (mod n) that we insert at the right-hand-side of the congruence operator is just an
indication of the destination set (Zn).
Traditional symmetric key ciphers are a class of cryptographic algorithms that use the same secret key
for both encryption and decryption of data. These ciphers are called "symmetric" because the
encryption and decryption processes are reversible using the same key. The security of symmetric key
ciphers relies on keeping the key secret, as anyone with knowledge of the key can decrypt the data.
1. Caesar Cipher: One of the oldest and simplest ciphers, the Caesar cipher involves shifting each
letter in the plaintext by a fixed number of positions down the alphabet. For example, with a
shift of 3, 'A' becomes 'D,' 'B' becomes 'E,' and so on.
2. Vigenère Cipher: This cipher is an extension of the Caesar cipher, using a keyword to
determine the shifting amount for each letter. The keyword is repeated until it
matches the length of the plaintext, and each letter is shifted based on the
corresponding letter in the keyword.
3. Playfair Cipher: The Playfair cipher uses a 5x5 matrix of letters (ignoring duplicates) to
encrypt digraphs (pairs of two letters) from the plaintext. The matrix is generated
using a keyword, and the positions of the letters in the matrix determine the
encryption.
4. Hill Cipher: The Hill cipher operates on blocks of plaintext letters, treating them as
vectors and multiplying them by a matrix key. The resulting vectors are then mapped
back to letters using modular arithmetic.
5. Data Encryption Standard (DES): DES is a symmetric key block cipher that became a
widely used standard for encryption in the 1970s and 1980s. It uses a 56-bit key to
encrypt data in 64-bit blocks. Due to its small key size, DES is no longer considered
secure, and it has been replaced by more robust algorithms.
6. Advanced Encryption Standard (AES): AES is a widely adopted symmetric key block
cipher that supports key sizes of 128, 192, or 256 bits. It is currently considered one
of the most secure symmetric ciphers and is used in various applications, such as
data encryption, secure communications, and file encryption.
It's important to note that while symmetric key ciphers offer faster encryption and
decryption compared to asymmetric (public-key) ciphers, they require a secure mechanism
to exchange the secret key between the communicating parties. Public-key cryptography
was developed to address this issue by using different keys for encryption and decryption.
Certainly! Let's delve into the details of some traditional symmetric key ciphers:
1. Caesar Cipher:
• The Caesar cipher is a substitution cipher where each letter in the plaintext is
replaced by a letter some fixed number of positions down the alphabet.
• Key: The key is the number of positions each letter is shifted. For example, with
a key of 3, 'A' becomes 'D,' 'B' becomes 'E,' and so on.
• Decryption: To decrypt the ciphertext, simply shift each letter in the opposite
direction by the same key value.
2. Vigenère Cipher:
• The Vigenère cipher is an extension of the Caesar cipher, using a keyword to
determine the shifting amount for each letter in the plaintext.
• Key: The key is a keyword consisting of one or more letters, which is repeated
until it matches the length of the plaintext.
• Encryption: To encrypt the plaintext, shift each letter of the plaintext by the
corresponding letter in the keyword (e.g., A + B = C, B + C = D, and so on).
• Decryption: To decrypt the ciphertext, shift each letter of the ciphertext
backward by the corresponding letter in the keyword.
3. Playfair Cipher:
• The Playfair cipher encrypts digraphs (pairs of two letters) from the plaintext
using a 5x5 matrix of letters.
• Key: The key is a keyword or phrase used to generate the Playfair matrix.
• Encryption: To encrypt, first preprocess the plaintext (e.g., removing spaces,
combining duplicate letters, adding a dummy letter if necessary). Then, find the
positions of each digraph in the Playfair matrix and apply specific rules to
determine the ciphertext digraph.
• Decryption: To decrypt, reverse the process by finding the positions of each
digraph in the Playfair matrix and applying the reverse rules to obtain the
original plaintext digraph.
4. Hill Cipher:
• The Hill cipher operates on blocks of plaintext letters, treating them as vectors
and multiplying them by a matrix key.
• Key: The key is a square matrix, often 2x2 or 3x3, that serves as the encryption
and decryption key.
• Encryption: Divide the plaintext into blocks and convert each block into a
numeric vector. Multiply each vector by the key matrix modulo some value
(usually the size of the alphabet) to get the ciphertext vector.
• Decryption: Multiply the ciphertext vector by the inverse of the key matrix
modulo the same value to obtain the original plaintext vector.
5. Data Encryption Standard (DES):
• DES is a symmetric key block cipher that operates on 64-bit blocks of plaintext.
• Key: The key size is 56 bits, but there are 64 bits in total, with 8 bits used for
parity and the remaining 56 bits as the actual key.
• Encryption: The algorithm uses a series of permutations, substitutions, and key
mixing operations to produce the ciphertext.
• Decryption: The decryption process is similar, but the keys are used in reverse
order.
6. Advanced Encryption Standard (AES):
• AES is a widely adopted symmetric key block cipher that operates on 128-bit
blocks of plaintext.
• Key: The key size can be 128, 192, or 256 bits, and the number of rounds varies
accordingly.
• Encryption: AES uses substitution, permutation, and bitwise operations to
process the data through multiple rounds to produce the ciphertext.
• Decryption: The decryption process reverses the encryption process using the
same key in reverse order.
It's important to emphasize that while these traditional symmetric key ciphers were
historically significant and useful, many of them have vulnerabilities that make them
unsuitable for modern secure communications. As a result, modern cryptographic
applications rely on stronger algorithms such as AES for secure data encryption and
decryption.
Monoalphabetic ciphers are a type of substitution cipher where each letter in the plaintext is replaced
by the same corresponding letter in the ciphertext. In other words, the same letter in the plaintext will
always be replaced by the same letter in the ciphertext throughout the encryption process. These
ciphers are called "monoalphabetic" because they use a fixed substitution alphabet throughout the
entire encryption and decryption process.
The key feature of monoalphabetic ciphers is that each letter in the plaintext is mapped to a unique
letter in the ciphertext. This type of cipher is relatively easy to implement, but it is also straightforward
to crack using various cryptanalysis techniques, such as frequency analysis.
There are several types of monoalphabetic ciphers, and here are a few examples:
1. Caesar Cipher:
• Description: The Caesar cipher is one of the simplest and earliest known
encryption techniques. It is a substitution cipher where each letter in the
plaintext is replaced by a letter some fixed number of positions down the
alphabet.
• Key: The key is the number of positions (shift value) each letter is moved. For
example, with a key of 3, 'A' becomes 'D,' 'B' becomes 'E,' and so on.
• Encryption: To encrypt the plaintext, each letter is shifted forward in the
alphabet by the key value. Non-alphabetic characters are left unchanged.
• Decryption: To decrypt the ciphertext, each letter is shifted backward by the
key value to obtain the original plaintext.
2. Atbash Cipher:
• Description: The Atbash cipher is a special case of the monoalphabetic cipher
where each letter in the plaintext is replaced with its reverse in the alphabet. It
is a substitution cipher with a fixed alphabet reversal.
• Encryption: To encrypt the plaintext, each letter is replaced with its reverse in
the alphabet. For example, 'A' becomes 'Z,' 'B' becomes 'Y,' 'C' becomes 'X,' and
so on. Non-alphabetic characters are left unchanged.
• Decryption: The Atbash cipher is its own inverse, so decryption is the same as
encryption.
3. Keyword Cipher:
• Description: The Keyword cipher is a monoalphabetic substitution cipher that
uses a keyword to determine the substitution alphabet. The keyword is used to
generate a unique alphabet by combining the letters of the keyword with the
remaining unused letters of the standard alphabet.
• Key: The key is the keyword used to create the unique substitution alphabet.
• Encryption: To encrypt the plaintext, each letter in the plaintext is replaced by
the corresponding letter in the substitution alphabet created from the keyword.
Non-alphabetic characters are left unchanged.
• Decryption: To decrypt the ciphertext, the process is reversed by using the
same keyword to generate the substitution alphabet and replacing each letter
in the ciphertext with its corresponding letter in the standard alphabet.
4. Simple Substitution Cipher:
• Description: The Simple Substitution Cipher is a monoalphabetic substitution
cipher that uses a fixed substitution alphabet. The substitution alphabet is
typically represented as a random permutation of the standard alphabet.
• Key: The key is the fixed substitution alphabet used for both encryption and
decryption.
• Encryption: To encrypt the plaintext, each letter in the plaintext is replaced by
the corresponding letter in the fixed substitution alphabet. Non-alphabetic
characters are left unchanged.
• Decryption: To decrypt the ciphertext, the process is reversed by using the
same fixed substitution alphabet and replacing each letter in the ciphertext
with its corresponding letter in the standard alphabet.
5. Affine Cipher:
• Description: The Affine cipher is an extension of the Caesar cipher, where each
letter in the plaintext is first multiplied by a constant (a), then a fixed value (b) is
added, and finally, the result is taken modulo the size of the alphabet.
• Key: The key consists of two values, 'a' and 'b,' where 'a' is the multiplier and 'b'
is the shift value.
• Encryption: To encrypt the plaintext, each letter is transformed using the
formula (ax + b) % 26, where 'x' is the position of the letter in the alphabet (0
to 25).
• Decryption: To decrypt the ciphertext, the process is reversed using the formula
a^(-1)(y - b) % 26, where 'y' is the position of the letter in the alphabet (0 to 25)
and a^(-1) is the modular multiplicative inverse of 'a.'
Monoalphabetic ciphers are relatively easy to understand and implement, but they suffer
from significant vulnerabilities, such as frequency analysis, which makes them insecure for
modern cryptographic applications. As a result, they are mainly of historical interest and
educational value rather than practical use in secure communications. Modern
cryptography relies on more robust algorithms, such as polyalphabetic ciphers, block
ciphers, and public-key cryptography, to ensure data confidentiality and integrity.
1. Addition Cipher (also known as Shift Cipher or Caesar Cipher):
• Description: The addition cipher is a type of substitution cipher where each letter in the
plaintext is replaced by a letter some fixed number of positions down the alphabet. It is a
specific case of the Affine Cipher, where the multiplier 'a' is equal to 1.
• Key: The key is the number of positions (shift value) each letter is moved down the
alphabet.
• Encryption: To encrypt the plaintext, each letter is shifted forward in the alphabet by the
key value. Non-alphabetic characters are left unchanged.
• Decryption: To decrypt the ciphertext, each letter is shifted backward by the key value to
obtain the original plaintext.
Example: Plaintext: HELLO Key: 3 Encryption: H -> K, E -> H, L -> O, L -> O, O -> R Ciphertext: KHOOR
2. Multiplication Cipher:
• Description: The multiplication cipher is another type of substitution cipher that operates on
numeric representations of letters. Each letter in the plaintext is multiplied by a constant 'a,' and
the result is taken modulo the size of the alphabet to obtain the corresponding ciphertext letter.
• Key: The key is the multiplier 'a.'
• Encryption: To encrypt the plaintext, each letter is first converted to its numerical representation
(e.g., A=0, B=1, Z=25), then multiplied by 'a,' and finally reduced modulo the alphabet size
(usually 26 for English alphabets).
• Decryption: To decrypt the ciphertext, the process is reversed using the modular multiplicative
inverse of 'a' (if it exists) to recover the original plaintext letter.
One limitation of both addition and multiplication ciphers is that they are susceptible to brute force attacks due to
their small keyspace. In the case of the addition cipher, there are only 25 possible keys (excluding 0), while the
multiplication cipher has even fewer keys if the multiplier and alphabet size share common factors.
Consequently, these ciphers are not considered secure for protecting sensitive information and are primarily used
for educational purposes and historical interest.
In modern cryptography, more advanced algorithms with larger keys and stronger mathematical foundations are
employed to ensure the confidentiality and integrity of data. Examples include symmetric key block ciphers like
Advanced Encryption Standard (AES) and public-key cryptography schemes like RSA.
Polyalphabetic ciphers are a class of encryption techniques that use multiple substitution
alphabets during the encryption process. Unlike monoalphabetic ciphers, where each letter
is consistently mapped to the same letter in the ciphertext, polyalphabetic ciphers
introduce variability in the substitution process by using different substitution alphabets
based on a key or a repeating pattern.
The primary idea behind polyalphabetic ciphers is to enhance the security of the encryption
by disguising the statistical properties of the plaintext, making it more resistant to
frequency analysis and other common cryptanalytic attacks. The most famous
polyalphabetic cipher is the Vigenère cipher, but there are other variations as well.
1. Vigenère Cipher:
• Description: The Vigenère cipher is a polyalphabetic substitution cipher that
uses a keyword to determine the shift amount for each letter in the plaintext. It
is a substantial improvement over monoalphabetic ciphers and was considered
unbreakable for centuries.
• Key: The key is a keyword (a word or phrase) that is repeated until it matches
the length of the plaintext. Each letter of the keyword is used to determine the
shift value for the corresponding letter in the plaintext.
• Encryption: To encrypt the plaintext, the letters of the keyword are used to shift
the corresponding letters in the plaintext using the Caesar cipher's principle.
Each letter in the plaintext is shifted by the corresponding letter's position in
the keyword (e.g., A + B = C, B + C = D, and so on).
• Decryption: To decrypt the ciphertext, the process is reversed by using the
same keyword to determine the shift values and shifting each letter backward
to obtain the original plaintext.
2. Autokey Cipher:
• Description: The autokey cipher is a variant of the Vigenère cipher that uses
part of the plaintext itself as the key. The key is gradually built during the
encryption process by appending the plaintext letters to the initially provided
key.
• Key: The key is a short initial key provided by the user, and it is extended by
appending the plaintext letters as they are encrypted.
• Encryption: To encrypt the plaintext, the letters of the initial key are used to
shift the corresponding letters in the plaintext using the Vigenère cipher's
principle. As each letter is encrypted, it is added to the key to create the next
shift value.
• Decryption: The decryption process is similar, using the ciphertext as the input
and the initial key to reverse the encryption process and obtain the original
plaintext.
3. Playfair Cipher (can also be considered a polyalphabetic cipher):
• Description: The Playfair cipher, while traditionally classified as a digraphic
substitution cipher, can also be seen as a type of polyalphabetic cipher. It uses
a 5x5 matrix of letters to encrypt digraphs (pairs of two letters) from the
plaintext.
• Key: The key is a keyword or phrase used to generate the Playfair matrix. The
matrix is filled with the unique letters of the keyword, and the remaining letters
of the alphabet are added in order, excluding duplicates.
• Encryption: To encrypt, the plaintext is processed in digraphs, and each
digraph's positions in the Playfair matrix determine the ciphertext digraph.
• Decryption: The decryption process reverses the encryption process using the
positions of the ciphertext digraph in the Playfair matrix to find the original
plaintext digraph.
Here are the key aspects and features of symmetric key cryptography:
1. Key Generation:
• A symmetric key algorithm requires a secret key that is known only to the authorized parties involved
in the communication.
• The process of generating a secure key involves selecting a random or pseudorandom sequence of
bits of appropriate length based on the requirements of the algorithm.
2. Encryption and Decryption:
• Encryption: To encrypt plaintext, the symmetric encryption algorithm takes the plaintext and the
secret key as input and produces ciphertext as output. The algorithm performs a series of
mathematical operations to obscure the original data, making it unintelligible to unauthorized parties.
• Decryption: To decrypt the ciphertext and obtain the original plaintext, the recipient uses the same
secret key and applies the decryption algorithm, which reverses the encryption process.
3. Security and Key Management:
• The security of symmetric key cryptography relies on keeping the secret key confidential. If an
unauthorized party gains access to the secret key, they can decrypt the ciphertext and access sensitive
information.
• Key management is a critical aspect of symmetric key cryptography. Secure key distribution and key
agreement protocols are essential to ensure that the secret key is securely exchanged between the
communicating parties.
4. Key Length and Security:
• The security of symmetric key cryptography depends on the length of the secret key. Longer keys
provide a larger keyspace, making brute-force attacks impractical.
• Key length is typically measured in bits, and common key sizes range from 128 to 256 bits in modern
cryptographic systems.
5. Modes of Operation:
• Symmetric key algorithms can operate in various modes to process data of different sizes. Common
modes include Electronic Codebook (ECB), Cipher Block Chaining (CBC), Counter (CTR), and
Galois/Counter Mode (GCM).
• Each mode offers unique advantages, such as parallel processing, data integrity, and authentication.
6. Performance:
• Symmetric key algorithms are generally more efficient in terms of performance compared to public-
key algorithms (asymmetric key algorithms).
• Symmetric key encryption and decryption are much faster because they involve simpler mathematical
operations compared to asymmetric key algorithms.
7. Examples of Symmetric Key Algorithms:
• Data Encryption Standard (DES) and Triple DES (3DES): Widely used historically but considered weak
by today's standards due to small key sizes (e.g., 56 bits).
• Advanced Encryption Standard (AES): A widely adopted and secure symmetric key block cipher with
key sizes of 128, 192, or 256 bits.
• Blowfish and Twofish: Other symmetric key block ciphers known for their security and efficiency.
• RC4 and ChaCha20: Stream ciphers used for encrypting data streams and real-time communication.
Despite its efficiency and widespread use, one significant challenge in symmetric key cryptography is key distribution.
The secure exchange of secret keys between parties can be a complex task, especially in large-scale systems. To
address this issue, hybrid cryptographic systems combine the strengths of both symmetric and asymmetric key
algorithms, using asymmetric encryption for secure key exchange and then symmetric encryption for efficient data
encryption during communication.
A block cipher is a symmetric key cryptographic algorithm that encrypts and decrypts fixed-size blocks
of data (usually 64 or 128 bits) at a time. It is one of the fundamental building blocks of modern
cryptography and is widely used for data encryption, secure communications, and various other
applications. A block cipher takes a fixed-length block of plaintext as input and produces a
corresponding block of ciphertext using a secret key.
Block ciphers play a crucial role in ensuring data confidentiality and integrity in various applications,
including disk encryption, secure communication, virtual private networks (VPNs), and more. When
used properly, block ciphers offer strong encryption and protection against various cryptanalytic
attacks.
❖ Stream Cipher
A stream cipher is a symmetric key cryptographic algorithm that encrypts and decrypts data one bit or
byte at a time. Unlike block ciphers, which process fixed-size blocks of data, stream ciphers work with
data streams of arbitrary length. They are particularly useful for real-time communication and
applications where data is continuously generated or transmitted.
While stream ciphers offer advantages in terms of speed, efficiency, and real-time processing, their
security heavily depends on the quality of the keystream generation. If the keystream is not
unpredictable or if it is reused, stream ciphers can be vulnerable to various cryptanalytic attacks,
including keystream recovery and key-reuse attacks. Therefore, proper implementation and key
management are essential to ensure the security of stream cipher-based systems.
❖ BlowFish
Blowfish is a symmetric key block cipher designed by Bruce Schneier in 1993. It is one of
the earliest block ciphers that gained widespread use and recognition due to its simplicity,
efficiency, and security. Blowfish is a Feistel network cipher, meaning it uses multiple
rounds of key-dependent transformations to process data.
Despite its strengths, the use of Blowfish has diminished in favor of more advanced block
ciphers like AES, which have undergone more extensive cryptographic analysis and
standardization. While Blowfish remains secure against known attacks, it is generally
recommended to use more modern ciphers like AES for new cryptographic applications to
ensure the highest level of security. However, Blowfish can still be found in legacy systems
and applications, where its simplicity and performance make it a viable choice.
Here are the key components and details of a data encryption system:
1. Encryption Algorithm:
• The heart of the data encryption system is the encryption algorithm, a mathematical function that
transforms plaintext (original data) into ciphertext (encrypted data).
• Modern encryption algorithms, such as AES (Advanced Encryption Standard) and Blowfish, are
designed to be secure against known cryptanalytic attacks and offer strong encryption.
2. Secret Key:
• The secret key is a critical component of the encryption system. It is a piece of secret information used
to control the encryption and decryption process.
• The encryption algorithm takes the secret key as input to produce ciphertext from plaintext during
encryption. To decrypt the ciphertext and obtain the original plaintext, the same secret key is used in
reverse.
3. Key Generation:
• Generating a secure and random secret key is a crucial aspect of the encryption system. The key
should have a sufficient length and entropy to resist brute-force attacks.
• Key generation may involve using cryptographic random number generators or key derivation
functions to create secure keys from user-supplied passwords.
4. Data Padding:
• Encryption algorithms typically operate on fixed-size blocks of data. However, real-world data may not
always fit perfectly into these blocks.
• Data padding is used to ensure that the plaintext is a multiple of the block size so that the encryption
algorithm can process the data correctly. Common padding schemes include PKCS#7, ISO/IEC 7816-4,
and Zero Padding.
5. Encryption Modes:
• The encryption mode defines how the encryption algorithm processes multiple blocks of data.
Common modes include Electronic Codebook (ECB), Cipher Block Chaining (CBC), Counter (CTR), and
Galois/Counter Mode (GCM).
• Each mode offers unique advantages, such as parallel processing, data integrity, and authentication.
6. Decryption:
• Decryption is the reverse process of encryption, where ciphertext is converted back to plaintext using
the same encryption algorithm and secret key.
• The decryption algorithm undoes the transformations applied during encryption to recover the
original data.
7. Key Management:
• Proper key management is crucial for the security of the encryption system. Secure key distribution,
storage, and rotation practices are essential to protect the secret keys from unauthorized access.
8. Applications:
• Data encryption systems are widely used in various applications, including securing sensitive files and
data on disk or in databases, protecting communication over the internet (e.g., SSL/TLS), securing
emails, and more.
It is important to note that while symmetric key encryption provides strong confidentiality, it does not inherently
provide data authentication or integrity. For secure communication and data protection, a comprehensive security
approach often combines symmetric key encryption with other cryptographic techniques, such as hash functions for
integrity verification and digital signatures for authentication. Additionally, modern cryptographic systems often use
hybrid encryption, where symmetric key encryption is used for data encryption, and asymmetric key (public-key)
encryption is used for secure key exchange.
AES (Advanced Encryption Standard) is a symmetric key block cipher widely used for data encryption and
protection. It was established as a standard by the U.S. National Institute of Standards and Technology (NIST) in
2001, replacing the aging Data Encryption Standard (DES). AES has become the most widely used encryption
algorithm and is considered secure for various cryptographic applications.
Advantages of AES:
1. Security: AES has withstood extensive cryptanalysis and has demonstrated a high level of security
against known attacks.
2. Efficiency: AES is highly efficient in both hardware and software implementations, making it suitable for
a wide range of applications.
3. Standardization: AES is a globally recognized and standardized encryption algorithm, promoting
interoperability and compatibility across different systems.
Applications of AES:
1. Secure Communication: AES is commonly used in secure communication protocols, such as SSL/TLS,
VPNs, and secure email (S/MIME).
2. Data Protection: AES is used to encrypt sensitive data stored in databases, files, and cloud storage to
ensure confidentiality.
3. Disk Encryption: AES is utilized in full disk encryption and file encryption tools to protect data on
computer hard drives and portable storage devices.
4. Multimedia Content Protection: AES is employed in digital rights management (DRM) systems to
safeguard copyrighted content distribution.
Overall, AES is a robust and widely adopted encryption standard that provides a high level of security and
efficiency, making it a foundational component of modern cryptographic systems.
RC4(Rivest Cipher 4)
RC4 (Rivest Cipher 4) is a symmetric key stream cipher that was designed by Ron Rivest in
1987. It gained popularity due to its simplicity, efficiency, and fast implementation in both
hardware and software. However, over time, serious security vulnerabilities were discovered
in RC4, making it unsuitable for secure cryptographic applications. As a result, its usage has
been widely discouraged, and more secure algorithms like AES (Advanced Encryption
Standard) are recommended for modern cryptographic purposes.
1. Key Size:
• RC4 accepts variable-length secret keys, typically ranging from 1 to 256 bytes
(8 to 2048 bits). The key length influences the strength of the encryption.
2. Key Setup:
• RC4 uses a key setup algorithm to initialize its internal state with the provided
secret key.
• During key setup, RC4 generates a pseudorandom permutation of all possible
byte values (0 to 255) based on the key and arranges them into an initial
permutation vector (S-box).
3. Pseudo-Random Generation:
• The core of RC4 is a pseudo-random generation algorithm that produces a
keystream, which is a sequence of bytes that appears random but is
determined by the secret key and the initial permutation vector (S-box).
• The keystream is combined with the plaintext using bitwise XOR to generate
the ciphertext.
4. Stream Generation:
• The keystream generation process involves the use of two pointers (i and j) and
frequent swapping of the values in the S-box to generate the pseudorandom
keystream.
Security Concerns:
1. Key Vulnerabilities:
• RC4 is vulnerable to related-key attacks, which means that weaknesses are
present when certain related keys are used in succession.
• Moreover, the key scheduling algorithm in RC4 does not effectively mix the key
bits, leading to biases in the initial S-box permutation, which further weakens
the security.
2. Statistical Biases:
• Due to the flaws in the key setup and keystream generation, RC4 exhibits
statistical biases in its output, making it susceptible to various cryptanalytic
attacks, such as the "bias attack" and "multiple-partial-key recovery attack."
3. RC4 Weaknesses:
• The weaknesses in RC4, especially in its key scheduling algorithm, were
highlighted over the years through multiple attacks, leading to the deprecation
of its usage.
Due to the security vulnerabilities and weaknesses, RC4 is no longer considered secure for
modern cryptographic applications. It is advised not to use RC4 for encryption or any other
cryptographic purposes. Instead, modern algorithms like AES or ChaCha20 are
recommended, as they have undergone extensive analysis and are designed to provide
secure encryption for various cryptographic needs.
❖ Key Distribution
There are several key distribution techniques and protocols used in cryptography: