# Cryptography Problems

Document Sample

```					RSA Problem Solution: 1. Select p and q, where p and q are prime numbers let p = 3, q = 11 2. Calculate n, n= p*q n=3*11=33 3. Claculate phi(n)=(p-1)(q-1) phi(n)=2*10=20 4. Select e, where 1<e<phi(n), i.e., e should be between 1 and phi(n), e can be any integer let e=3 (i.e., 3 is between 1 and 20) 5. Calculate d, d=e power -1 mod phi(n) i.e., ed = 1 mod phi(n) i.e., ed mod phi(n) = 1 mod phi(n) 1 mod phi(n) = 1 therefore ed mod phi(n) = 1 in our eg., e=3, d=? phi(n)=20 there fore ed mod phi(n)=1, i.e. 3d mod 20 = 1, there fore d=7, i.e., 3*7 mod 20 = 1 i.e. 21 mod 20 = 1 so d=7 6. Public Key,KU = {e,n} i.e., KU = {3,33} 7. Private Key, KR = {d,n} i.e., KR = {7,33} 8. Encryption Select Plain Text, M<n in our eg., n=33, therefore, let M=3, which is < 33 for encryption, C=M power e mod n in our eg., M=3, e=3, n=33 therefore 3 power 3 mod 33 = 27 mod 33 = 27 Therefore C = 27. 9. Decryption M = C power d mod n i.e, M = 27 power 7 mod 33 = ((27 power 2 mod 33) * (27 power 2 mod 33) * (27 power 2 mod 33) * (27 mod 33)) mod 33 =(3*3*3*27) mod 33 = 3 Therefore M = 3 ------------------------------------------------------------------------------------------------------Elliptic Curve Cryptography (ECC) Problem and Solution: 1. Users Select a suitable Curve Ep(a,b) eg. a=1 b=1, therefore, Ep(1,1)

2. Select base point G=(X1,Y1) with large order n show that nG=0. let n = 20, X1=0, Y1=4 base point, G=(0,4), G=1 3. A & B select private keys nA < n, and nB < n. eg. nA=5 < 20 nB=2 < 20 4. Compute public keys: User A pA=nA*G pA=5*1 pA=5 User B pB=nB*G pB=2*1 pB=2 5. Compute shared key: User A k=nA*pB k=5*2 k=10 User B k=nB*pA k=2*5 k=10 ---------------------------------------------------------------------------------------------------------Diffie - Hellman Problem and Solution: 1. Select p, where p is prime number eg. p=7 2. find a, where a is the primitive root for p. How to find the primitive root... 2,3 and 5 are the prime numbers which are < than 7. so any of the three numbers from 2,3,5 'll be the primitive root for 7. if p is then a power . . p-1} in eg., if 3 is then 3 power 3 power 3 power 3 power 3 power a prime number... then a is the primitive root of p 1 mod p, a power 2 mod p . . . . some order... a primitive root of 7, 1 2 3 4 5 mod mod mod mod mod 7 7 7 7 7 = = = = = 3 2 6 4 5 a power p-1 mod p = {1,2,.

3 power 6 mod 7 = 1 there fore 3 is a primitive root of 7, similarly 5 also primitive root of 7, but 2 is not primitive root of 7... so 3, and 5 are primitive root of 7. so let choose a = 3, which the primitive root of p = 7 3. User A User A select a Private Key, Xa < p eg., let Xa = 3 Calculate Public Key for User A, Ya, Ya = a power Xa mod p i.e. Ya = 3 power 3 mod 7 Ya = 6 4. User B User B select a Private Key, Xb < p eg., let Xb = 5 Calculate Public Key for User B, Yb, Yb = a power Xb mod p i.e. Yb = 3 power 5 mod 7 Yb = 5 5. Now User A and B User A computes k = Yb power Xa k = 5 mod 3 mod k = 6 6. User k = k = k = exchange keys... k, mod p 7

B computes k, Ya power Xb mod p 6 mod 5 mod 7 6

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 60 posted: 12/10/2009 language: English pages: 3
Description: list of cryptography problems.