Exemplo n.º 1
0
    def test_input_1(self):
        ciphertext = hex_to_arr(r'69c4e0d86a7b0430d8cdb78070b4c55a')
        key = hex_to_arr(r'000102030405060708090a0b0c0d0e0f')
        expected_out = hex_to_arr(r'00112233445566778899aabbccddeeff')

        test_out = Core.decrypt_128(ciphertext, iter_key(key, 128, reverse=True))

        for expected, test in zip(expected_out, test_out):
            self.assertEqual(expected, test)
Exemplo n.º 2
0
 def test_variable_plaintext(self):
     for expected_plaintext, key, ciphertext in self.tests['Variable Plaintext']:
         with self.subTest(expected_plaintext=expected_plaintext, key=key, ciphertext=ciphertext):
             test_plaintext = Core.decrypt_128(hex_to_arr(ciphertext), iter_key(hex_to_arr(key), 128, reverse=True))
             for e_item, t_item in zip(hex_to_arr(expected_plaintext), test_plaintext):
                 self.assertEqual(e_item, t_item)