forked from bozhu/AES-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
24 lines (17 loc) · 677 Bytes
/
test.py
File metadata and controls
24 lines (17 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
__author__ = 'yousefhamza'
import unittest
from aes import AES
class AES_TEST(unittest.TestCase):
def setUp(self):
master_key = 0x2b7e151628aed2a6abf7158809cf4f3c
self.AES = AES(master_key)
def test_encryption(self):
plaintext = 0x3243f6a8885a308d313198a2e0370734
encrypted = self.AES.encrypt(plaintext)
self.assertEqual(encrypted, 0x3925841d02dc09fbdc118597196a0b32)
def test_decryption(self):
ciphertext = 0x3925841d02dc09fbdc118597196a0b32
decrypted = self.AES.decrypt(ciphertext)
self.assertEqual(decrypted, 0x3243f6a8885a308d313198a2e0370734)
if __name__ == '__main__':
unittest.main()