Cryptography_Network_Security_Assignment
Cryptography_Network_Security_Assignment
Assignment 01
Name : Vikas Kushwaha
Roll No : 2021BCS0021
1. Calculate n:
n = p × q = 61 × 53 = 3233
2. Calculate φ(n):
φ(n) = (p - 1) × (q - 1) = 60 × 52 = 3120
3. Encryption:
The public key is (e, n) = (17, 3233). The message M = 65 is encrypted using the formula:
C = M^e mod n = 65^17 mod 3233
Calculating 65^17 mod 3233 gives:
C = 2790
4. Decryption:
Find the private key d, which is the modular inverse of e mod φ(n). Using the Extended
Euclidean Algorithm:
e × d ≡ 1 mod φ(n)
17 × d ≡ 1 mod 3120
We get d = 2753.
The ciphertext C = 2790 is decrypted using:
M = C^d mod n = 2790^2753 mod 3233
Calculating this gives:
M = 65
Therefore, the encrypted message is 2790, and the decrypted message is 65.
2. In RSA encryption, participant A uses two prime numbers p = 13 and q = 17.
Public key of A = 35. Find the private key.
Solution:
1. Calculate n:
n = p × q = 13 × 17 = 221
2. Calculate φ(n):
φ(n) = (p - 1) × (q - 1) = 12 × 16 = 192
3. Given Public Key e = 35, find the private key d such that:
e × d ≡ 1 mod φ(n)
35 × d ≡ 1 mod 192
Using the Extended Euclidean Algorithm, we find:
d = 11
3. Suppose two parties A & B wish to set up a common key between themselves
using Diffie-Hellman Key exchange technique. They agree on 7 as modulus and
3 as primitive root. Party A chooses 2 and B chooses 5 as their respective
private keys. Find the D-H key they exchanged.
Solution:
5. Consider an elliptic curve defined over a field modulo 17, given by the
equation y² = x³ + 2x + 2. If the points P = (5,1) and Q = (6,3) are on the curve,
find P + Q.
Solution:
1. Calculate Slope m:
m = (y2 - y1) / (x2 - x1) mod 17 = (3 - 1) / (6 - 5) mod 17 = 2 / 1 = 2