You are on page 1of 12

CRY303c

PE (Thực hành):

- Sinh viên tắt hết các ứng dụng đang chạy (mở)-trước khi thi, chỉ sử dụng
phần mềm thi do nhà trường

cung cấp và các tài liệu được phép sử dụng trong quá trình thi.

- Sinh viên thi trên phần mềm PEA: xem đề trên máy, làm bài trên file Word,
sau đó cho file word vào

folder và nộp bài vào PEA. Nếu đề bài yêu cầu đặt tên folder thì đặt tên đề
bài, còn không yêu cầu đặt

tên folder thì sinh viên đặt theo hướng dẫn: MSSV+Mã môn+PE+papers no -
Ví dụ:

HE140001_CRY303c_PE_01

- Sinh viên được sử dụng máy tính bỏ túi, nháp trắng.

- Không được dùng tài liệu trên máy.

- Không được sử dụng Internet để search thông tin và trao đổi với bài với
người khác.

Lưu ý: Trình bày bài thi trên word theo một số quy chuẩn sau:

a. Chấp nhận bài thi trình bày luỹ thừa theo cách đơn giản ví dụ 2^2 hoặc sử
dụng tổ hợp phím Ctrl + Shift +

= để trình bày dưới dạng 2

2
b. Euler totient function bình được viết dưới dạng φ(n) hoặc φ(n) chấp nhận
viết dưới dạng totient(n) =

c. Ký hiệu đồng dư a b ( mod n ) chấp nhận cả kiểu viết đơn giản là a = b


( mod n )

Ngoài ra sinh viên chủ động thêm các dấu đặc biệt theo một số trường hợp ví
dụ như khai căn.

Q1(1 point). What is the prime factorization for 31293570?

Q1: The prime factorization of 31293570 is 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19.

Q2(1 point). You agreed to use a Caesar cipher with a key of k-4 with a friend.
While sitting in a group, the friend hands you over a message that says
"AIHRIWHEC". Decrypt the message?

Original Alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Decrypted Message: E F G H I J K L M N O P Q R S T U V W X Y Z A B C D

Q2: Decrypting the message "AIHRIWHEC" using a Caesar cipher with a key of k-4 results
in the message "WEATHERING."

Q3(1 point). Suppose you actually forgot the key. How many decryption
computations of the cipher text "IXEVZU" do you need to perform to reach to the
plaintext?

Q3: If you forgot the key for the Caesar cipher and you need to perform decryption
computations for the ciphertext "IXEVZU," you would need to try all possible keys, which
are 26 in total (assuming a standard English alphabet). So, you would need to perform 26
decryption computations.

Q4(1 point). Using the Permutation Cipher with the same key [3 5 1 2 4], what is
the ciphertext for the plaintext GOODTHINGSTAKETIME? (Leave the unfilled
matrix as blank).

Q4: Using the Permutation Cipher with the key [3 5 1 2 4] for the plaintext
"GOODTHINGSTAKETIME," the ciphertext is "ODGHNOITGTEAISMKE."

Q5(1 point). Euler totient function of n (we use the Greek symbol phi to denote
Euler totient function) is the number of positive integers that are between I and n-1,
inclusive, and are relatively prime to n. What is the Euler totient function of

Q5: The Euler totient function of 72 is calculated as follows: phi(72) = 72 * (1 - 1/2) * (1 -


1/3) * (1 - 1/8) = 72 * 1/2 * 2/3 * 7/8 = 24.

72?

Q6(1 point). Using the same notations as in the lecture, e.g., p and q are the two
primes and e and d are the public key and the private key, respectively, p = 7, q 13,
e 7. What is the value of phi(n) where phi(n) is the Euler Totient function of n and
n is the modulus of RSA cipher?

Q6: For RSA, phi(n) is calculated as phi(n) = (p-1) * (q-1). Given p = 7 and q = 13, phi(n) =
(7-1) * (13-1) = 6 * 12 = 72.

Q7(1 point). Using the same notations as in the lecture, e.g., p and q are the two
primes and e and d are the public key and the private key, respectively, p = 7, q 13,
e 7. Using the phi(n) that you found in the question 6 and the Extended Euclidean
algorithm yields d = 31. What is the ciphertext C when encrypting M =19?
Q7: With the values p = 7, q = 13, e = 7, phi(n) = 72, and d = 31, the RSA encryption is

calculated as follows: �≡��(mod�)C≡Me(modn) where �M is the plaintext (19

in this case). So, �≡197(mod91)C≡197(mod91). The result is

�≡37(mod91)C≡37(mod91). Therefore, the ciphertext �C is 37.

Q8(1 point). Using the same notations as in the lecture, e.g., p and q are the two
primes and e and d are the public key and the private key, respectively, p = 7, q 13
and e 7. The attacker performs a chosen-ciphertext attack (CCA). It has a known
ciphertext 18 and wants to retrieve the corresponding plaintext. It computes c'
c*r^e mod n and chooses the ciphertext 18*128 mod 91-29 and retrieves the
corresponding plaintext, 29. What is the plaintext corresponding to the ciphertext
18?

Q8: In a chosen-ciphertext attack (CCA) scenario, the attacker computes �


′≡�⋅��(mod�)c′≡c⋅re(modn), where �c is the known ciphertext, �r is a random
value, �e is the public key exponent, and �n is the modulus. The attacker then chooses
a new ciphertext �′c′ and retrieves the corresponding plaintext. Given that �=18c=18,
�=128r=128, and �=91n=91, the attacker computes �′≡18⋅1287(mod91)c
′≡18⋅1287(mod91). The result is �′≡18⋅6(mod91)c′≡18⋅6(mod91), which is �
′≡108(mod91)c′≡108(mod91). Therefore, the plaintext corresponding to the ciphertext
18 is 108.

Q9(1 point). Alice and Bob use Diffie-Hellman Key Exchange to share a key with
a common prime p= 13 and a primitive root a-2. If Alice has a public key Y_A-9,
what is her private key X_A?

Q9: In the Diffie-Hellman Key Exchange, if Alice has a public key ��YA and the

common prime �=13p=13 with a primitive root �=2a=2, the private key ��XA is
computed as ��≡���(mod�)XA≡aXA(modp). Given that ��=9YA=9, we

need to find ��XA. Solving for ��XA, 2��≡9(mod13)2XA≡9(mod13), we find

that ��=8XA=8 because 28≡9(mod13)28≡9(mod13).

Q10(1 point). There are 8 computers (hardware). Each computer hosts 4 virtual
machines (VM) with different addresses, and each VM hosts 10 applications. How
many key exchange sessions (in one session, two logical parties share a key) are
needed if the decentralized key distribution is used so that all applications share a
pair-wise keys?
Q10: If there are 8 computers, each hosting 4 virtual machines (VM), and each VM hosting

10 applications, the total number of applications is 8×4×10=3208×4×10=320. In


decentralized key distribution for pairwise keys, each application needs to establish a key
with every other application. Therefore, the number of key exchange sessions needed is

given by the combination formula: �(�,2)C(n,2), where �n is the total number of

applications. So, in this case, �(320,2)=320×3192=51,040C(320,2)=2320×319


=51,040. Therefore, 51,040 key exchange sessions are needed.

Q1(1 point). Given that totient(377) is 336, what is 69^673 (mod 377)?

Q2(1 point). You agreed to use a Caesar cipher with a key of k-7 with a friend. While sitting in a
group, the friend hands you over a message that says "AOBYKHF". Decrypt the message?

Original Alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Decrypted Message: E F G H I J K L M N O P Q R S T U V W X Y Z A B C D

Q3(1 point). Suppose you actually forgot the key. How many decryption computations of the
cipher text "QNGWFWD" do you need to perform to reach to the plaintext?

Q4(1 point). Using the Permutation Cipher with the same key [4 2 1 3], what is the ciphertext for
the plaintext SEEYOUATTHELIBRARY? (Leave the unfilled matrix as blank).

Q5(1 point). Euler totient function of n (we use the Greek symbol phi to denote Euler totient
function) is the number of positive integers that are between 1 and n-1, inclusive, and are
relatively prime to n. What is the Euler totient function of 108?
Q6(1 point). Using the same notations as in the lecture, e.g., p and q are the two

primes and e and d are the public key and the private key, respectively, p = 5, q

= 13, e 5. What is the value of phi(n) where phi(n) is the Euler Totient

function of n and n is the modulus of RSA cipher?

Q7(1 point). Using the same notations as in the lecture, e.g., p and q are the two primes and e and
d are the public key and the private key, respectively, p = 5, q 13, e 5. Using the phi(n) that you
found in the question 6 and the Extended Euclidean algorithm yields d = 29. What is the
ciphertext C when encrypting M =17?

Q8(1 point). Using the same notations as in the lecture, e.g., p and q are the two primes and e and
d are the public key and the private key, respectively, p = 5, q = 13 and e 5. The attacker
performs a chosen-ciphertext attack (CCA). It has a known ciphertext 19 and wants to retrieve
the corresponding plaintext. It computes c' c*r^e mod n and chooses the ciphertext 19*243 mod
65 = 2 and retrieves the corresponding plaintext, 32. What is the plaintext corresponding to the
ciphertext 19?

Q9(1 point). Alice and Bob uses Diffie-Hellman Key Exchange to share a key with a common
prime p= 13 and a primitive root a-2. If Alice has a public key Y_A-3, what is her private key
X_A?
Q10(1 point). There are 8 computers (hardware). Each computer hosts 4 virtual machines (VM)
with different addresses, and each VM hosts 10 applications. How many key exchange sessions
(in one session, two logical parties share a key) are needed if the decentralized key distribution is
used so that all applications share a pair-wise keys?

As:

Q1: Given \(\phi(377) = 336\), to find \(69^{673} \mod 377\), you can use Euler's theorem which
states that \(a^{\phi(n)} \equiv 1 \mod n\) for \(a\) and \(n\) coprime. Since \(673 \equiv 1 \mod
336\), \(69^{673} \equiv 69^{1} \mod 377\), hence \(69^{673} \mod 377 = 69\).

Q2: Decrypting "AOBYKHF" with a Caesar cipher key of \(k=-7\), you get "THUNDER".

Q3: If you forgot the key for the Caesar cipher, you would need to perform 26 decryption
computations to cover all possible shifts of the alphabet to find the plaintext from
"QNGWFWD".

Q4: For the plaintext "SEEYOUATTHELIBRARY" using the permutation cipher key [4 2 1 3],
the ciphertext is "EYOSUETATHLEIBRY__". The last part of the plaintext doesn't fill the matrix
completely, leaving blanks.

Q5: The Euler totient function of 108 is calculated by finding the prime factorization of 108,
which is \(2^2 \times 3^3\). Thus, \(\phi(108) = 108 \times (1 - \frac{1}{2}) \times (1 - \frac{1}
{3}) = 108 \times \frac{1}{2} \times \frac{2}{3} = 36\).

Q6: For \(p = 5\) and \(q = 13\), \(\phi(n) = (p-1) \times (q-1) = 4 \times 12 = 48\).

Q7: Given \(n = p \times q = 5 \times 13 = 65\), \(e = 5\), \(\phi(n) = 48\), and \(d = 29\), to
encrypt \(M = 17\), you compute \(C \equiv M^e \mod n\). Thus, \(C = 17^5 \mod 65\). Using a
calculator, \(17^5 = 1419857\), and \(1419857 \mod 65 = 62\). Therefore, the ciphertext \(C\) is
62.

Q8: To reverse the encryption and find the plaintext corresponding to ciphertext 19, knowing the
decryption process involves the private key \(d\) and \(n\), and given that the attacker uses a
method to simplify this process but the correct process to find the plaintext \(P\) from ciphertext \
(C\) is \(P \equiv C^d \mod n\). However, the question provides incorrect details for a
straightforward answer. Typically, the decryption would use the private key, which isn't directly
provided here. The information given leads to a misunderstanding; normally, you'd decrypt
using \(P \equiv C^d \mod n\). For the chosen-ciphertext attack scenario described, it's not
standard RSA decryption but part of the attack process, which doesn't directly correlate to
traditional decryption steps. Given the mismatch in details, it's important to clarify that finding
the plaintext from the provided steps isn't straightforward without specifying the decryption
process or the private key used.

Q9: Given \(p = 13\), \(a = 2\), and \(Y_A = 3\), to find Alice's private key \(X_A\), we solve \
(2^{X_A} \equiv 3 \mod 13\). Through trial and error or using discrete logarithms, \(X_A = 11\)
since \(2^{11} \mod 13 = 3\).

Q10: With 8 computers each hosting 4 VMs, and each VM hosting 10 applications, there are \(8 \
times 4 \times 10 = 320\) applications in total. For pairwise key exchanges, the formula is \(C(n,
2) = \frac{n(n-1)}{2}\), so \(C(320, 2) = \frac{320 \times 319}{2} = 51,040\) key exchange
sessions are needed for all applications to share pairwise keys.

3
Q2(1 point). You agreed to use a Caesar cipher with a key of k-6 with a friend. While sitting in a
group, the friend hands you over a message that says "NZQLIG". Decrypt the message?

Q3(1 point). Suppose you actually forgot the key. How many decryption computations of the
cipher text "ZBAQNL" do you need to perform to reach to the plaintext?

Q4(1 point). Using the Permutation Cipher with the same key [351 2 4], what is the plaintext for
the ciphertext ONKEDGEXGHTITSTXOIAM? (The unfilled matrix is filled with letter 'X',
remove it to get the final answer).
Q5(1 point). Euler totient function of n (we use the Greek symbol phi to denote Euler totient
function) is the number of positive integers that are between 1 and n-1, inclusive, and are
relatively prime to n. What is the Euler totient function of 135?

Q6(1 point). Using the same notations as in the lecture, e.g., p and q are the two primes and e and
d are the public key and the private key, respectively, p = 5, q = 17, e =7. What is the value of
phi(n) where phi(n) is the Euler Totient function of n and n is the modulus of RSA cipher?

Q7(1 point). Using the same notations as in the lecture, e.g., p and q are the two primes and e and
d are the public key and the private key, respectively, p = 5, q = 17, e 7. Using the phi(n) that you
found in the question 6 and the Extended Euclidean algorithm yields d = 55. What is the
ciphertext C when encrypting M 3?

Q8(1 point). Using the same notations as in the lecture, e.g., p and q are the two primes and e and
d are the public key and the private key, respectively, p = 5, q = 17 and e =7. The attacker
performs a chosen-ciphertext attack (CCA). It has a known ciphertext 23 and wants to retrieve
the corresponding plaintext. It computes c' = c*r^e mod n and chooses the ciphertext 23*128
mod 85 54 and retrieves the corresponding plaintext, 79. What is the plaintext corresponding to
the ciphertext 23?

Q9(1 point). Alice and Bob use Diffie-Hellman Key Exchange to share a key with a common
prime p = 17 and a primitive root a-3. If Alice has a public key Y_A-11, what is her private key
X_A?

Q10(1 point). There are 7 computers (hardware). Each computer hosts 3 virtual machines (VM)
with different addresses, and each VM hosts 6 applications. How many key exchange sessions
(in one session, two logical parties share a key) are needed if the decentralized key distribution is
used so that all VM's share a pair- wise keys?

As:

Q2: Decrypting "NZQLIG" with a key of \(k-6\), you get "HAPPYB." Therefore, the decrypted
message is "HAPPYB."

Q3: If you forgot the key for the Caesar cipher and need to perform decryption computations for
the ciphertext "ZBAQNL," you would need to try all possible keys, which are 26 in total
(assuming a standard English alphabet). So, you would need to perform 26 decryption
computations.

Q4: Using the Permutation Cipher with the key [3 5 1 2 4], the plaintext for the given ciphertext
"ONKEDGEXGHTITSTXOIAM" is "TOKYOTOWERISAMAZINGXXXXX."

Q5: The Euler totient function of 135 is calculated by finding the prime factorization of 135,
which is \(3^3 \times 5\). Thus, \(\phi(135) = 135 \times \left(1 - \frac{1}{3}\right) \times \left(1
- \frac{1}{5}\right) = 54\).

Q6: For \(p = 5\) and \(q = 17\), \(\phi(n) = (p-1) \times (q-1) = 4 \times 16 = 64\).

Q7: Given \(n = p \times q = 5 \times 17 = 85\), \(e = 7\), \(\phi(n) = 64\), and \(d = 55\), to
encrypt \(M = 3\), you compute \(C \equiv M^e \mod n\). Thus, \(C = 3^7 \mod 85\). Using a
calculator, \(3^7 = 2187\), and \(2187 \mod 85 = 67\). Therefore, the ciphertext \(C\) is 67.
Q8: To reverse the encryption and find the plaintext corresponding to ciphertext 23, knowing the
decryption process involves the private key \(d\) and \(n\), and given that the attacker uses a
method to simplify this process, the correct process to find the plaintext \(P\) from ciphertext \
(C\) is \(P \equiv C^d \mod n\). However, the question provides incorrect details for a
straightforward answer. Typically, the decryption would use the private key, which isn't directly
provided here. The information given leads to a misunderstanding; normally, you'd decrypt
using \(P \equiv C^d \mod n\). For the chosen-ciphertext attack scenario described, it's not
standard RSA decryption but part of the attack process, which doesn't directly correlate to
traditional decryption steps. Given the mismatch in details, it's important to clarify that finding
the plaintext from the provided steps isn't straightforward without specifying the decryption
process or the private key used.

Q9: Given \(p = 17\), \(a = 3\), and \(Y_A = 11\), to find Alice's private key \(X_A\), we solve \
(3^{X_A} \equiv 11 \mod 17\). Through trial and error or using discrete logarithms, \(X_A = 15\)
since \(3^{15} \mod 17 = 11\).

Q10: With 7 computers each hosting 3 VMs, and each VM hosting 6 applications, there are \(7 \
times 3 \times 6 = 126\) applications in total. For pairwise key exchanges, the formula is \(C(n,
2) = \frac{n(n-1)}{2}\), so \(C(126, 2) = \frac{126 \times 125}{2} = 7875\) key exchange
sessions are needed for all VMs to share pairwise keys.

You might also like