HALLO

ALICE

BOB

Das kennt Alice

Das kennt Bob

private key

public key

GEHEIM

SIGNATUR O.K.!

p = 17 (slider from -5 to 17, step 1)
g = 5 (slider from 2 to 17, step 1)
a = 6
alpha = Mod(g^(a), p)
b = 3
beta = Mod(g^(b), p)
Text7: "g = " + g
Text8: "p = " + p
A = (-2, 7)
B = (-2, 6)
C = (1, 6)
D = (1, 7)
Vieleck1, a_1, b_1, c, d = Polygon(A, B, C, D)
Text3: "α = " + g + "^" + a + " (mod " + p + ") = " + alpha
Text4: "β = " + g + "^" + b + " (mod " + p + ") = " + beta
Text9: "a = " + a
Text10: "b = " + b
e = true
f = true
Text11: "α = " + alpha
Text12: "β = " + beta
E = (-4, 5)
F = (-4, 4)
G = (5, 4)
H = (5, 5)
Vieleck2, e_1, f_1, g_1, h = Polygon(E, F, G, H)
I = Intersect(f_1, e_1)
J = (-4, 3)
K = (5, 3)
L = Intersect(g_1, f_1)
n: alpha^(b)
Text5: "p - 1 = " + (p - 1.0)
r = 5 (slider from 2 to 17, step 1)
Text6: "r = " + r
r_{inv} = 13 (slider from 2 to 17, step 1)
Text15: "r_{inv} = " + r_{inv}
Text16: "Nachricht N : " + N
atext = TextToUnicode(N)
k = Mod(g^(r), p)
Text17: "k = " + k
s = Sequence(Mod[(Element[atext, i] - 65.0 - a * k) * r_{inv}, p - 1.0], i, 1.0, Length[atext])
Text18: "s : " + s
gN = Sequence(Mod[g^(Element[atext, i] - 65.0), p], i, 1.0, Length[atext])
Text19: "g^N : " + gN
akks = Sequence(Mod[Mod[alpha^(k), p] * Mod[k^(Element[s, i]), p], p], i, 1.0, Length[s])
Text20: "\alpha^k \cdot k^s :" + akks
Text21: "Nachricht N : " + N
M = Intersect(f_1, e_1)
O = (-4, 3)
P = (5, 3)
Q = Intersect(g_1, f_1)
Vieleck3, m, o, p_1, q = Polygon(M, O, P, Q)
Text23: "r \cdot r_{inv} \equiv " + (Mod[r * r_{inv}, p - 1.0]) + " (mod " + (p - 1.0) + ")"