0% found this document useful (0 votes)
114 views24 pages

PPR

The document discusses several questions related to encryption techniques. It provides explanations of Hill cipher encryption using a numeric example, how DES decryption is the inverse of encryption, characteristics needed for a secure hash function, using an autokey cipher to encrypt plaintext with a given keyword, and the differences between monoalphabetic and polyalphabetic ciphers.

Uploaded by

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

PPR

The document discusses several questions related to encryption techniques. It provides explanations of Hill cipher encryption using a numeric example, how DES decryption is the inverse of encryption, characteristics needed for a secure hash function, using an autokey cipher to encrypt plaintext with a given keyword, and the differences between monoalphabetic and polyalphabetic ciphers.

Uploaded by

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

Question 1.

Encrypt the plaintext “EXAM using Hill Cipher, Where k=


(11837)

Ans:

To encrypt the plaintext "EXAM" using the Hill Cipher with the key
k=(11837), we first need to convert the plaintext into numeric values
based on the position of the letters in the alphabet:

E=5

X = 24

A=1

M = 13

Next, we need to break the numeric values into pairs based on the key
matrix size (in this case, a 2x2 matrix):

[11 8]

[3 7]

Then, we need to multiply the key matrix with the numeric value matrix
and take the modulus 26 of each result:
[11 * 5 + 8 * 24] mod 26 = (55 + 192) mod 26 = 247 mod 26 = 17 -> Q

[3 * 5 + 7 * 24] mod 26 = (15 + 168) mod 26 = 183 mod 26 = 9 -> I

[11 * 1 + 8 * 13] mod 26 = (11 + 104) mod 26 = 115 mod 26 = 11 -> L

[3 * 1 + 7 * 13] mod 26 = (3 + 91) mod 26 = 94 mod 26 = 16 -> P

Therefore, the encrypted text for "EXAM" using Hill Cipher with key
k=(11837) is "QILP".

Question 2 Show that DES decryption is, in fact, the inverse Of DES
encryption.

Ans:

To show that DES decryption is the inverse of DES encryption, we need


to demonstrate that decrypting a cipher text with the same key used
for encryption will result in the original plaintext.

Let

P be the plaintext message,

C be the cipher text

obtained by encrypting P using the DES algorithm with key K, and

P' be the plaintext obtained by decrypting

C using the same key K.


DES encryption process:

1. P -> Initial permutation -> L0 R0

2. 16 rounds of Feistel structure:

Li = Ri-1

Ri = Li-1 XOR f (Ri-1, Ki)

3. Final Permutation

DES decryption process:

1. C -> Initial permutation -> L16R16

2. 16 rounds of Feistel structure:

Li = Ri+1

Ri = Li+1 XOR f(Ri+1, Ki)

3. Final Permutation

Comparing the encryption and decryption processes, we can observe


that the Feistel structure of decryption is the reverse of the Feistel
structure of encryption. Therefore, if we decrypt the ciphertext C using
the same key K, we will obtain the original plaintext P. This
demonstrates that DES decryption is indeed the inverse of DES
encryption.
Question 3: What characteristics are needed If a secure hash function?

Ans:

1. Collision resistance: It should be computationally infeasible to


find two different input values that produce the same hash value.
2. Pre-image resistance: It should be computationally infeasible to
determine the original input value from the hash value.
3. Second pre-image resistance: Given an input value, it should be
computationally infeasible to find a different input value that
produces the same hash value as the original input.
4. Deterministic: The same input value should always produce the
same hash output.
5. Fast computation: The hash function should be efficient and fast
to compute, even for large input values.
6. Secure key length: The hash function should have a sufficient key
length to resist brute force attacks.
7. Universality: The hash function should be applicable to a wide
range of input values and data types.
8. Resistance to length extension attacks: The hash function should
not be vulnerable to attacks where an attacker can extend the
length of the input data without changing the hash output.
9. Non-reversibility: The hash function should be non-reversible,
meaning that it should be difficult or impossible to reverse-
engineer the original input value from the hash output without
the key.
Question 4: Using keyword “ANTICIPATION”, Piain text "You Should
Defend the East Wall of the Castle”. You should find Cipher text using
Auto key Cipher.

Ans:

Step 1: Choose a keyword

For this example, our keyword is "ANTICIPATION".

Step 2: Repeat the keyword until it matches the length of the plaintext

Our plaintext is "You Should Defend the East Wall of the Castle", which
has 46 characters. So, we repeat the keyword "ANTICIPATION" until it
matches the length of the plaintext:

ANTICIPATIONANTICIPATIONANTICIPIC

Step 3: Convert the plaintext and keyword to numerical values

A=0, B=1, C=2, ..., Z=25

Y = 24, O = 14, U = 20 ...

Our keyword in numerical values becomes: 0-13-19-8-2-8-14-0-19-8-14

And our plaintext in numerical values becomes: 24-14-20-0-7-14-11-3-


19-3-7-4 19-4-5-13-4 19-8-5-1-19-19-22 22-0-11-4 14-0-12-11-3-14-4

Step 4: Encrypt the plaintext using auto key cipher


The Auto key Cipher works by adding together the numerical values of
the plaintext and the keyword, then taking the result mod 26 to find
the ciphertext.

Y + A = 24 + 0 % 26 = 24 = Y

O + N = 14 + 13 % 26 = 1 = B

U + T = 20 + 19 % 26 = 13 = N

S + I = 19 + 8 % 26 = 21 = V

H + C = 7 + 2 % 26 = 9 = I

O + I = 14 + 8 % 26 = 16 = P

U + P = 20 + 15 % 26 = 9 = I

L + A = 11 + 0 % 26 = 11 = L

L + N = 11 + 13 % 26 = 24 = Y

R + T = 17 + 19 % 26 = 10 = K

G + I = 6 + 8 % 26 = 14 = O

H + C = 7 + 2 % 26 = 9 = I

E + I = 4 + 8 % 26 = 12 = M

A + P = 0 + 15 % 26 = 15 = O

S + A = 19 + 0 % 26 = 19 = T

T + N = 19 + 13 % 26 = 6 = G
H + T = 7 + 19 % 26 = 0 = A

E + I = 4 + 8 % 26 = 12 = M

E + C = 4 + 2 % 26 = 6 = G

A + I = 0 + 8 % 26 = 8 = I

S + P = 19 + 15 % 26 = 8 = I

T + I = 19 + 8 % 26 = 21 = V

W + C = 22 + 2 % 26 = 24 = Y

A + P = 0 + 15 % 26 = 15 = O

L + A = 11 + 0 % 26 = 11 = L

L + N = 11 + 13 % 26 = 24 = Y

O + T = 14 + 19 % 26 = 7 = H

F + I = 5 + 8 % 26 = 13 = N

T + C = 19 + 2 % 26 = 21 = V

H + K = 7 + 10 % 26 = 17 = R

E + N = 4 + 13 % 26 = 17 = R

E + T = 4 + 19 % 26 = 23 = X

A + C = 0 + 2 % 26 = 2 = C

S + N = 19 + 13 % 26 = 6 = G

T + D = 19 + 3 % 26 = 22 = W

W + E = 22 + 4 % 26 = 0 = A
A + N = 0 + 13 % 26 = 13 = N

L + D = 11 + 3 % 26 = 14 = O

L + I = 11 + 8 % 26 = 19 = T

O + C = 14 + 2 % 26 = 16 = P

F + N = 5 + 13 % 26 = 18 = S

T + A = 19 + 0 % 26 = 19 = T

H + T = 7 + 19 % 26 = 0 = A

E + I = 4 + 8 % 26 = 12 = M

E + O = 4 + 14 % 26 = 18 = S

A + F = 0 + 5 % 26 = 5 = F

S + L = 19 + 11 % 26 = 4 = E

T + O = 19 + 14 % 26 = 7 = H

W + N = 22 + 13 % 26 = 9 = I

A + C = 0 + 2 % 26 = 2 = C

L + C = 11 + 2 % 26 = 13 = N

L + A = 11 + 0 % 26 = 11 = L

O + M = 14 + 12 % 26 = 0 = A

F + C = 5 + 2 % 26 = 7 = H

T + N = 19 + 13 % 26 = 6 = G

H + D = 7 + 3 % 26 = 10 = K
E + I = 4 + 8 % 26 = 12 = M

E + A = 4 + 0 % 26 = 4 = E

A + L = 0 + 11 % 26 = 11 = L

S + N = 19 + 13 % 26 = 6 = G

T + D = 19 + 3 % 26 = 22 = W

H + I = 7 + 8 % 26 = 15 = O

E + D = 4 + 3 % 26 = 7 = H

E + L = 4 + 11 % 26 = 15 = O

A + I = 0 + 8 % 26 = 8 = I

S + P = 19 + 15 % 26 = 8 = I

T + C = 19 + 2 % 26 = 21 = V

L + N = 11 + 13 % 26 = 24 = Y

O + D = 14 + 3 % 26 = 17 = R

F + I = 5 + 8 % 26 = 13 = N

T + E = 19 + 4 % 26 = 23 = X

H + M = 7 + 12 % 26 = 19 = T

E + A = 4 + 0 % 26 = 4 = E

A + C = 0 + 2 % 26 = 2 = C

S + N = 19 + 13 % 26 = 6 = G

T + D = 19 + 3 % 26 = 22 = W
O + E = 14 + 4 % 26 = 18 = S

F + N = 5 + 13 % 26 = 18 = S

T + H = 19 + 7 % 26 = 0 = A

H + T = 7 + 19 % 26 = 0 = A

H + E = 7 + 4 % 26 = 11 = L

E + X = 4 + 23 % 26 = 1 = B

A + C = 0 + 2 % 26 = 2 = C

S + G = 19 + 6 % 26 = 1 = B

T + I = 19 + 8 % 26 = 1 = B

W + G = 22 + 6 % 26 = 2 = C

A + I = 0 + 8 % 26 = 8 = I

L + I = 11 + 8 % 26 = 19 = T

L + V = 11 + 21 % 26 = 6 = G

O + N = 14 + 13 % 26 = 1 = B

F + D = 5 + 3 % 26 = 2 = C

T + W = 19 + 22 % 26 = 15 = O

H + A = 7 + 0 % 26 = 7 = H

E + L = 4 + 11 % 26 = 15 = O

E + L = 4 + 11 % 26 = 15 = O

A + Y = 0 + 24 % 26 = 22 = W
S + O = 19 + 14 % 26 = 7 = H

T + H = 19 + 7 % 26 = 0 = A

W + I = 22 + 8 % 26 = 4 = E

A + T = 0 + 19 % 26 = 19 = T

L + C = 11 + 2 % 26 = 13 = N

L + C = 11 + 2 % 26 = 13 = N

O + A = 14 + 0 % 26 = 14 = O

Therefore, the ciphertext using Autokey Cipher is


"YBNVIPIYLMNYOVHAITGIMVOAHVBLYOFTACSTIEYOSXGWTCAHGSWA
NLOFTHEOSLGIHMEASGNWALNTOFTHOFTHEABWTIYOKFTEBSSGAOTH
EAITLTHYOFTHEDWEOHOBAWSWBESTA"

Question 5: What Is the difference between a mono alphabetic cipher


and a polyalphabetic cipher?

Ans:

1. Mono alphabetic Cipher: jitni dfa bhi wo lafaz aye ussi ky sath
replace krna ha

o In a mono alphabetic cipher, each symbol in the plaintext is


mapped to a fixed symbol in the cipher text.

o Examples of mono alphabetic ciphers include the Caesar-


shift cipher, where each letter is shifted based on a numeric
key, and the atbash cipher, where each letter is mapped to
the letter symmetric to it about the center of the alphabet.
o The relationship between a character in the plaintext and
the corresponding character in the cipher text is one-to-one.

o Mono alphabetic ciphers are simple substitution ciphers.

o They are not as strong as polyalphabetic ciphers in terms of


security.

2. Polyalphabetic Cipher: agr dobara wohi lafz aye too kisi aur se bhi
replace kr sakty hnn

o In a polyalphabetic cipher, multiple substitution alphabets


are used for the substitution process.

o The Vigenère cipher is a well-known example of a


polyalphabetic cipher (though it is a simplified special case).

o The relationship between a character in the plaintext and


the characters in the ciphertext is one-to-many.

o Polyalphabetic ciphers include more complex techniques like


the Playfair cipher, Hill cipher, one-time pad, and the
famous Enigma cipher.

o They offer enhanced security and resistance to frequency


analysis attacks.

In summary, mono alphabetic ciphers are simpler but less secure, while
polyalphabetic ciphers provide better security by using multiple
substitution alphabets

Question 6: Explain Playfair Cipher,What Is the purpose of the S-boxes


In DES? Explain
Ans:

Play fair Cipher is a cryptographic technique used for encrypting and


decrypting text. It uses a 5x5 matrix of letters to substitute pairs of
letters in the plaintext with different pairs of letters. The key to the Play
fair Cipher is a keyword that determines the arrangement of the letters
in the matrix. To encrypt the plaintext, pairs of letters are found in the
matrix, and a set of rules is applied to determine the corresponding
pairs of letters in the cipher text.

S-boxes in the Data Encryption Standard (DES) are substitution boxes


used in the substitution-permutation network in the encryption
process.

The purpose of S-boxes

S-boxes (substitution boxes) serve a crucial role in the encryption


process by providing non-linearity, which is essential for the security
and strength of the cipher. Here’s a detailed explanation of their
purpose:

 Non-linearity and Confusion: S-boxes introduce non-linearity into


the DES algorithm, making it more resistant to linear and
differential cryptanalysis. This non-linearity creates confusion in
the relationship between the plaintext and the ciphertext, which
helps obscure patterns that could be exploited by attackers.
 Substitution: Each S-box takes a 6-bit input and produces a 4-bit
output by substituting the input bits according to a predefined
table. This substitution process is designed to be as complex and
unpredictable as possible, which adds another layer of security.
 Diffusion Enhancement: When combined with the P-boxes
(permutation boxes) and the overall Feistel structure of DES, the
S-boxes help to ensure that small changes in the plaintext result in
significantly different ciphertext. This property, known as
diffusion, means that a single bit change in the plaintext should
ideally affect half the bits in the ciphertext after several rounds of
DES.
 Complexity and Security: The specific design of the S-boxes in DES
was carefully chosen to avoid certain vulnerabilities. Each S-box is
different and is constructed in a way that ensures the security
properties of the algorithm. For example, they are designed to
minimize the possibility of linear relations between inputs and
outputs, making it difficult to create straightforward algebraic
expressions that could simplify the encryption process.

In summary, the S-boxes in DES play a vital role in ensuring the security
of the encryption by introducing non-linearity, enhancing confusion and
diffusion, and making it difficult for attackers to find patterns or
develop shortcuts

Long 1:

1. _In a public-key system using RSA, you Intercept the

cipher text C = 10

sent to a user whose

public key Is e = 5,

n= 35.
What is the plaintext M? Determine p, q such that n= p*q and

M=C* mod A.

explain step by step and perform

ans:

Given:

Ciphertext (C) = 10

Public key (e) = 5

Modulus (n) = 35

We know that the formula for decrypting an RSA ciphertext is:

M = C^d mod n, where d is the private key exponent.

In an RSA system, we can calculate the private key exponent (d) using
the public key components (e,p,q) and Euler's totient function (φ(n)).

1. Calculate the Euler's totient function (φ(n)):

φ(n) = (p-1)(q-1)

2. Since n = p*q, we can factorize n = 35 into its prime factors (p and q):

35 = 5 * 7
3. Calculate φ(n):

φ(n) = (5-1)(7-1) = 4*6 = 24

4. Calculate the private key exponent (d) using the modular inverse of e
mod φ(n):

d ≡ e^(-1) mod φ(n)

e=5

φ(n) = 24

We need to find d such that (d * e) mod φ(n) ≡ 1

5d ≡ 1 mod 24

d≡5

So, private key exponent (d) = 5

Now, decrypt the ciphertext:

M = C^d mod n

M = 10^5 mod 35
M = 100000 mod 35

M = 10

Therefore, the plaintext M is 10.

Long 2:

Briefly explain following public key distribution techniques with


diagram

a) Public Key Directory 'b) Public Key Authority explain it

Ans:

Public Key Directory:


a) In this technique, public keys of all users are stored in a central
directory or database, which can be accessed by anyone who
wants to communicate securely with them.
b) When a user wants to communicate securely with another user,
they first retrieve the public key of the recipient from the
directory.
c) The public key is then used to encrypt the message before
sending it.

Diagram:

[User A] <---> [Public Key Directory] <--- {Encrypted Message} ---> [User
B]
Public Key Authority:

b) In this technique, there is a trusted third party known as the


Public Key Authority (PKA) that is responsible for verifying and
distributing public keys.
c) Each user generates their own public and private key pair and
sends their public key to the PKA for verification.
d) The PKA then signs the public key using its own private key,
essentially certifying that the public key belongs to the user.

Diagram:

[User A] <--- (Public Key + User Identity) ---> [PKA]

[PKA] <--- {Signed Public Key} ---> [User A]

When User A wants to communicate securely with User B, they can first
verify the public key of User B from the PKA, ensuring that they are
communicating with the intended recipient.

1) What is Feistel Structure? Briefly explain six Design Principles of


Feistel Structure?

1.Feistel Structure:

o The Feistel Structure is the basis for modern block ciphers.

o It concatenates multiple simple ciphers to create a stronger


product cipher.
o Key principles:

1. Number of Rounds: Determines the complexity; more


rounds enhance security.

2. Design of Function: The round function complexity


contributes to overall security.

3. Confusion and Diffusion: Ensures ciphertext complexity


by mixing plaintext and key.

4. Key Size: Larger keys prevent brute-force attacks.

5. Key Schedule: Careful design ensures independent and


unpredictable keys.

6. Block Size: Larger blocks prevent statistical attacks.

7. Non-linearity: Non-linear S-boxes provide confusion.

8. Security Analysis: Evaluate resistance against attacks

2) Differentiate between Stream cipher and Block cipher briefly?

2. Stream Cipher vs. Block Cipher:

o Block Cipher: Processes fixed-size blocks (e.g., 64 or 128 bits) at


a time.

 Uses confusion and diffusion principles.

 Slower but suitable for strong encryption.

o Stream Cipher: Encrypts/decrypts one bit or byte at a time.

 Only uses confusion.


 Faster but less secure than block ciphers when reusing
the same key.

 Key length: Typically 128 or 256 bits

3) Can the One Time Pad (OTP) be vulnerable to certain types of attacks
or vulnerabilities?

3. One Time Pad (OTP):

o OTP is theoretically unbreakable if used correctly.

o Vulnerabilities arise when:

 OTP key is reused (statistical attacks).

 Key generation isn’t truly random.

 Key length is insufficient.

o Randomizing substitution tables doesn’t enhance security


significantly.

4) What is frequency analysis in context of cryptography? How does


frequency analysis work to break substitution ciphers?

4. Frequency Analysis:

o Technique to break substitution ciphers.

o Exploits letter frequencies in a language.

o Common letters (e.g., ‘E’ in English) help identify substitutions.

o Digraphs and other traits aid decryption


5) What is the role of a compression function in a hash function?

5. Role of a Compression Function in a Hash Function:

o A compression function in a hash function transforms two


fixed-length inputs into a fixed-length output.

o It ensures that the hash output remains consistent


regardless of the input size.

o Unlike conventional data compression, it is “one-way” and


irreversible.

o Commonly used in cryptographic hash functions like


Merkle–Damgård construction

6) Discuss and explain the Strength of Data Encryption Standard (DES)


technique.

5. Strength of Data Encryption Standard (DES):

o DES is a symmetric-key block cipher with a 56-bit key length.

o Concerns:

 Algorithm: DES uses Feistel network and has


influenced cryptography.

 Key Size: 56-bit keys allow approximately 7.2 × 10^16


possible keys.

 Insecurity: DES was broken by EFF in 1998 using a


specialized “DES cracker.”
 Alternatives: Triple DES (3DES) and AES are more
secure options

7) Differentiate between Symmetric cryptography and Asymmetric


cryptography briefly?

5. Symmetric vs. Asymmetric Cryptography:

o Symmetric:

 Uses a single key for both encryption and decryption.

 Faster but requires secure key distribution.

 Provides confidentiality only.

 Key length: 128 or 256 bits.

o Asymmetric:

 Uses a pair of keys (public and private).

 Slower but enhances security and key management.

 Provides confidentiality, authenticity, and non-


repudiation.

 Key length: 2048 bits or higher

8) Explain the Viruses, Trojan horse and Worms?

5. Viruses, Trojan Horses, and Worms:

o Virus: Attaches to other software, harms the system, and


can’t be controlled remotely.
o Worm: Replicates to slow down systems and can be
controlled remotely.

o Trojan Horse: Steals information without replicating itself

9) Show that DES decryption is, in fact, the inverse of DES encryption.

5. DES Decryption as Inverse of Encryption:

o DES decryption is the same process as encryption but with


reversed round keys.

o Feistel construction ensures reversibility.

o Each round undoes the XOR masking applied during


encryption.

No information loss; plaintext is recovered

10) What characteristics are needed in a secure hash function?

5. Characteristics of a Secure Hash Function:

o Pre image Resistance: Hard to find an input for a given hash


value.

o Second Preimage Resistance: Hard to find a different input


with the same hash.

o Collision Resistance: Hard to find two different inputs with


the same hash.

o Avalanche Effect: Small input changes lead to drastically


different hashes.

o Efficiency: Fast computation and low resource utilization.


11) What are the different types of firewalls and how do they differ in
operation?

5. Types of Firewalls:

o Packet Filtering: Filters packets based on rules (IP addresses,


ports).

o Stateful Inspection: Tracks connection state and enforces


rules.

o Proxy Firewalls: Acts as an intermediary between internal


and external networks.

o Application Layer Firewalls: Analyze application-specific


traffic.

o Next-Generation Firewalls: Combine features for advanced


security

You might also like