-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_section4.2_selfdual.py
250 lines (225 loc) · 15.1 KB
/
test_section4.2_selfdual.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/usr/bin/sage -python
# -*- coding: utf8 -*-
# ++++++++++
# IMPORTANT: This example is expected to run in polynomial time but not necessary for too much small values of q and n
# ++++++++++
from lib import (
sample_permutation_matrix,
algorithm_selfdual,
is_monomial,
)
# SageMath imports
from sage.all import (
matrix,
FiniteField,
)
def main(code, q, Parallel=False):
k, n = code.dimensions()
print(f'\ncode dimension, k:\t{k}')
print(f'code length, n:\t\t{n}')
print(f'Field size, q:\t\t{q}\n')
print(f'\nOriginal code:\n{code}\n')
def setup():
A_code = (code * sample_permutation_matrix(n, q)).rref()
assert(not A_code * A_code.transpose()) # Is self-dual?
M = sample_permutation_matrix(n, q)
B_code = (A_code * M).rref()
C_code = (A_code * (M.inverse())).rref()
print(f'\nSecret permutation matrix, Q:\n{M}\n')
return A_code, B_code, C_code
G0, G1, G2 = setup()
# Recover permutation matrix
Q_ = algorithm_selfdual(k, n, q, G0, G1, G2, G0, Parallel=Parallel)
if Q_ is None:
return False
print(f'Recovered permutation matrix, Q\':\n{Q_}')
return (G0 * Q_).rref() == G1 and (G0 * (Q_.inverse())).rref() == G2 and is_monomial(Q_, n)
if __name__ == '__main__':
q = 7
code7_4 = matrix(FiniteField(q), 2, 4, [
6,5,1,1,
1,6,5,1
])
code7_12 = matrix(FiniteField(q), 6, 12, [
2,6,1,0,0,0,0,1,1,5,3,0,
0,2,5,0,0,0,0,1,1,1,6,3,
1,5,3,0,2,6,1,0,0,0,0,1,
1,1,6,3,0,2,5,0,0,0,0,1,
0,0,0,1,1,5,3,0,2,6,1,0,
0,0,0,1,1,1,6,3,0,2,5,0
])
code7_16 = matrix(FiniteField(q), 8, 16, [
2,6,1,0,0,0,0,0,0,0,0,1,1,5,3,0,
0,2,5,0,0,0,0,0,0,0,0,1,1,1,6,3,
1,5,3,0,2,6,1,0,0,0,0,0,0,0,0,1,
1,1,6,3,0,2,5,0,0,0,0,0,0,0,0,1,
0,0,0,1,1,5,3,0,2,6,1,0,0,0,0,0,
0,0,0,1,1,1,6,3,0,2,5,0,0,0,0,0,
0,0,0,0,0,0,0,1,1,5,3,0,2,6,1,0,
0,0,0,0,0,0,0,1,1,1,6,3,0,2,5,0
])
code7_24 = matrix(FiniteField(q), 12, 24, [
4,5,5,2,3,2,5,0,1,3,1,4,4,0,0,1,1,4,2,1,0,5,2,0,
6,4,5,1,3,0,2,3,6,4,0,2,2,4,0,6,3,5,0,4,2,3,5,6,
0,5,2,0,4,5,5,2,3,2,5,0,1,3,1,4,4,0,0,1,1,4,2,1,
2,3,5,6,6,4,5,1,3,0,2,3,6,4,0,2,2,4,0,6,3,5,0,4,
1,4,2,1,0,5,2,0,4,5,5,2,3,2,5,0,1,3,1,4,4,0,0,1,
3,5,0,4,2,3,5,6,6,4,5,1,3,0,2,3,6,4,0,2,2,4,0,6,
4,0,0,1,1,4,2,1,0,5,2,0,4,5,5,2,3,2,5,0,1,3,1,4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4,2,5,0,3,1,1,1,4,0,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,5,3,0,3,5,6,4,2,2,3,0,5,3,2,5,4,0,5,1,6,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,6,3,0,2,1,4,2,4,2,5,0,3,1,1,1,4,0,5,2,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,5,3,0,3,5,6,4,2,2,3,0,5,3,2,5,4,0,5,1,6,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,6,3,0,2,1,4,2,4,2,5,0,3,1,1,1,4,0,5,2,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,5,3,0,3,5,6,4,2,2,3,0,5,3,2,5,4,0,5,1,6,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,6,3,0,2,1,4,2,4,2,5,0,3,1,1,1,4,0,5,2,0
])
n_tests = 100
for code in (code7_16,):
success = 0
failure = 0
print(f'Running {n_tests} tests')
for x in range(n_tests):
if main(code, q, Parallel=True):
success = success + 1
else:
failure = failure + 1
print(f'\nSuccess: {success}, Failure: {failure}')