1
2
3
4 """Abstract class for AES."""
5
7 - def __init__(self, key, mode, IV, implementation):
8 if len(key) not in (16, 24, 32):
9 raise AssertionError()
10 if mode != 2:
11 raise AssertionError()
12 if len(IV) != 16:
13 raise AssertionError()
14 self.isBlockCipher = True
15 self.block_size = 16
16 self.implementation = implementation
17 if len(key)==16:
18 self.name = "aes128"
19 elif len(key)==24:
20 self.name = "aes192"
21 elif len(key)==32:
22 self.name = "aes256"
23 else:
24 raise AssertionError()
25
26
27
29 assert(len(plaintext) % 16 == 0)
30
31
32
34 assert(len(ciphertext) % 16 == 0)
35