Example #1
0
'''This file is the main file to be exexcuted'''

from LargeRandomNumber import get_LargeRandomNumber
from getTwoPrimes import get_TwoPrimes
from getPublicPrivateKey import get_PublicPrivateKey
from inspect import currentframe, getframeinfo
from hashfun import hashfun
from FastExponentiation import FastExponentiation
from getRandomBit import get_RandomBit

length = 32
'''Get some large random number and show the trace how each bit is selected'''
frameinfo = getframeinfo(currentframe())
print 'line:',frameinfo.lineno+2
x = get_LargeRandomNumber(True)

frameinfo = getframeinfo(currentframe())
print 'line:',frameinfo.lineno+3
'''Get the two prime numbers for Alice'''
(p_Alice,q_Alice) = get_TwoPrimes(True,frameinfo.lineno+3)

'''Calculate the value of n for Alice'''
n_Alice = p_Alice*q_Alice

'''Calculate the value of phin'''
phi_n_Alice = (p_Alice-1)*(q_Alice-1)

'''Calculate the public and private key pair of Alice which are multiplicative inverses of each other'''

frameinfo = getframeinfo(currentframe())
print 'line:',frameinfo.lineno+2