CryptoCompre2022-key
CryptoCompre2022-key
Hyderabad Campus
nd
2 Semester 2021-2022
Cryptography (BITS F463) – Comprehensive Examination (Regular) - key
Now enciphering the plaintext, first we need to split the plaintext as digrams.
CO ME TO TH EW IN DO WQ
Now applying the Playfair cipher rules we get the ciphertext as:
LC NK ZK VF YO GQ CE BX
(b) Given the message to be encrypted as “Attack is tonight”. The key matrix is given as follows:
Since, the key matrix is a 3 x 3 matrix, the letters will be encrypted in groups of 3. Accordingly, the plaintext
can be written as ATT ACK IST ONI GHT
The corresponding plaintext matrix is
A T T = 0 19 19
A C K 0 2 10
I S T 8 18 19
O N I 14 13 8
G H T 6 7 19
Now, ciphertext = [plaintext x key] mod 26
Thus the ciphertext equivalent of the plaintext letters ATT will be FNW
Q2. (a) (i)
Let the outcome of PC-1 be K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111
0001111. Given the number of left shifts for round 1 as 1
To find C1D1:
From the permuted key K+, we can get C0D0 as follows.
C0 = 1111000 0110011 0010101 0101111
D0 = 0101010 1011001 1001111 0001111
Since it is round 1, the number of shifts is 1. Hence we can get C 1D1 by left circular shift by 1 position of
C0D0. So,
C0 = 1111000011001100101010101111
D0 = 0101010101100110011110001111
C1 = 1110000110011001010101011111
D1 = 1010101011001100111100011110
Thus, C1D1 = 1110000110011001010101011111 1010101011001100111100011110
(ii) To L1R1 from the information given below.
L0 = 1100 1100 0000 0000 1100 1100 1111 1111
R0 = 1111 0000 1010 1010 1111 0000 1010 1010
K1 = 000110 110000 001011 101111 111111 000111 000001 110010
L1 = R0 = 1111 0000 1010 1010 1111 0000 1010 1010
R1 = L0 + f(R0,K1)
Outcome of round function for round 1 is 0010 0011 0100 1010 1010 1001 1011 1011
This means that f = f = 0010 0011 0100 1010 1010 1001 1011 1011
Thus
R1 = L0 + f(R0 , K1 )
= 1100 1100 0000 0000 1100 1100 1111 1111
+ 0010 0011 0100 1010 1010 1001 1011 1011
= 1110 1111 0100 1010 0110 0101 0100 0100
Thus, L1 R1 = 1111 0000 1010 1010 1111 0000 1010 1010 1110 1111 0100 1010 0110 0101 0100 0100
(b) (i) Given the output from the shift rows operation,
D4 E0 B8 1E
BF B4 41 27
5D 52 11 98
30 AE F1 E5
the input to the shift rows operation can be found as:
D4 E0 B8 1E
27 BF B4 41
11 98 5D 52
AE 11 E5 30
We need to prove that the ElGamal cryptosystem is secure enough for sufficiently large prime modulus:
Finding a is a discrete logarithm problem. There is no known method for solving a discrete log problem
with a large prime modulus that is sufficiently efficient to be practical for application to cryptanalysis.
Hence the ElGamal cryptosystem is thought to be secure for sufficiently large prime modulus. Here, the
modulus is 257 and hence an attacker can use trial and error method to solve the congruence 3a ≡ 112 (mod
257) and arrive at a value a = 21. Once the attacker knows a, he can find the plaintext message. However,
for large prime modulus solving for a is a hard problem.
Q4. (a)
(b) (p,q,g) are globally available. The condition (gk mod p)mod q ≠ 0 is checked; given private key is x and
the public key is gx mod p.
To show how the hash code h; 0 < h < q; can be recovered from the signature (r; s) using public information
only, including the public key:-
The hash code h can be recovered from the signature (r; s) given the public key (gx mod p) by calculating
h = r(gk (mod p)) -1 (mod q)
= r(gs+xr (mod p))-1 (mod q)
= r(gs(gx)r (mod p)) -1 (mod q)
(c) Given n to be a large integer. Let H(m) = m(mod n) be an integer between 0 and n-1.
(b)
(i) solutions for ax ≡ b (mod m)
The solutions for the above congruence depends on the greatest common divisor of a and m.
Let g = gcd(a, m). If b is not divisible by g, there are no solutions. If b is divisible by g, there
are g solutions.
(ii)
If a and m are relatively prime, g = gcd(a, m) = 1. Put the congruence ax ≡ b (mod m) in a standard
form; assume a > 0. If not, replace ax ≡ b (mod m) with –ax ≡ –b (mod m); assume a < m. If not,
subtract multiples of m from a until a < m; now solve my ≡ –b (mod a).
if the numbers a and m are not relatively prime, first solve the congruence (a/g)y ≡ (b/g) (mod
(m/g)) using the above procedure; the solutions to ax ≡ b (mod m) are x = y + tm/g where t = 0, 1,
2, …, g-1.
(b)
If m1, m2, .., mk are pairwise relatively prime positive integers, and if a1, a2, .., ak are any integers,
then the simultaneous congruences x ≡ a1 mod(m1), x ≡ a2 mod(m2), ……..., x ≡ ak mod(mk),
have a solution, and the solution is unique modulo m, where m = m1, m2, …. mk
Q7. (a) You are asked to apply rail fence cipher decryption (depth = 3) to retrieve the plaintext message
from the ciphertext DNETLEEDHESWLXFTAAX.
Since there are 19 letters in the ciphertext and since the depth is given as 3, first, we need to construct the
rail fence with 3 rows and 19 columns. Then we need to fill in the letters in a horizontal fashion. Next the
letters are read out in a diagonal fashion to retrieve the plaintext as follows.
(b) Given that the ciphertext CSASXTITUKSWTGQU GWYQVRKWAQJB is generated by applying the
Vigenere cipher using a keyword ABCDEF.