# -*- coding: utf-8 -*-
import sys
from Crypto.Util import number
from Crypto.Random import random
 
n=13
g =11
 
x= random.getrandbits(16)
print "Satunnaisluku x: " + str(x)
X=(g**x)%n
print "Viesti X: " + str(X)
 
 
y= random.getrandbits(16)
print "Satunnaisluku y: " + str(y)
Y=(g**y)%n
print "Viesti Y: " + str(Y)
 
X2 = int(input("Anna viesti X: "))
k2=X2**y%n
print "Avain 1: " + str(k2)
 
Y2 = int(input("Anna viesti Y: "))
k=Y2**x%n
print "Avain 2: " + str(k)
Last modified: 2013/07/01 14:42