# Encrypt text w/ a Fibonacci serries referenced by binary# See if you can compress the resultscnvrt_out = []fib_out = []enc_out = []inpt = raw_input("Text to encrypt: ")print cnvrt_out, fib_out, enc_outdef cnvrt(i): for x in i: cnvrt_out.append(int(ord(x)))def fib(i): # get a Fibonacci serries up to i's largest value """i /Must Be/ a list or tuttle of /numeric/ values""" y = 0 for x in i: if x > y: y = x i = y a, b = 1, 1 while b <= i: fib_out.append(b) a, b = b, a+bdef enc(i): #xSetup a string w/ correct # of 0s # Subtract the largest value from fib_out < input # Overwrite the appropriate 0 w/ a 1 # Repeate at "Subtract..." till input == 0 # Append binary string to output string tmp = '' # A Temporary storage for the individual binary of the value cnt = 0 # A counter for x in i: # Setup a string w/ correct number of 0s tmp = '' for y in range(0,len(fib_out)): tmp += '0' cnt = -1 while x > 0: for y in fib_out: if y <= x: z = y cnt += 1 if y > x: break #print 'x:',x, type(x), 'z:',z,type(z) x -= z tmp = tmp[:cnt] + '1' + tmp[cnt+1:] cnt = -1 enc_out.append(tmp)cnvrt(inpt)fib(cnvrt_out)enc(cnvrt_out)print inptprint cnvrt_outprint fib_out# Append the last Fibonacci number (encrypted) to the code#i = fib_out[len(fib_out)-1]#cnvrt(['i'])#enc(cnvrt_out)print enc_out