--- /dev/null
+# Nothing here is built or distributed by default.
+
+all: serpent-sbox3.pdf serpent-sbox4.pdf serpent-sbox5.pdf
+
+%.pdf: %.dot
+ dot -Tpdf $< -o $@
--- /dev/null
+strict digraph sbox3 {
+ x0 -> t01; x2 -> t01; // t01 = x0 ^ x2;
+ x0 -> t02; x3 -> t02; // t02 = x0 | x3;
+ x0 -> t03; x3 -> t03; // t03 = x0 & x3;
+ t01 -> t04; t02 -> t04; // t04 = t01 & t02;
+ x1 -> t05; t03 -> t05; // t05 = x1 | t03;
+ x0 -> t06; x1 -> t06; // t06 = x0 & x1;
+ x3 -> t07; t04 -> t07; // t07 = x3 ^ t04;
+ x2 -> t08; t06 -> t08; // t08 = x2 | t06;
+ x1 -> t09; t07 -> t09; // t09 = x1 ^ t07;
+ x3 -> t10; t05 -> t10; // t10 = x3 & t05;
+ t02 -> t11; t10 -> t11; // t11 = t02 ^ t10;
+ t08 -> y3; t09 -> y3; // y3 = t08 ^ t09;
+ x3 -> t13; y3 -> t13; // t13 = x3 | y3;
+ x0 -> t14; t07 -> t14; // t14 = x0 | t07;
+ x1 -> t15; t13 -> t15; // t15 = x1 & t13;
+ t08 -> y2; t11 -> y2; // y2 = t08 ^ t11;
+ t14 -> y0; t15 -> y0; // y0 = t14 ^ t15;
+ t05 -> y1; t04 -> y1; // y1 = t05 ^ t04;
+}
--- /dev/null
+strict digraph sbox4 {
+ x0 [shape=box, label="\N"];
+ x1 [shape=box, label="\N"];
+ x2 [shape=box, label="\N"];
+ x3 [shape=box, label="\N"];
+
+ t02 [label="\N\ny2\n1"];
+ t01 [label="\N\ny3\n2"];
+
+ t03 [label="\N\ny2\n3"];
+ t06 [label="\N\ny3\n4"];
+
+ t04 [label="\N\ny0\n5"];
+ t05 [label="\N\nx3\n6"];
+ t15 [label="\N\nx0\n7"];
+
+ t11 [label="\N\nx1\n8"];
+
+ t10 [label="\N\nx2\n9"];
+
+ y3 [shape=box, label="\N\n10"];
+
+ t13 [label="\N\ny2\n11"];
+
+ t08 [label="\N\ny1\n12"];
+
+ y2 [shape=box, label="\N\n13"];
+
+ t12 [label="\N\ny1\n14"];
+ t16 [label="\N\ny1\n15"];
+ y1 [shape=box, label="\N\n16"];
+
+ t09 [label="\N\ny0\n17"];
+ t14 [label="\N\ny0\n18"];
+ y0 [shape=box, label="\N\n19"];
+
+ x0 -> t01; x1 -> t01; // t01 = x0 | x1;
+ x1 -> t02; x2 -> t02; // t02 = x1 | x2;
+ x0 -> t03; t02 -> t03; // t03 = x0 ^ t02;
+ x1 -> t04; x3 -> t04; // t04 = x1 ^ x3;
+ x3 -> t05; t03 -> t05; // t05 = x3 | t03;
+ x3 -> t06; t01 -> t06; // t06 = x3 & t01;
+ t03 -> y3; t06 -> y3; // y3 = t03 ^ t06;
+ y3 -> t08; t04 -> t08; // t08 = y3 & t04;
+ t04 -> t09; t05 -> t09; // t09 = t04 & t05;
+ x2 -> t10; t06 -> t10; // t10 = x2 ^ t06;
+ x1 -> t11; x2 -> t11; // t11 = x1 & x2;
+ t04 -> t12; t08 -> t12; // t12 = t04 ^ t08;
+ t11 -> t13; t03 -> t13; // t13 = t11 | t03;
+ t10 -> t14; t09 -> t14; // t14 = t10 ^ t09;
+ x0 -> t15; t05 -> t15; // t15 = x0 & t05;
+ t11 -> t16; t12 -> t16; // t16 = t11 | t12;
+ t13 -> y2; t08 -> y2; // y2 = t13 ^ t08;
+ t15 -> y1; t16 -> y1; // y1 = t15 ^ t16;
+ t14 -> y0; // y0 = ~ t14;
+}
--- /dev/null
+strict digraph sbox5 {
+ x0 [shape=box];
+ x1 [shape=box];
+ x2 [shape=box];
+ x3 [shape=box];
+
+ t02 [label="\N\ny0\n1"];
+ t04 [label="\N\ny0\n2"];
+ t01 [label="\N\nx2\n3"];
+ t07 [label="\N\ny2\n4"];
+ t03 [label="\N\nx0\n5"];
+ t05 [label="\N\ny0\n6"];
+ t11 [label="\N\ny3\n7"];
+ t09 [label="\N\nx1\n8"];
+ y0 [shape=box, label="\N\n9"];
+ t12 [label="\N\nx0\n10"];
+ t14 [label="\N\ny3\n11"];
+ y3 [shape=box, label="\N\n12"];
+ t08 [label="\N\ny1\n13"];
+ t10 [label="\N\nx3\n14"];
+ y1 [shape=box, label="\N\n15"];
+ t13 [label="\N\ny2\n16"];
+ y2 [shape=box, label="\N\n17"];
+
+ x1 -> t01; x3 -> t01; // t01 = x1 ^ x3;
+ x1 -> t02; x3 -> t02; // t02 = x1 | x3;
+ x0 -> t03; t01 -> t03; // t03 = x0 & t01;
+ x2 -> t04; t02 -> t04; // t04 = x2 ^ t02;
+ t03 -> t05; t04 -> t05; // t05 = t03 ^ t04;
+ t05 -> y0; // y0 = ~ t05;
+ x0 -> t07; t01 -> t07; // t07 = x0 ^ t01;
+ x3 -> t08; y0 -> t08; // t08 = x3 | y0;
+ x1 -> t09; t05 -> t09; // t09 = x1 | t05;
+ x3 -> t10; t08 -> t10; // t10 = x3 ^ t08;
+ x1 -> t11; t07 -> t11; // t11 = x1 | t07;
+ t03 -> t12; y0 -> t12; // t12 = t03 | y0;
+ t07 -> t13; t10 -> t13; // t13 = t07 | t10;
+ t01 -> t14; t11 -> t14; // t14 = t01 ^ t11;
+ t09 -> y2; t13 -> y2; // y2 = t09 ^ t13;
+ t07 -> y1; t08 -> y1; // y1 = t07 ^ t08;
+ t12 -> y3; t14 -> y3; // y3 = t12 ^ t14;
+}