encryption - Infinite Loop in Python decryption cipher -
i'm not quite sure how prevent going on forever encryption loop looks similar except has 1 if statement. please me solve problem.
while < len(content): character = content[i] position = alpha.find(character) key2 = alpha.find(key[i % len(key)]) key4 = alpha.find(key1[i % len(key1)]) nposition = position - key2 - key4 if nposition > len(alpha)-1: nposition = nposition - len(alpha) if nposition < 0: nposition = nposition + len(alpha)-1 decipher = alpha[nposition] = + output = output + decipher efile = open(filename2, 'w') efile.write(output) efile.close()
the reason endless loop line:
i = + since i initialized 0 never increase. guess you've made typo , needless ...
i = + 1 ... solve issue.
Comments
Post a Comment