Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

(Note : this document was generated by an AI and is not approved by any faculty from our college)

Assignment 2
Class : CSE TY
Subject : Cryptography Network Security
Generated On : Mon, Jan 29

Q1. Explain Symmetric Cryptographic algorithm with an example (DES).

Ans.

Symmetric cryptographic algorithms, also known as secret-key algorithms, are a class of cryptographic
algorithms that use a single shared key to both encrypt and decrypt data. This means that the same
key is used for both encryption and decryption, and anyone who has the key can access the
information.

One popular symmetric cryptographic algorithm is the Data Encryption Standard (DES). DES is a block
cipher, which means that it encrypts data in fixed-size blocks. In DES, the block size is 64 bits. The
input to the algorithm is a 64-bit block of data, and the output is a 64-bit block of encrypted data.

DES works by first dividing the input block into two 32-bit halves. Each half is then processed
separately by a complex series of mathematical operations. These operations include substitutions,
permutations, and XOR operations. The result of these operations is two new 32-bit halves, which are
then combined to form the encrypted block.

DES is a relatively old algorithm, and it is no longer considered to be secure. However, it is still used in
some applications, such as legacy systems and smart cards.

Here is an example of how DES works:

1. Plaintext: The plaintext message is "Meet me at the park."


2. Key: The secret key is "MySecretPassword".
3. Encryption: The plaintext message is divided into two 32-bit halves: "Meet me" and "at the
park". Each half is then processed separately by the DES algorithm, using the secret key. The
result of these operations is two new 32-bit halves, which are then combined to form the
encrypted block.
4. Ciphertext: The ciphertext is: "01101001 00110111 01101110 01100101 01110010
00111111 00100000 01101000".

To decrypt the ciphertext, the same key is used. The ciphertext block is divided into two 32-bit halves,
and each half is processed separately by the DES algorithm, using the secret key. The result of these
operations is two new 32-bit halves, which are then combined to form the plaintext message.

DES is a symmetric cryptographic algorithm that uses a single shared key to both encrypt and decrypt
data. It is a block cipher, which means that it encrypts data in fixed-size blocks. The input to the
algorithm is a 64-bit block of data, and the output is a 64-bit block of encrypted data. DES is a
relatively old algorithm, and it is no longer considered to be secure. However, it is still used in some
applications, such as legacy systems and smart cards.

Q2. Explain the RSA Algorithm with an example.

Ans.
The RSA algorithm is an asymmetric cryptographic algorithm used for secure data transmission. It is
based on the concept of public-key cryptography, where two different keys are used for encryption and
decryption.

Key Generation:

1. Generate Two Large Prime Numbers: Select two large prime numbers, p and q, such that
both are roughly of the same size.

2. Compute the Product: Calculate the product of the two primes, n = p * q. This value is
called the modulus.

3. Calculate Euler's Totient: Compute Euler's totient function, φ(n) = (p - 1) * (q - 1).

4. Select a Public Exponent: Choose a public exponent, e, that is relatively prime to φ(n) and
less than φ(n). This value is made public.

5. Calculate the Private Exponent: Find the private exponent, d, such that (e * d) mod φ(n) =
1. This value is kept secret.

Encryption:

1. Convert the Message: Convert the plaintext message into an integer, m.

2. Encrypt the Message: Using the public key (e, n), calculate the ciphertext, c, using the
formula: c = m^e mod n.

3. Send the Encrypted Message: The encrypted message, c, is sent to the recipient.

Decryption:

1. Receive the Encrypted Message: The recipient receives the encrypted message, c.

2. Decrypt the Message: Using the private key (d, n), calculate the plaintext message, m,
using the formula: m = c^d mod n.

Example:

Let's take an example to illustrate the RSA algorithm:

Choose two large prime numbers: p = 7 and q = 11.


Calculate the modulus: n = p * q = 77.
Calculate Euler's totient: φ(n) = (p - 1) * (q - 1) = 60.
Select a public exponent: e = 17.
Calculate the private exponent: d = 43.

Encryption:

Convert the message "Hello" into an integer, m = 72.


Encrypt the message: c = m^e mod n = 72^17 mod 77 = 54.

Decryption:

Decrypt the message: m = c^d mod n = 54^43 mod 77 = 72.

The decrypted message, m, is "Hello," which is the original plaintext.


The RSA algorithm allows secure data transmission by enabling the sender and recipient to use a
public key for encryption and a private key for decryption, ensuring the confidentiality of the
communication.

Q3. Differentiate between AES and DES algorithms.

Ans.

1. Block Cipher vs. Stream Cipher:

DES: DES is a block cipher, which means it operates on fixed-sized blocks of data,
typically 64 bits in the case of DES. It encrypts each block independently of other
blocks.
AES: AES is also a block cipher, but it operates on 128-bit blocks and has a variable
key length of 128, 192, or 256 bits.

2. Key Size:

DES: DES uses a 56-bit key, which is relatively small by today's standards. This makes
it vulnerable to brute-force attacks, where an attacker tries all possible key
combinations until they find the correct one.
AES: AES uses a key length of 128, 192, or 256 bits, which provides significantly
better security against brute-force attacks.

3. Rounds:

DES: DES performs 16 rounds of encryption, where each round consists of a series of
operations that transform the data block.
AES: AES performs 10, 12, or 14 rounds of encryption, depending on the key length.
Each round consists of four different operations: SubBytes, ShiftRows, MixColumns,
and AddRoundKey.

4. Diffusion and Confusion:

DES: DES uses a Feistel structure, which alternates between diffusion and confusion
operations. Diffusion spreads the bits of the plaintext across the entire ciphertext
block, while confusion makes it difficult to determine the relationship between the
plaintext and ciphertext.
AES: AES also uses diffusion and confusion operations, but it employs a different
approach called the Rijndael mix. This mix combines diffusion and confusion in a single
operation, resulting in a more secure cipher.

5. Security:

DES: DES has been extensively studied and analyzed by cryptographers, and it is
known to have some weaknesses, such as its relatively short key length and
susceptibility to certain types of attacks.
AES: AES is considered to be a very secure cipher, and it has been widely adopted as
the standard for symmetric encryption in various applications.

By Assignment Buddy

You might also like