-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakeCtables.py
53 lines (48 loc) · 1.06 KB
/
makeCtables.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
import myref
print '#define u8 unsigned char'
print 'u8 RS[4][8] = {'
for i in myref.RS:
print ' {',
for j in i:
print "0x%02X," % j,
print '},'
print '};'
print
print 'u8 Q0[] = {'
print ' ',
for i in range(256):
print "0x%02X," % myref.Qpermute(i, myref.Q0),
if not ((i+1) % 8):
print '\n ',
print '};'
print
print 'u8 Q1[] = {'
print ' ',
for i in range(256):
print "0x%02X," % myref.Qpermute(i, myref.Q1),
if not ((i+1) % 8):
print '\n ',
print '};'
print
print 'u8 mult5B[] = {'
print ' ',
for i in range(256):
print "0x%02X," % myref.gfMult(0x5B, i, myref.GF_MOD),
if not ((i+1) % 8):
print '\n ',
print '};'
print
print 'u8 multEF[] = {'
print ' ',
for i in range(256):
print "0x%02X," % myref.gfMult(0xEF, i, myref.GF_MOD),
if not ((i+1) % 8):
print '\n ',
print '};'
print
#rho = 0x01010101L
#print 'KeyConsts = ['
#for i in range(20):
# print ' [ 0x%08XL, 0x%08XL ],' % (2*i*rho, 2*i*rho + rho)
#print ']'
#print