KRYPTOGRAPHIE

ALICE

BOB

Das kennt Alice

Das kennt Bob

private key

public key

GEHEIM

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 = false
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)
Vieleck3, i, j, k, l = Polygon(I, J, K, L)
n: alpha^(b)
atext = TextToUnicode(Nachricht)
amtext = Sequence(Element[atext, i] - 65.0, i, 1.0, Length[atext])
acmtext = Sequence(Mod[Element[amtext, i] * Mod[alpha^(b), p], p], i, 1.0, Length[amtext])
actext = Sequence(Element[acmtext, i] + 65.0, i, 1.0, Length[acmtext])
VerschluesselterText = UnicodeToText(actext)
vdmtext = Sequence(Mod[Element[acmtext, i] * Mod[beta^(p - 1.0 - a), p], p], i, 1.0, Length[acmtext])
vmtext = Sequence(Element[vdmtext, i] + 65.0, i, 1.0, Length[vdmtext])
Ergebnis = UnicodeToText(vmtext)
Text5: "Nachricht: " + Nachricht
Text6: "Chiffre: " + VerschluesselterText
Text15: "Chiffre: " + VerschluesselterText
Text16: "Entschlüsselte Nachricht: " + Ergebnis