Rsa encryption

239
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
239
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Rsa encryption

  1. 1. Public key cryptography
  2. 2. R for Rivest, S for Shamir, and A for Adelman.
  3. 3. Generating the public keys1. Pick two prime numbers p and q, eg 3 and 112. Calculate their product n, n = 333. Calculate intermediate z (p-1)*(q-1), z = 204. Pick a prime k such that k is smaller than z and z is and not divisible by k, k = 75. The numbers n and k are the public key, in our case n=33, k=7
  4. 4. Generating the private key• The private key j is given by the formula k * j = 1(mod z)• In our example, k = 7, z = 20 7 * j = 1(mod 20)• Is satisfied by j = 3• Our private key is 3
  5. 5. Encrypting and Decrypting • E is the encrypted value • P is the plaintext value• Encrypting, say we send P = 14 P ^ k = E(mod n) 14^7 = 105413504 105413504 / 33 = 3194348.606 14 ^ 7 = E(mod 33) = 20 3194348 * 33 = 105413484 105413504 – 105413484 = 20• E ^ j = P(mod n) 20^3 = 8000 8000 / 33 = 242.42424242• 20 ^ 3 = P(mod 33) = 14 242 * 33 = 7986 8000 – 7986 = 14
  6. 6. Encrypting and Decrypting • E is the encrypted value • P is the plaintext value• Encrypting, say we send P = 14 P ^ k = E(mod n) 14^7 = 105413504 105413504 / 33 = 3194348.606 14 ^ 7 = E(mod 33) = 20 3194348 * 33 = 105413484 105413504 – 105413484 = 20• E ^ j = P(mod n) 20^3 = 8000 8000 / 33 = 242.42424242• 20 ^ 3 = P(mod 33) = 14 242 * 33 = 7986 8000 – 7986 = 14

×