Microsoft Word Hw#3

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Microsoft Word Hw#3 - Presentation Transcript

    1. Computer and Network Security. Name: Khalid Khalil Kamil Matric. No.: G0327887. Solutions to Assignment # 3: 1- Use Euclid’s algorithm to find the greatest common divisor (gcd) of: a. gcd(14,105): Solution: gcd(105,14)=gcd(14, 105 mod 14) = gcd(14, 7) = gcd(7,14 mod 7) = gcd(7,0)=7. b. gcd(180, 1512) Solution: Gcd(1512,180)=gcd(180,1512 mod180)=gcd(180,72)=gcd(72,36)=gcd(36,72mod36) =gcd(36,0)= 36. c. gcd(1001,7655): solution: gcd(7655,1001)=gcd(1001,7655mod1001)=gcd(1001,648)=gcd(648,1001mod648) =gcd(648,353)=gcd(353,648mod353)=gcd(353,295)=gcd(295,353mod295) =gcd(295,58) =gcd(58,295mod58)=gcd(58,5)=gcd(5,58mod5)=gcd(5,3)=gcd(3,5mod3)=gcd(3,2) =gcd(2,3mod2)=gcd(2,1)=gcd(1,2mod1)=gcd(1,0)=1. d. gcd(24140,16762): solution: gcd(24140,16762)=gcd(16762,24140mod16762)=gcd(16762,7378) =gcd(7378,16762mod7378)=gcd(7378,2006)=gcd(2006,7378mod2006) =gcd(2006,1360)=gcd(1360,2006mod1360)=gcd(1360,646)=gcd(646,1360mod646) =gcd(646,68)=gcd(68,646mod68)=gcd(68,34)=gcd(34,68mod34)=gcd(34,0)=34. 2- Find: a. 13 mod 11=2mod11=2. b.875mod9=2mod9=2. c.2594mod48=2mod9=2. d.217mod21: Solution:
    2. 21mod21=2 22mod21=4, 24mod21=(4x4)mod21=16, 28mod21=(16x16)mod21 =256mod21=4, 216mod21=(4x4)mod21=16, 217mod21=[(21mod21)x(216mod21)]mod21=[2x16]mod21=32mod21=11mod21=11. 3-Using Fermat’s theorem, find 3201mod11? Solution: Fermat’s theorem states that: ap-1 ≡1 mod p , provided that, p is a prime number and a is positive integer not divisible by p. 3201mod11=[(310mod11)20 x (31mod11)]mod11 ====== ▼ applying Fermat’s theorem [(1 mod 11)20x (3 mod 11)]mod 11 [1x3] mod 11=3. 4- Perform encryption and decryption using RSA algorithm for the following: a- p=3 q=11 m=5 Solution Key generation: n=p * q=3*11=33. φ(n)=(p-1)(q-1)=2*10=20. Select integer “e” where: gcd(φ(n),e)=1 and 1<e< φ(n) Choose e=3. Calculate d; where d≡e-1mod φ(n) de≡1 mod φ(n) where: d< φ(n) d*3≡1 mod 20 d=7. Public key: KU={3,33}; Private Key: KR={7,33}. Encryption: C=Me mod n = 53mod 33=[(51mod33)(52mod33)]mod33=[5*25]mod33 =26. Decryption: M=Cd mod n=267mod33=[(261mod33)(262mod33)(264mod33)]mod33 =[26*16*(16*16 mod33)]mod33=[26*16*25]mod33=5. b- p=13 q=11 M=9. Key generation:
    3. n=p * q=13*11=143. φ(n)=(p-1)(q-1)=12*10=120. Select integer “e” where: gcd(φ(n),e)=1 and 1<e< φ(n) Choose e=7. Calculate d; where d≡e-1mod φ(n) de≡1 mod φ(n) where: d< φ(n) d*7≡1 mod 120 721≡1mod120 d=721/7=103. Public key: KU={7,143}; Private Key: KR={103,143}. Encryption: C=Me mod n = 97mod 143=[(91mod143)(92mod143)(94mod143)]mod33 =[9*81*(81*81)mod143]mod143=[9*81*126]mod43=48. Decryption: M=Cd mod n=48103mod143 (48mod143)=48. (482mod143)=(48*48)mod143=16. (484mod143)=(16*16)mod143=113. (488mod143)=(113*113)mod143=42. (4816mod143)=(42*42)mod143=48. (4832mod48)=(48*48)mod143=16. (4864mod143)=(16*16mod)143=113. (4896mod143)=(16*113)mod143=92. (48100mod143)=(92*113)mod143=100. (48102mod143)=(100*16)mod143=27. (48103mod143)=(27*48)mod143=9. 5- In a public key system, an intruder intercepts the cipher text C=25, which is destined to a user whose public key is {7,133}. What is the plain text message M? Solution: We have: KU={e,n}={7,133} n=133=20305071110130170191=7*19. p=7, q=19. φ(n) =(7-1)(19-1)=108. de ≡ 1 mod φ(n) 7d ≡ 1 mod108. 7d mod 108=1. Maybe: 7d=108+1? d=109/7=15.57 no Maybe: 7d=108*2+1 d=217/7=31 OK. KR={31,133}. M=Cd mod n =2531 mod 133 251mod133=25. 252mod133=(25*25)mod133=93. 254mod133=(93*93)mod133=4 258mod133=(4*4)mod133=16. 2516mod133=(16*16)mod133=123. 2524mod133=(123*16)mod133=106. 2528mod133=(106*4)mod133=25.
    4. 2530mod133=(25*93)mod133=64. 31 M = 25 mod133=(64*25)mod133=4. M=4.

    + kkkseldkkkseld, 3 years ago

    custom

    261 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 261
      • 261 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 6
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories