def breakOpen(self,enc): it = 1 key = it words = 0 limit = 0 s = "" with open(enc, "r+b") as f: while 1: data = f.read(1) if not data : break s += data limit = len(s) # print limit while it <= limit: transposition = Transposition() file = transposition.decipher(enc,it) n = self.compare(file) # print str(it) + " "+ str(n) if n > words: key = it words = n it += 1 print key
caesar = Caesar() if option == "c": caesar.cipher(from_file,int(key)) elif option == "d": caesar.decipher(from_file,int(key)) else: print "Option doesn't exist." elif algorithm == "t": transposition = Transposition() if option == "c": transposition.cipher(from_file,int(key)) elif option == "d": transposition.decipher(from_file,int(key)) else: print "Option doesn't exist." elif algorithm == "v": vigenere = Vigenere() if option == "c": vigenere.cipher(from_file,key) elif option == "d": vigenere.decipher(from_file,key) else: print "Option doesn't exist." elif algorithm == "s": substitution = Substitution()