Skip to content

Commit

Permalink
A bug in computing the ANF for 3-bit and 4-bit S-boxes
Browse files Browse the repository at this point in the history
In the function `get_coordinates_ANF()`, for 3-bit and 4-bit S-boxes, at the beginning, to obtain the truth table, the mask should be AND to the value, not XOR.

The influence of this bug:
For 3-bit and 4-bit S-boxes, the computed ANF of coordinates are all XORed with '1', which should not!

There is no influence on other results and on 5/6/7/8-bit S-boxes.
  • Loading branch information
FreeDisciplina committed Mar 21, 2020
1 parent e3c5222 commit d9b0089
Show file tree
Hide file tree
Showing 516 changed files with 138,876 additions and 4,976 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ LUT = {
};

ANF of coordinates:
y0 = + x0 + x1 + + + + x1x2; deg = 2, term_n = 3, related_n = 3
y1 = + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = + x0 + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
y0 = 1 + x0 + x1 + + + + x1x2; deg = 2, term_n = 4, related_n = 3
y1 = 1 + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y2 = 1 + x0 + + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3

ANF of components:
y0 + + = + x0 + x1 + + + + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + = + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + + = 1 + x0 + x1 + + + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + = 1 + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + = + x0 + + x2 + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
+ + y2 = + x0 + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
+ + y2 = 1 + x0 + + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y0 + + y2 = + + x1 + x2 + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + y2 = + x0 + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + y2 = + + + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + + + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down Expand Up @@ -128,18 +128,18 @@ LUT = {
};

ANF of coordinates:
y0 = + x0 + + x2 + + + x1x2; deg = 2, term_n = 3, related_n = 3
y1 = + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
y0 = 1 + x0 + + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
y1 = 1 + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y2 = 1 + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3

ANF of components:
y0 + + = + x0 + + x2 + + + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + = + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + + = 1 + x0 + + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + = 1 + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + = + + x1 + x2 + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
+ + y2 = + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
+ + y2 = 1 + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y0 + + y2 = + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + y2 = + x0 + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + y2 = + + + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + + + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ LUT = {
};

ANF of coordinates:
y0 = 1 + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 5, related_n = 3
y1 = 1 + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y2 = 1 + + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
y0 = + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
y1 = + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = + + + x2 + x0x1 + + ; deg = 2, term_n = 2, related_n = 3

ANF of components:
y0 + + = 1 + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 5, related_n = 3
+ y1 + = 1 + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + + = + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + = + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + = + x0 + + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
+ + y2 = 1 + + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
+ + y2 = + + + x2 + x0x1 + + ; deg = 2, term_n = 2, related_n = 3
y0 + + y2 = + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + y2 = + + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 6, related_n = 3
y0 + y1 + y2 = + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down Expand Up @@ -128,18 +128,18 @@ LUT = {
};

ANF of coordinates:
y0 = 1 + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 5, related_n = 3
y1 = 1 + + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = 1 + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y0 = + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
y1 = + + x1 + + + x0x2 + ; deg = 2, term_n = 2, related_n = 3
y2 = + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3

ANF of components:
y0 + + = 1 + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 5, related_n = 3
+ y1 + = 1 + + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + + = + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + = + + x1 + + + x0x2 + ; deg = 2, term_n = 2, related_n = 3
y0 + y1 + = + x0 + + x2 + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
+ + y2 = 1 + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
+ + y2 = + + x1 + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
y0 + + y2 = + x0 + + + x0x1 + + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + y2 = + + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + x0 + x1 + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 6, related_n = 3
y0 + y1 + y2 = + x0 + x1 + + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ LUT = {
};

ANF of coordinates:
y0 = 1 + x0 + + + + + x1x2; deg = 2, term_n = 3, related_n = 3
y1 = 1 + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
y2 = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
y0 = + x0 + + + + + x1x2; deg = 2, term_n = 2, related_n = 3
y1 = + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
y2 = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3

ANF of components:
y0 + + = 1 + x0 + + + + + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + = 1 + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
y0 + + = + x0 + + + + + x1x2; deg = 2, term_n = 2, related_n = 3
+ y1 + = + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
y0 + y1 + = + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
+ + y2 = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
+ + y2 = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y0 + + y2 = + + x1 + x2 + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + y2 = + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
y0 + y1 + y2 = 1 + + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + y2 = + + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down Expand Up @@ -128,18 +128,18 @@ LUT = {
};

ANF of coordinates:
y0 = 1 + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
y1 = 1 + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y2 = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
y0 = + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
y1 = + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3

ANF of components:
y0 + + = 1 + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + = 1 + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + + = + + x1 + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + = + x0 + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + = + x0 + + + + + x1x2; deg = 2, term_n = 2, related_n = 3
+ + y2 = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
+ + y2 = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y0 + + y2 = + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
+ y1 + y2 = + + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + + x1 + x2 + x0x1 + + x1x2; deg = 2, term_n = 5, related_n = 3
y0 + y1 + y2 = + + x1 + x2 + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ LUT = {
};

ANF of coordinates:
y0 = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
y1 = + + x1 + + + x0x2 + ; deg = 2, term_n = 2, related_n = 3
y2 = + + x1 + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
y0 = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
y1 = 1 + + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = 1 + + x1 + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 6, related_n = 3

ANF of components:
y0 + + = + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 4, related_n = 3
+ y1 + = + + x1 + + + x0x2 + ; deg = 2, term_n = 2, related_n = 3
y0 + + = 1 + x0 + x1 + x2 + x0x1 + + ; deg = 2, term_n = 5, related_n = 3
+ y1 + = 1 + + x1 + + + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + y1 + = + x0 + + x2 + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
+ + y2 = + + x1 + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
+ + y2 = 1 + + x1 + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 6, related_n = 3
y0 + + y2 = + x0 + + + + x0x2 + x1x2; deg = 2, term_n = 3, related_n = 3
+ y1 + y2 = + + + x2 + x0x1 + + x1x2; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = + x0 + x1 + + + + x1x2; deg = 2, term_n = 3, related_n = 3
y0 + y1 + y2 = 1 + x0 + x1 + + + + x1x2; deg = 2, term_n = 4, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down Expand Up @@ -128,18 +128,18 @@ LUT = {
};

ANF of coordinates:
y0 = 1 + + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
y1 = + + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y2 = 1 + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 5, related_n = 3
y0 = + + + x2 + x0x1 + + ; deg = 2, term_n = 2, related_n = 3
y1 = 1 + + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y2 = + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3

ANF of components:
y0 + + = 1 + + + x2 + x0x1 + + ; deg = 2, term_n = 3, related_n = 3
+ y1 + = + + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 3, related_n = 3
y0 + + = + + + x2 + x0x1 + + ; deg = 2, term_n = 2, related_n = 3
+ y1 + = 1 + + x1 + + x0x1 + x0x2 + ; deg = 2, term_n = 4, related_n = 3
y0 + y1 + = 1 + + x1 + x2 + + x0x2 + ; deg = 2, term_n = 4, related_n = 3
+ + y2 = 1 + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 5, related_n = 3
+ + y2 = + x0 + x1 + + x0x1 + + x1x2; deg = 2, term_n = 4, related_n = 3
y0 + + y2 = + x0 + x1 + x2 + + + x1x2; deg = 2, term_n = 4, related_n = 3
+ y1 + y2 = 1 + x0 + + + + x0x2 + x1x2; deg = 2, term_n = 4, related_n = 3
y0 + y1 + y2 = + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 5, related_n = 3
y0 + y1 + y2 = 1 + x0 + + x2 + x0x1 + x0x2 + x1x2; deg = 2, term_n = 6, related_n = 3
Max degree: 2, Min degree: 2, Spectrum of degree: { 2:7, };

DDT =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Cipher,LUT,bit_slice,Permutation,Involution,Diff,DiffFreq,Diff1,CardD1,Lin,LinFreq,Lin1,CardL1,max_degree,min_degree,MaxDegreeFreq,MinDegreeFreq,Max_ProductDegrees,LS_number,"max_v (v, w)-linear","max_w (v, w)-linear",Optimal_Class,Cost (GE) TSMC65nm,Cost is Best ,inv_LUT,inv_bit_slice,inv_max_degree,inv_min_degree,inv_MaxDegreeFreq,inv_MinDegreeFreq,inv_Max_ProductDegrees,inv_LS_number,"inv_max_v (v, w)-linear","inv_max_w (v, w)-linear",inv_Optimal_Class
PRINTcipher,0001030607040502,78_9c_56,True,False,2,28,2,3,4,28,4,3,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-,0,-,0001070205060304,b4_6c_56,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-
SEA,0005060704030102,1e_ac_6a,True,False,2,28,2,4,4,28,4,4,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-,0,-,0006070504010203,1e_c6_ac,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-
ctc2,0706000402050103,2b_93_e1,True,False,2,28,2,5,4,28,4,5,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-,0,-,0206040703050100,2e_1b_78,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-
3-way,0702040501060300,2d_63_59,True,False,2,28,2,3,4,28,4,3,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-,0,-,0704010602030500,4b_39_65,2,2,7,7,[2|2|3],7,"(2, 2)","(2, 2)",-
Loading

0 comments on commit d9b0089

Please sign in to comment.