-
Notifications
You must be signed in to change notification settings - Fork 5
/
meta.py
98 lines (72 loc) · 1.6 KB
/
meta.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cipher_modes = dict((k, i) for i, k in enumerate('ecb cbc ctr cfb ofb lrw f8 eax'.split()))
cipher_no_iv_modes = dict((k, cipher_modes[k]) for k in 'ecb eax'.split())
cipher_iv_modes = dict((k, cipher_modes[k]) for k in cipher_modes if k not in cipher_no_iv_modes)
# "Simple" modes which all have the same interface.
cipher_simple_modes = dict((k, cipher_modes[k]) for k in 'cbc cfb ofb'.split())
cipher_auth_modes = dict((k, cipher_modes[k]) for k in 'eax'.split())
cipher_no_auth_modes = dict((k, cipher_modes[k]) for k in cipher_modes if k not in cipher_auth_modes)
cipher_mode_items = list(sorted(cipher_modes.items(), key=lambda x: x[1]))
if True:
cipher_names = tuple('''
aes
anubis
blowfish
cast5
des
des3
kasumi
khazad
#kseed
noekeon
rc2
rc5
rc6
rijndael
saferp
twofish
xtea
'''.strip().split())
else:
cipher_names = tuple('''
aes
blowfish
des
'''.strip().split())
cipher_names = [x for x in cipher_names if not x.startswith('#')]
cipher_properties = 'name min_key_size max_key_size block_size default_rounds'.split()
hash_names = '''
chc
md2
md4
md5
rmd128
rmd160
rmd256
rmd320
sha1
sha224
sha256
sha384
sha512
tiger
whirlpool
'''.strip().split()
hash_properties = ('name', 'digest_size', 'block_size')
mac_names = '''
hmac
omac
pmac
xcbc
'''.strip().split()
mac_items = [(name, i) for i, name in enumerate(mac_names)]
mac_ids = dict(mac_items)
hash_macs = set('hmac'.split())
cipher_macs = set(x for x in mac_names if x not in hash_macs)
# There is no YARROW in here
prng_names = """
fortuna
rc4
sober128
sprng
yarrow
""".strip().split()