Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
32 views6 pages

Cryptography Assignment Solution

The document contains solutions to various cryptography problems, including calculations of Euler's Totient function, modular inverses, and solving congruences. It also discusses the Extended Euclidean Algorithm and the Chinese Remainder Theorem, providing detailed steps and results for each problem. The solutions cover a range of topics relevant to number theory and cryptographic applications.

Uploaded by

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

Cryptography Assignment Solution

The document contains solutions to various cryptography problems, including calculations of Euler's Totient function, modular inverses, and solving congruences. It also discusses the Extended Euclidean Algorithm and the Chinese Remainder Theorem, providing detailed steps and results for each problem. The solutions cover a range of topics relevant to number theory and cryptographic applications.

Uploaded by

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

Cryptography

Assignment 2 Solutions:
Question 1: Euler's Totient Function
For N = 17:
17 is prime, so all integers from 1 to 16 are coprime with 17.
ϕ(17) = 16
For N = 42:
Prime factors: 2, 3, 7
ϕ(42) = 42 × (1-1/2) × (1-1/3) × (1-1/7) = 12
Coprime integers: 1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41
For N = 25:
Prime factor: 5
ϕ(25) = 25 × (1-1/5) = 20
Coprime integers: all numbers from 1 to 24 not divisible by 5

Question 2: Inverses and Euler Totient


a) Inverses in Z₁₀₀:
Additive inverse of 27: 73 (since 27 + 73 = 100 ≡ 0 mod 100)
Multiplicative inverse of 27: 63 (since 27 × 63 = 1701 ≡ 1 mod 100)
b) Euler totient:
ϕ(101) = 100 (101 is prime)
ϕ(102) = 102 × (1-1/2) × (1-1/3) × (1-1/17) = 32
ϕ(500) = 500 × (1-1/2) × (1-1/5) = 200

Question 3: Modular Inverses in Z₉*


Z₉* = {1, 2, 4, 5, 7, 8}
Using Euler's theorem (a^ϕ(n) ≡ 1 mod n ⇒ a^{-1} ≡ a^{ϕ(n)-1} mod n):

ϕ(9) = 6
1⁻¹ ≡ 1 mod 9
2⁻¹ ≡ 2⁵ ≡ 5 mod 9

4⁻¹ ≡ 4⁵ ≡ 7 mod 9

5⁻¹ ≡ 5⁵ ≡ 2 mod 9

7⁻¹ ≡ 7⁵ ≡ 4 mod 9

8⁻¹ ≡ 8⁵ ≡ 8 mod 9

Question 4: Modular Inverses


a) 6⁻¹ mod 7:

Since 7 is prime, 6⁻¹ ≡ 6^{7-2} ≡ 6⁵ ≡ 6 mod 7

b) 7⁻¹ mod 15:

gcd(7,15)=1, using Extended Euclidean:


15 = 2×7 + 1 ⇒ 1 = 15 - 2×7 ⇒ 7⁻¹ ≡ -2 ≡ 13 mod 15

c) 19⁻¹ mod 101:

Using Extended Euclidean:


101 = 5×19 + 6
19 = 3×6 + 1 ⇒ 1 = 19 - 3×6 = 19 - 3×(101-5×19) = 16×19 - 3×101

⇒ 19⁻¹ ≡ 16 mod 101

d) 97⁻¹ mod 100:

97 ≡ -3 mod 100
Need x such that -3x ≡ 1 mod 100 ⇒ 3x ≡ 99 mod 100 ⇒ x ≡ 33 mod 100

Question 5: Solving Congruences


a) x ≡ 4¹⁰⁰ mod 7:
ϕ(7)=6, 4⁶ ≡ 1 mod 7
4¹⁰⁰ = 4^{6×16+4} ≡ 4⁴ ≡ 4 mod 7
b) 9ˣ ≡ 13 mod 17:
Brute force: x=4 (9⁴=6561≡13 mod17)
c) 5ˣ ≡ 13 mod 17:
Brute force: x=7 (5⁷=78125≡13 mod17)
d) 7ˣ ≡ 11 mod 13:
Brute force: x=8 (7⁸=5764801≡11 mod13)
Question 6: GF(2⁴) Computations
a) Inverses:
x⁻¹ = x¹⁴ (since x¹⁵=1 in GF(2⁴))

= x² + x³
x⁻³ = (x⁻¹)³ = (x²+x³)³ = x + x² + x³

b) x²/(x³ + x² + 1):
First find inverse of (x³ + x² + 1) = x
Then x² × x = x³
c) (x³ + x² + x)/(x² + x + 1):
Polynomial division gives x + (x)/(x²+x+1)
Final result: x + 1

Question 7: Euclidean Algorithm


a) GCD(726,1144):
1144 = 1×726 + 418
726 = 1×418 + 308
418 = 1×308 + 110
308 = 2×110 + 88
110 = 1×88 + 22
88 = 4×22 + 0 ⇒ GCD=22

b) GCD(2184,16170):
16170 = 7×2184 + 882
2184 = 2×882 + 420
882 = 2×420 + 42
420 = 10×42 + 0 ⇒ GCD=42

c) GCD(113,13):
113 = 8×13 + 9
13 = 1×9 + 4
9 = 2×4 + 1
4 = 4×1 + 0 ⇒ GCD=1

Question 8: Extended Euclidean Algorithm


For GCD(654,123):
654 = 5×123 + 39
123 = 3×39 + 6
39 = 6×6 + 3
6 = 2×3 + 0 ⇒ GCD=3

Now back-substitute:
3 = 39 - 6×6
= 39 - 6×(123-3×39) = 19×39 - 6×123
= 19×(654-5×123) - 6×123 = 19×654 - 101×123
Thus u=19, v=-101

Question 9: Multiplicative Inverses


a) 13⁻¹ mod 31:

Using Extended Euclidean:


31 = 2×13 + 5
13 = 2×5 + 3
5 = 1×3 + 2
3 = 1×2 + 1
Now back-substitute:
1 = 3 - 1×2
= 3 - 1×(5-1×3) = 2×3 - 1×5
= 2×(13-2×5) - 1×5 = 2×13 - 5×5
= 2×13 - 5×(31-2×13) = 12×13 - 5×31
Thus 13⁻¹ ≡ 12 mod 31

b) 111⁻¹ mod 4111:


Using Extended Euclidean (lengthy process):
Final result: 111⁻¹ ≡ 2965 mod 4111

Question 10: Quadratic Residues


a) y² ≡ 3 mod 143:
143=11×13
Solve y²≡3 mod11 ⇒ y≡5,6 mod11

Solve y²≡3 mod13 ⇒ y≡4,9 mod13

Combine using CRT:


Four solutions: y≡48,82,61,95 mod143

b) y² ≡ 421 mod 693:


693=7×9×11
Solve y²≡421≡1 mod7 ⇒ y≡1,6 mod7

Solve y²≡421≡7 mod9 ⇒ no solution

Thus no solutions exist.

Question 11: Chinese Remainder Theorem


Solve:
x ≡ 3 mod5
x ≡ 1 mod7
x ≡ 6 mod8
First solve x≡3 mod5 and x≡1 mod7:
x=5k+3 ≡1 mod7 ⇒5k≡-2≡5 mod7 ⇒k≡1 mod7 ⇒k=7m+1

Thus x=5(7m+1)+3=35m+8
Now combine with x≡6 mod8:
35m+8≡6 mod8 ⇒3m≡-2≡6 mod8 ⇒m≡2 mod8 ⇒m=8n+2

Thus x=35(8n+2)+8=280n+78
Final solution: x≡78 mod 280
-Harshit

You might also like