@@ -90,7 +90,7 @@ After installation, you can use S-box Analyzer directly in Python:
9090from sboxanalyzer import *
9191from sage.crypto.sboxes import GIFT as sb
9292sa = SboxAnalyzer(sb)
93- cnf, milp = sa.minimized_diff_constraints()
93+ cnf, milp, cp = sa.minimized_diff_constraints()
9494
9595# Output:
9696# Simplifying the MILP/SAT constraints ...
@@ -194,7 +194,7 @@ sage: S = [
194194... .: (0 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 1 , 1 , 0 , 0 ),
195195... .: (0 , 0 , 0 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1 , 0 , 1 )
196196... .: ]
197- sage: cnf, milp = SA .encode_set_of_binary_vectors(S, mode = 6 )
197+ sage: cnf, milp, cp = SA .encode_set_of_binary_vectors(S, mode = 6 )
198198Generateing and simplifying the MILP / SAT constraints ...
199199Time used to simplify the constraints: 0.12 seconds
200200Number of constraints: 27
@@ -245,7 +245,7 @@ We can use S-box Analyzer to encode the truth table of $f$ to (minimized) CNF/MI
245245
246246``` python
247247sage: from sboxanalyzer import SboxAnalyzer as SA
248- sage: cnf, milp = SA .encode_boolean_function(BF , mode = 6 )
248+ sage: cnf, milp, cp = SA .encode_boolean_function(BF , mode = 6 )
249249Generateing and simplifying the MILP / SAT constraints ...
250250Time used to simplify the constraints: 0.00 seconds
251251Number of constraints: 5
@@ -268,7 +268,7 @@ sage: pretty_print(cnf)
268268sage: from sboxanalyzer import *
269269sage: from sage.crypto.sboxes import SKINNY_4 as sb
270270sage: sa = SboxAnalyzer(sb)
271- sage: cnf, milp = sa.minimized_diff_constraints()
271+ sage: cnf, milp, cp = sa.minimized_diff_constraints()
272272
273273Simplifying the MILP / SAT constraints ...
274274Time used to simplify the constraints: 0.02 seconds
@@ -281,7 +281,7 @@ Weight: 3.0000 p0 + 2.0000 p1
281281To make a trade-off between the time of simplification and the solution's optimality, S-Box Analyzer supports seven different modes, i.e., ` [mode=1,...,mode=7] ` . The default mode is 6, which is the best choice for both simplification time and optimality. For example, using the following command, we can minimize the number of constraints a little more:
282282
283283``` python
284- sage: cnf, milp = sa.minimized_diff_constraints(mode = 5 )
284+ sage: cnf, milp, cp = sa.minimized_diff_constraints(mode = 5 )
285285
286286Simplifying the MILP / SAT constraints ...
287287Time used to simplify the constraints: 0.22 seconds
@@ -296,7 +296,7 @@ Weight: 3.0000 p0 + 2.0000 p1
296296``` python
297297sage: from sage.crypto.sboxes import Ascon as sb
298298sage: sa = SboxAnalyzer(sb)
299- sage: cnf, milp = sa.minimized_diff_constraints()
299+ sage: cnf, milp, cp = sa.minimized_diff_constraints()
300300
301301Simplifying the MILP / SAT constraints ...
302302Time used to simplify the constraints: 0.04 seconds
@@ -311,7 +311,7 @@ Weight: 4.0000 p0 + 3.0000 p1 + 2.0000 p2
311311``` python
312312sage: from sage.crypto.sboxes import PRESENT as sb
313313sage: sa = SboxAnalyzer(sb)
314- sage: cnf, milp = sa.minimized_diff_constraints()
314+ sage: cnf, milp, cp = sa.minimized_diff_constraints()
315315
316316Simplifying the MILP / SAT constraints ...
317317Time used to simplify the constraints: 0.03 seconds
@@ -333,7 +333,7 @@ sage: sa = SboxAnalyzer(sb)
333333sage: sa.get_differential_spectrum()
334334[2 , 4 , 6 , 8 , 12 , 16 , 20 , 24 , 28 , 32 , 40 , 48 , 64 ]
335335
336- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 2 , mode = 2 )
336+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 2 , mode = 2 )
337337
338338Simplifying the MILP / SAT constraints ...
339339Time used to simplify the constraints: 0.50 seconds
@@ -345,7 +345,7 @@ Output: b0||b1||b2||b3||b4||b5||b6||b7; b0: msb
345345*** Encode 4-DDT***
346346
347347``` python
348- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 4 )
348+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 4 )
349349
350350Simplifying the MILP / SAT constraints ...
351351Time used to simplify the constraints: 0.67 seconds
@@ -357,7 +357,7 @@ Output: b0||b1||b2||b3||b4||b5||b6||b7; b0: msb
357357*** Encode 6-DDT***
358358
359359``` python
360- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 6 )
360+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 6 )
361361
362362Simplifying the MILP / SAT constraints ...
363363Time used to simplify the constraints: 0.03 seconds
@@ -369,7 +369,7 @@ Output: b0||b1||b2||b3||b4||b5||b6||b7; b0: msb
369369*** Encode 8-DDT***
370370
371371``` python
372- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 8 )
372+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 8 )
373373Simplifying the MILP / SAT constraints ...
374374Time used to simplify the constraints: 0.75 seconds
375375Number of constraints: 235
@@ -387,15 +387,15 @@ sage: sa = SboxAnalyzer(sb)
387387sage: sa.get_differential_spectrum()
388388[2 , 4 ]
389389
390- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 2 )
390+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 2 )
391391
392392Simplifying the MILP / SAT constraints ...
393393Time used to simplify the constraints: 65.11 seconds
394394Number of constraints: 7967
395395Input: a0|| a1|| a2|| a3|| a4|| a5|| a6|| a7; a0: msb
396396Output: b0|| b1|| b2|| b3|| b4|| b5|| b6|| b7; b0: msb
397397
398- sage: cnf, milp = sa.minimized_diff_constraints(subtable = 4 )
398+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = 4 )
399399Simplifying the MILP / SAT constraints ...
400400Time used to simplify the constraints: 869.08 seconds
401401Number of constraints: 321
@@ -413,7 +413,7 @@ In impossible differential attack (or zero correlation linear attacks) we only e
413413sage: from sboxanalyzer import *
414414sage: from sage.crypto.sboxes import Midori_Sb0 as sb
415415sage: sa = SboxAnalyzer(sb)
416- sage: cnf, milp = sa.minimized_diff_constraints(subtable = " star" , mode = 5 )
416+ sage: cnf, milp, cp = sa.minimized_diff_constraints(subtable = " star" , mode = 5 )
417417
418418Simplifying the MILP / SAT constraints ...
419419Time used to simplify the constraints: 0.01 seconds
@@ -430,7 +430,7 @@ By setting the `cryptosmt_compatible` argument to `True`, you can generate an SM
430430sage: from sboxanalyzer import *
431431sage: from sage.crypto.sboxes import CRAFT as sb
432432sage: sa = SboxAnalyzer(sb)
433- sage: cnf, milp = sa.minimized_diff_constraints(cryptosmt_compatible = True )
433+ sage: cnf, milp, cp = sa.minimized_diff_constraints(cryptosmt_compatible = True )
434434
435435Simplifying the MILP / SAT constraints ...
436436Time used to simplify the constraints: 0.02 seconds
@@ -504,7 +504,7 @@ Here, we show how to encode the (squared) LAT of S-boxes.
504504sage: from sboxanalyzer import *
505505sage: from sage.crypto.sboxes import SKINNY_4 as sb
506506sage: sa = SboxAnalyzer(sb)
507- sage: cnf, milp = sa.minimized_linear_constraints()
507+ sage: cnf, milp, cp = sa.minimized_linear_constraints()
508508
509509Simplifying the MILP / SAT constraints ...
510510Time used to simplify the constraints: 0.01 seconds
@@ -521,7 +521,7 @@ Note that `sa.minimized_linear_constraints()` encode the squared LAT scaled by c
521521```python
522522sage: from sage.crypto.sboxes import Ascon as sb
523523sage: sa = SboxAnalyzer(sb)
524- sage: cnf, milp = sa.minimized_linear_constraints()
524+ sage: cnf, milp, cp = sa.minimized_linear_constraints()
525525
526526Simplifying the MILP / SAT constraints ...
527527Time used to simplify the constraints: 0.04 seconds
@@ -598,7 +598,7 @@ sage: mpt = sa.monomial_prediction_table(); mpt
598598 [0 , 0 , 1 , 0 , 1 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 1 , 0 ],
599599 [0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 1 , 1 ],
600600 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ]]
601- sage: cnf, milp = sa.minimized_integral_constraints()
601+ sage: cnf, milp, cp = sa.minimized_integral_constraints()
602602
603603Simplifying the MILP / SAT constraints ...
604604Time used to simplify the constraints: 0.00 seconds
@@ -613,7 +613,7 @@ Output: b0||b1||b2||b3; b0: msb
613613sage: from sboxanalyzer import *
614614sage: from sage.crypto.sboxes import Ascon as sb
615615sage: sa = SboxAnalyzer(sb)
616- sage: cnf, milp = sa.minimized_integral_constraints()
616+ sage: cnf, milp, cp = sa.minimized_integral_constraints()
617617
618618Simplifying the MILP / SAT constraints ...
619619Time used to simplify the constraints: 0.01 seconds
@@ -632,7 +632,7 @@ Here, we show how to encode the DLCT of S-boxes.
632632sage: from sboxanalyzer import *
633633sage: from sage.crypto.sboxes import KNOT as sb
634634sage: sa = SboxAnalyzer(sb)
635- sage: cnf, milp = sa.minimized_differential_linear_constraints(subtable = ' star' )
635+ sage: cnf, milp, cp = sa.minimized_differential_linear_constraints(subtable = ' star' )
636636
637637Simplifying the MILP / SAT constraints ...
638638Time used to simplify the constraints: 0.00 seconds
@@ -647,7 +647,7 @@ Output: b0||b1||b2||b3; b0: msb
647647sage: from sboxanalyzer import *
648648sage: from sage.crypto.sboxes import Midori_Sb0 as sb
649649sage: sa = SboxAnalyzer(sb)
650- sage: cnf, milp = sa.minimized_differential_linear_constraints(subtable = ' star' )
650+ sage: cnf, milp, cp = sa.minimized_differential_linear_constraints(subtable = ' star' )
651651
652652Simplifying the MILP / SAT constraints ...
653653Time used to simplify the constraints: 0.00 seconds
0 commit comments