def test_decrypt_single(self): self.assertEqual('asdf', decrypt('bteg', 1)) self.assertEqual('asdf', decrypt('bteg')) self.assertNotEqual('qsdf', decrypt('bteg', 1)) self.assertEqual('z', decrypt('a', 1)) self.assertEqual('zabcdefghijklmnopqrstuvwxy', decrypt('abcdefghijklmnopqrstuvwxyz', 1))
def test_decrypt_trivial(self): self.assertEqual('!', decrypt('!')) self.assertNotEqual('!', decrypt('')) self.assertNotEqual('!', decrypt('!!')) self.assertEqual('qwer', decrypt('qwer', 0)) self.assertNotEqual('asdf', decrypt('qwer', 0)) self.assertEqual('qwer', decrypt('qwer', 26))
#!/usr/bin/python3 from ceasar import decrypt, populate_decrypt_dict print("################################################") print("# Team Soteria #") print("# Applied Crypto Exercise 2: #") print("################################################") print("# Implementing Ceasar Wheel Brute Force Attack #") print("################################################") message = input("Type your text: ") for shift in range(0, 26): populate_decrypt_dict(shift) print("The decrypted text: " + decrypt(message))
def test_decrypt_double(self): self.assertEqual('asdf', decrypt('cufh', 2)) self.assertNotEqual('xsdf', decrypt('cufh', 2)) self.assertEqual('yzabcdefghijklmnopqrstuvwx', decrypt('abcdefghijklmnopqrstuvwxyz', 2))