def getKey(pp,cc):
t=list(pp)
pls=[]
for i in xrange(len(t)):
pls.append(ord(t[i])-0x41)
ss=''
for i in xrange(len(cc)):
key=32
while key <127:
tmp=key+lfsr[i%15]+pls[i]-0x41
while tmp>0x19:
tmp-=0x1a
if tmp==(ord(cc[i])-0x41):
ss+=chr(key)
break
key=key+1
return ss[0:10]
def enc(key,pp):
ss=''
pp=pp.upper()
for i in xrange(len(pp)):
tmp=ord(key[i%len(key)])+lfsr[i%15]+ord(pp[i])-0x41-0x41
while tmp>0x19:
tmp-=0x1a
ss+=chr(tmp+0x41)
return ss.upper()
def dec(key,cc):
ss=''
cc=cc.upper()
for i in xrange(len(cc)):
tmp=ord(cc[i])-0x41
p=''
while tmp<=0x19:
tmp+=0x1a
t=(tmp-ord(key[i%len(key)])-lfsr[i%15]+0x41)+0x41
if t>=ord('z'):
p=chr(t-0x1a)
else:
p=chr(t)
ss+=p
return ss.upper()