aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/90-crypto/images
diff options
context:
space:
mode:
authorAndreas Müller <andreas.mueller@othello.ch>2021-04-06 16:40:17 +0200
committerAndreas Müller <andreas.mueller@othello.ch>2021-04-06 16:40:17 +0200
commitc4446c32a0fd6e829959ca2bf84bbad211554a87 (patch)
treee19b644cafa85d894d581aca707a2fe02c581dea /buch/chapters/90-crypto/images
parentnew drawings (diff)
downloadSeminarMatrizen-c4446c32a0fd6e829959ca2bf84bbad211554a87.tar.gz
SeminarMatrizen-c4446c32a0fd6e829959ca2bf84bbad211554a87.zip
add new stuff
Diffstat (limited to 'buch/chapters/90-crypto/images')
-rw-r--r--buch/chapters/90-crypto/images/Makefile9
-rw-r--r--buch/chapters/90-crypto/images/sbox.m52
-rw-r--r--buch/chapters/90-crypto/images/sbox.pdfbin0 -> 23568 bytes
-rw-r--r--buch/chapters/90-crypto/images/sbox.tex241
-rw-r--r--buch/chapters/90-crypto/images/shift.pdfbin0 -> 1182 bytes
-rw-r--r--buch/chapters/90-crypto/images/shift.tex30
6 files changed, 331 insertions, 1 deletions
diff --git a/buch/chapters/90-crypto/images/Makefile b/buch/chapters/90-crypto/images/Makefile
index bbb960f..7d2f375 100644
--- a/buch/chapters/90-crypto/images/Makefile
+++ b/buch/chapters/90-crypto/images/Makefile
@@ -3,7 +3,8 @@
#
# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#
-all: dh.pdf elliptic.pdf schieberegister.pdf multiplikation.pdf
+all: dh.pdf elliptic.pdf schieberegister.pdf multiplikation.pdf sbox.pdf \
+ shift.pdf
dh.pdf: dh.tex
pdflatex dh.tex
@@ -17,3 +18,9 @@ schieberegister.pdf: schieberegister.tex
multiplikation.pdf: multiplikation.tex
pdflatex multiplikation.tex
+sbox.pdf: sbox.tex
+ pdflatex sbox.tex
+
+shift.pdf: shift.tex
+ pdflatex shift.tex
+
diff --git a/buch/chapters/90-crypto/images/sbox.m b/buch/chapters/90-crypto/images/sbox.m
new file mode 100644
index 0000000..973ffc9
--- /dev/null
+++ b/buch/chapters/90-crypto/images/sbox.m
@@ -0,0 +1,52 @@
+#
+# sbox.m
+#
+# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+A=[
+1,0,0,0,1,1,1,1;
+1,1,0,0,0,1,1,1;
+1,1,1,0,0,0,1,1;
+1,1,1,1,0,0,0,1;
+1,1,1,1,1,0,0,0;
+0,1,1,1,1,1,0,0;
+0,0,1,1,1,1,1,0;
+0,0,0,1,1,1,1,1;
+]
+
+R = zeros(8,16);
+R(:,1:8) = A;
+R(:,9:16) = eye(8);
+
+for k = (1:5)
+ for i=(k+1:8)
+ pivot = R(i,k);
+ R(i,:) = R(i,:) + pivot * R(k,:);
+ end
+ R = mod(R, 2)
+end
+
+P = [
+1,0,0,0,0,0,0,0;
+0,1,0,0,0,0,0,0;
+0,0,1,0,0,0,0,0;
+0,0,0,1,0,0,0,0;
+0,0,0,0,1,0,0,0;
+0,0,0,0,0,0,0,1;
+0,0,0,0,0,1,0,0;
+0,0,0,0,0,0,1,0;
+]
+
+R = P * R
+
+for k = (8:-1:2)
+ for i = (1:k-1)
+ pivot = R(i,k);
+ R(i,:) = R(i,:) + pivot * R(k,:);
+ end
+ R = mod(R, 2)
+end
+
+B = R(:,9:16)
+
+A * B
diff --git a/buch/chapters/90-crypto/images/sbox.pdf b/buch/chapters/90-crypto/images/sbox.pdf
new file mode 100644
index 0000000..7a5bdf3
--- /dev/null
+++ b/buch/chapters/90-crypto/images/sbox.pdf
Binary files differ
diff --git a/buch/chapters/90-crypto/images/sbox.tex b/buch/chapters/90-crypto/images/sbox.tex
new file mode 100644
index 0000000..41f8812
--- /dev/null
+++ b/buch/chapters/90-crypto/images/sbox.tex
@@ -0,0 +1,241 @@
+%
+% sbox.tex -- template for standalon tikz images
+%
+% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+%
+\documentclass[tikz]{standalone}
+\usepackage{amsmath}
+\usepackage{times}
+\usepackage{txfonts}
+\usepackage{pgfplots}
+\usepackage{csvsimple}
+\usetikzlibrary{arrows,intersections,math}
+\begin{document}
+\def\skala{1}
+\begin{tikzpicture}[>=latex,thick,scale=\skala]
+
+\def\s{0.2}
+\def\punkt#1#2{({#1*\s},{(8-(#2))*\s})}
+
+\definecolor{b}{rgb}{0,0,0}
+\definecolor{w}{rgb}{1,1,1}
+
+\def\feld#1#2#3{
+ \fill[color=#3] \punkt{#1}{#2} rectangle \punkt{(#1+1)}{(#2-1)};
+}
+
+\def\zeile#1#2#3#4#5#6#7#8#9{
+ \feld{0}{#1}{#2}
+ \feld{1}{#1}{#3}
+ \feld{2}{#1}{#4}
+ \feld{3}{#1}{#5}
+ \feld{4}{#1}{#6}
+ \feld{5}{#1}{#7}
+ \feld{6}{#1}{#8}
+ \feld{7}{#1}{#9}
+}
+\def\inverse#1#2#3#4#5#6#7#8#9{
+ \feld{8}{#1}{#2}
+ \feld{9}{#1}{#3}
+ \feld{10}{#1}{#4}
+ \feld{11}{#1}{#5}
+ \feld{12}{#1}{#6}
+ \feld{13}{#1}{#7}
+ \feld{14}{#1}{#8}
+ \feld{15}{#1}{#9}
+}
+\def\rechteck{
+ \draw (0,{1*\s}) rectangle ({16*\s},{(8+1)*\s});
+ \draw ({8*\s},{1*\s}) -- ({8*\s},{(8+1)*\s});
+}
+
+\def\pivot#1#2{
+ \draw[color=red,line width=1.2pt]
+ \punkt{(#1+\inset)}{(#2-\inset)}
+ rectangle
+ \punkt{(#1+1-\inset)}{(#2-1+\inset)};
+}
+\def\inset{0.1}
+\def\cleanup#1#2#3{
+ \pgfmathparse{(#3-#2)/abs(#3-#2)}
+ \xdef\signum{\pgfmathresult}
+ \draw[color=blue!50,line width=1.2pt]
+ \punkt{(#1+\inset)}{#3}
+ --
+ \punkt{(#1+\inset)}{(#2-1+\inset*\signum)}
+ --
+ \punkt{(#1+1-\inset)}{(#2-1+\inset*\signum)}
+ --
+ \punkt{(#1+1-\inset)}{#3}
+ ;
+}
+
+\begin{scope}
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1bbwwwbbb \inverse1wbwwwwww
+ \zeile2bbbwwwbb \inverse2wwbwwwww
+ \zeile3bbbbwwwb \inverse3wwwbwwww
+ \zeile4bbbbbwww \inverse4wwwwbwww
+ \zeile5wbbbbbww \inverse5wwwwwbww
+ \zeile6wwbbbbbw \inverse6wwwwwwbw
+ \zeile7wwwbbbbb \inverse7wwwwwwwb
+ \rechteck
+ \pivot{0}{0}
+ \cleanup{0}{1}{7}
+\end{scope}
+
+\begin{scope}[xshift=4cm]
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wbbwbbww \inverse2bwbwwwww
+ \zeile3wbbbbbbw \inverse3bwwbwwww
+ \zeile4wbbbwbbb \inverse4bwwwbwww
+ \zeile5wbbbbbww \inverse5wwwwwbww
+ \zeile6wwbbbbbw \inverse6wwwwwwbw
+ \zeile7wwwbbbbb \inverse7wwwwwwwb
+ \rechteck
+ \pivot{1}{1}
+ \cleanup{1}{2}{7}
+\end{scope}
+
+\begin{scope}[xshift=8cm]
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwbbwbbw \inverse3wbwbwwww
+ \zeile4wwbbbbbb \inverse4wbwwbwww
+ \zeile5wwbbwbww \inverse5bbwwwbww
+ \zeile6wwbbbbbw \inverse6wwwwwwbw
+ \zeile7wwwbbbbb \inverse7wwwwwwwb
+ \rechteck
+ \pivot{2}{2}
+ \cleanup{2}{3}{7}
+\end{scope}
+
+\begin{scope}[xshift=12cm,yshift=0cm]
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwbw \inverse3wwbbwwww
+ \zeile4wwwbbwbb \inverse4wwbwbwww
+ \zeile5wwwbwwww \inverse5bwbwwbww
+ \zeile6wwwbbwbw \inverse6wbbwwwbw
+ \zeile7wwwbbbbb \inverse7wwwwwwwb
+ \rechteck
+ \pivot{3}{3}
+ \cleanup{3}{4}{7}
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{8}{7} -- \punkt{8}{11};
+\end{scope}
+
+\begin{scope}[xshift=12cm,yshift=-2.4cm]
+ \draw[<-,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwbw \inverse3wwbbwwww
+ \zeile4wwwwbwwb \inverse4wwwbbwww
+ \zeile5wwwwwwbw \inverse5bwwbwbww
+ \zeile6wwwwbwww \inverse6wbwbwwbw
+ \zeile7wwwwbbwb \inverse7wwbbwwwb
+ \rechteck
+ \pivot{4}{4}
+ \cleanup{4}{5}{7}
+\end{scope}
+
+\begin{scope}[xshift=8cm,yshift=-2.4cm]
+ \draw[<-,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwbw \inverse3wwbbwwww
+ \zeile4wwwwbwwb \inverse4wwwbbwww
+ \zeile5wwwwwwbw \inverse5bwwbwbww
+ \zeile6wwwwwwwb \inverse6wbwwbwbw
+ \zeile7wwwwwbww \inverse7wwbwbwwb
+ \rechteck
+\end{scope}
+
+\begin{scope}[xshift=4cm,yshift=-2.4cm]
+ \draw[<-,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbbbb \inverse0bwwwwwww
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwbw \inverse3wwbbwwww
+ \zeile4wwwwbwwb \inverse4wwwbbwww
+ \zeile5wwwwwbww \inverse5wwbwbwwb
+ \zeile6wwwwwwbw \inverse6bwwbwbww
+ \zeile7wwwwwwwb \inverse7wbwwbwbw
+ \rechteck
+ \cleanup{7}{7}{-1}
+\end{scope}
+
+\begin{scope}[xshift=0cm,yshift=-2.4cm]
+ \zeile0bwwwbbbw \inverse0bbwwbwbw
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwbw \inverse3wwbbwwww
+ \zeile4wwwwbwww \inverse4wbwbwwbw
+ \zeile5wwwwwbww \inverse5wwbwbwwb
+ \zeile6wwwwwwbw \inverse6bwwbwbww
+ \zeile7wwwwwwwb \inverse7wbwwbwbw
+ \rechteck
+ \cleanup{6}{6}{-1}
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{8}{7} -- \punkt{8}{11};
+\end{scope}
+
+\begin{scope}[xshift=0cm,yshift=-4.8cm]
+ \zeile0bwwwbbww \inverse0wbwbbbbw
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwbww \inverse2wbbwwwww
+ \zeile3wwwbwwww \inverse3bwbwwbww
+ \zeile4wwwwbwww \inverse4wbwbwwbw
+ \zeile5wwwwwbww \inverse5wwbwbwwb
+ \zeile6wwwwwwbw \inverse6bwwbwbww
+ \zeile7wwwwwwwb \inverse7wbwwbwbw
+ \rechteck
+ \cleanup{5}{5}{-1}
+\end{scope}
+
+\begin{scope}[xshift=4cm,yshift=-4.8cm]
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwbwww \inverse0wbbbwbbb
+ \zeile1wbwwbwww \inverse1bbwwwwww
+ \zeile2wwbwwwww \inverse2wbwwbwwb
+ \zeile3wwwbwwww \inverse3bwbwwbww
+ \zeile4wwwwbwww \inverse4wbwbwwbw
+ \zeile5wwwwwbww \inverse5wwbwbwwb
+ \zeile6wwwwwwbw \inverse6bwwbwbww
+ \zeile7wwwwwwwb \inverse7wbwwbwbw
+ \rechteck
+ \cleanup{4}{4}{-1}
+\end{scope}
+
+\begin{scope}[xshift=8cm,yshift=-4.8cm]
+ \draw[->,shorten >= 0.05cm,shorten <= 0.05cm]
+ \punkt{-4}{3} -- \punkt{0}{3};
+ \zeile0bwwwwwww \inverse0wwbwwbwb
+ \zeile1wbwwwwww \inverse1bwwbwwbw
+ \zeile2wwbwwwww \inverse2wbwwbwwb
+ \zeile3wwwbwwww \inverse3bwbwwbww
+ \zeile4wwwwbwww \inverse4wbwbwwbw
+ \zeile5wwwwwbww \inverse5wwbwbwwb
+ \zeile6wwwwwwbw \inverse6bwwbwbww
+ \zeile7wwwwwwwb \inverse7wbwwbwbw
+ \rechteck
+\end{scope}
+
+\end{tikzpicture}
+\end{document}
+
diff --git a/buch/chapters/90-crypto/images/shift.pdf b/buch/chapters/90-crypto/images/shift.pdf
new file mode 100644
index 0000000..bc229a1
--- /dev/null
+++ b/buch/chapters/90-crypto/images/shift.pdf
Binary files differ
diff --git a/buch/chapters/90-crypto/images/shift.tex b/buch/chapters/90-crypto/images/shift.tex
new file mode 100644
index 0000000..5cfdd92
--- /dev/null
+++ b/buch/chapters/90-crypto/images/shift.tex
@@ -0,0 +1,30 @@
+%
+% shift.tex -- template for standalon tikz images
+%
+% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+%
+\documentclass[tikz]{standalone}
+\usepackage{amsmath}
+\usepackage{times}
+\usepackage{txfonts}
+\usepackage{pgfplots}
+\usepackage{csvsimple}
+\usetikzlibrary{arrows,intersections,math}
+\begin{document}
+\def\skala{1}
+\begin{tikzpicture}[>=latex,thick,scale=\skala]
+
+\def\s{1}
+\def\punkt#1#2{({#1*\s},{#2*\s})}
+
+\draw \punkt{0}{0} rectangle \punkt{8}{4};
+\foreach \x in {1,...,7}{
+ \draw \punkt{\x}{0} -- \punkt{\x}{4};
+}
+\foreach \y in {1,...,3}{
+ \draw \punkt{0}{\y} -- \punkt{8}{\y};
+}
+
+\end{tikzpicture}
+\end{document}
+