2013-04-17 14:34:39 +08:00

19 lines
337 B
Python

from string import atoi
fi = open('../lib/cipher1.txt', 'r')
st = fi.read()
li = st.split(',')
for i in xrange(len(li)):
li[i] = atoi(li[i])
'''['g', 'o', 'd']'''
de = [103, 111, 100]
count = 0
string = ''
for i in xrange(len(li)):
count += li[i] ^ de[i % 3]
tmp = chr(li[i] ^ de[i % 3])
string += tmp
print string
print count