コード例 #1
0
ファイル: AESCore_Test.py プロジェクト: ech2901/pyaes
    def test_input_1(self):
        plaintext = hex_to_arr(r'00112233445566778899aabbccddeeff')
        key = hex_to_arr(r'000102030405060708090a0b0c0d0e0f')
        expected_out = hex_to_arr(r'69c4e0d86a7b0430d8cdb78070b4c55a')

        test_out = Core.encrypt_128(plaintext, iter_key(key, 128))

        for expected, test in zip(expected_out, test_out):
            self.assertEqual(expected, test)
コード例 #2
0
ファイル: AESCore_Test.py プロジェクト: ech2901/pyaes
 def test_variable_key(self):
     for plaintext, key, expected_ciphertext in self.tests['Variable Key']:
         with self.subTest(plaintext=plaintext, key=key, expected_ciphertext=expected_ciphertext):
             test_ciphertext = Core.encrypt_128(hex_to_arr(plaintext), iter_key(hex_to_arr(key), 128))
             for e_item, t_item in zip(hex_to_arr(expected_ciphertext), test_ciphertext):
                 self.assertEqual(e_item, t_item)