View Single Post
Cod3rror's Avatar
Posts: 66 | Thanked: 27 times | Joined on Jul 2011
#2804
Originally Posted by recluse View Post
3.5 Example
Generation of a key: p and a are randomly generated, g is a primitive root of p appropriate.
p = 2357
g = 2
a = 1751
g^a mod p = 2^1751 (mod 2357) ≡1185

The public key is now P = (p ← 2357, g ← 2, g^a ← 1185), the secret key is a.
Encrypt a message m = 2035 is as follows (k is randomly chosen):
k = 1520
γ = 2^1520 (mod 2357) ≡ 1430
δ ≡ 2035 x 1185^1520 (mod 2357) ≡ 697
c = (γ ← 1430, δ ← 697)
The ciphertext, c, is then sent to the recipient. We can then calculate m from this. the message is calculated by:
m ≡ 1430^(2357-1-1751) x 697 ≡ 872 x 697 (mod 2357) ≡ 2035
Damn man, looks like you're solving the world hunger!
__________________
Free yourself from nokia's morlock cave, discover the future, today: iPhone!
 

The Following 4 Users Say Thank You to Cod3rror For This Useful Post: