From c321e5bc7ce152b7509d6f55c0514590f770b22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Mon, 5 Apr 2021 22:08:36 +0200 Subject: new drawings --- buch/chapters/90-crypto/images/Makefile | 8 +- buch/chapters/90-crypto/images/multiplikation.pdf | Bin 0 -> 25263 bytes buch/chapters/90-crypto/images/multiplikation.tex | 464 +++++++++++++++++++++ buch/chapters/90-crypto/images/schieberegister.pdf | Bin 0 -> 28254 bytes buch/chapters/90-crypto/images/schieberegister.tex | 120 ++++++ 5 files changed, 591 insertions(+), 1 deletion(-) create mode 100644 buch/chapters/90-crypto/images/multiplikation.pdf create mode 100644 buch/chapters/90-crypto/images/multiplikation.tex create mode 100644 buch/chapters/90-crypto/images/schieberegister.pdf create mode 100644 buch/chapters/90-crypto/images/schieberegister.tex (limited to 'buch/chapters/90-crypto/images') diff --git a/buch/chapters/90-crypto/images/Makefile b/buch/chapters/90-crypto/images/Makefile index 9480163..bbb960f 100644 --- a/buch/chapters/90-crypto/images/Makefile +++ b/buch/chapters/90-crypto/images/Makefile @@ -3,7 +3,7 @@ # # (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule # -all: dh.pdf elliptic.pdf +all: dh.pdf elliptic.pdf schieberegister.pdf multiplikation.pdf dh.pdf: dh.tex pdflatex dh.tex @@ -11,3 +11,9 @@ dh.pdf: dh.tex elliptic.pdf: elliptic.tex pdflatex elliptic.tex +schieberegister.pdf: schieberegister.tex + pdflatex schieberegister.tex + +multiplikation.pdf: multiplikation.tex + pdflatex multiplikation.tex + diff --git a/buch/chapters/90-crypto/images/multiplikation.pdf b/buch/chapters/90-crypto/images/multiplikation.pdf new file mode 100644 index 0000000..86345b8 Binary files /dev/null and b/buch/chapters/90-crypto/images/multiplikation.pdf differ diff --git a/buch/chapters/90-crypto/images/multiplikation.tex b/buch/chapters/90-crypto/images/multiplikation.tex new file mode 100644 index 0000000..27c4329 --- /dev/null +++ b/buch/chapters/90-crypto/images/multiplikation.tex @@ -0,0 +1,464 @@ +% +% multiplikation.tex -- +% +% (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] + +\definecolor{darkgreen}{rgb}{0,0.6,0} + +\def\s{0.45} + +\def\punkt#1#2{({#1*\s},{#2*\s})} + +\def\pfeile{ + \foreach \x in {0.5,1.5,...,7.5}{ + \draw[->,color=blue] \punkt{\x}{-2.1} -- \punkt{(\x-1)}{-3.3}; + } +} + +\begin{scope}[yshift=0.1cm] + \node at \punkt{0}{0.5} [left] {$p(X)=\mathstrut$}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node at \punkt{0.5}{0.5} {\texttt{1}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{0}}; + \node at \punkt{3.5}{0.5} {\texttt{1}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{1}}; + \foreach \x in {0.5,1.5,...,7.5}{ + \draw[->,color=blue] \punkt{\x}{-0.1} -- \punkt{(\x-1)}{-1.3}; + } +\end{scope} + +\begin{scope}[yshift=-1cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{1}}; + \node at \punkt{0.5}{0.5} {\texttt{0}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{0}}; + \node at \punkt{4.5}{0.5} {\texttt{1}}; + \node at \punkt{5.5}{0.5} {\texttt{0}}; + \node at \punkt{6.5}{0.5} {\texttt{1}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + + \draw[->,color=darkgreen] + \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; + \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{0}}; + \node at \punkt{1.5}{-1.5} {\texttt{0}}; + \node at \punkt{2.5}{-1.5} {\texttt{1}}; + \node at \punkt{3.5}{-1.5} {\texttt{1}}; + \node at \punkt{4.5}{-1.5} {\texttt{0}}; + \node at \punkt{5.5}{-1.5} {\texttt{0}}; + \node at \punkt{6.5}{-1.5} {\texttt{0}}; + \node at \punkt{7.5}{-1.5} {\texttt{1}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-3cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{0}}; + \node at \punkt{0.5}{0.5} {\texttt{0}}; + \node at \punkt{1.5}{0.5} {\texttt{1}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{0}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{0}}; + \node at \punkt{6.5}{0.5} {\texttt{1}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + +% \draw[->,color=darkgreen] +% \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; +% \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{0}}; + \node at \punkt{1.5}{-1.5} {\texttt{1}}; + \node at \punkt{2.5}{-1.5} {\texttt{1}}; + \node at \punkt{3.5}{-1.5} {\texttt{0}}; + \node at \punkt{4.5}{-1.5} {\texttt{0}}; + \node at \punkt{5.5}{-1.5} {\texttt{0}}; + \node at \punkt{6.5}{-1.5} {\texttt{1}}; + \node at \punkt{7.5}{-1.5} {\texttt{0}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-5cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{0}}; + \node at \punkt{0.5}{0.5} {\texttt{1}}; + \node at \punkt{1.5}{0.5} {\texttt{1}}; + \node at \punkt{2.5}{0.5} {\texttt{0}}; + \node at \punkt{3.5}{0.5} {\texttt{0}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + +% \draw[->,color=darkgreen] +% \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; +% \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{1}}; + \node at \punkt{1.5}{-1.5} {\texttt{1}}; + \node at \punkt{2.5}{-1.5} {\texttt{0}}; + \node at \punkt{3.5}{-1.5} {\texttt{0}}; + \node at \punkt{4.5}{-1.5} {\texttt{0}}; + \node at \punkt{5.5}{-1.5} {\texttt{1}}; + \node at \punkt{6.5}{-1.5} {\texttt{0}}; + \node at \punkt{7.5}{-1.5} {\texttt{0}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-7cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{1}}; + \node at \punkt{0.5}{0.5} {\texttt{1}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{0}}; + \node at \punkt{3.5}{0.5} {\texttt{0}}; + \node at \punkt{4.5}{0.5} {\texttt{1}}; + \node at \punkt{5.5}{0.5} {\texttt{0}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + + \draw[->,color=darkgreen] + \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; + \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{1}}; + \node at \punkt{1.5}{-1.5} {\texttt{0}}; + \node at \punkt{2.5}{-1.5} {\texttt{0}}; + \node at \punkt{3.5}{-1.5} {\texttt{1}}; + \node at \punkt{4.5}{-1.5} {\texttt{0}}; + \node at \punkt{5.5}{-1.5} {\texttt{0}}; + \node at \punkt{6.5}{-1.5} {\texttt{1}}; + \node at \punkt{7.5}{-1.5} {\texttt{1}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-9cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{1}}; + \node at \punkt{0.5}{0.5} {\texttt{0}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{0}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{1}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + + \draw[->,color=darkgreen] + \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; + \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{0}}; + \node at \punkt{1.5}{-1.5} {\texttt{0}}; + \node at \punkt{2.5}{-1.5} {\texttt{1}}; + \node at \punkt{3.5}{-1.5} {\texttt{1}}; + \node at \punkt{4.5}{-1.5} {\texttt{1}}; + \node at \punkt{5.5}{-1.5} {\texttt{1}}; + \node at \punkt{6.5}{-1.5} {\texttt{0}}; + \node at \punkt{7.5}{-1.5} {\texttt{1}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-11cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{0}}; + \node at \punkt{0.5}{0.5} {\texttt{0}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{1}}; + \node at \punkt{4.5}{0.5} {\texttt{1}}; + \node at \punkt{5.5}{0.5} {\texttt{0}}; + \node at \punkt{6.5}{0.5} {\texttt{1}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + +% \draw[->,color=darkgreen] +% \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; +% \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{0}}; + \node at \punkt{1.5}{-1.5} {\texttt{0}}; + \node at \punkt{2.5}{-1.5} {\texttt{1}}; + \node at \punkt{3.5}{-1.5} {\texttt{1}}; + \node at \punkt{4.5}{-1.5} {\texttt{1}}; + \node at \punkt{5.5}{-1.5} {\texttt{0}}; + \node at \punkt{6.5}{-1.5} {\texttt{1}}; + \node at \punkt{7.5}{-1.5} {\texttt{0}}; + + \pfeile +\end{scope} + +\begin{scope}[yshift=-13cm] + \draw[<-] \punkt{8.2}{-1.3} arc (-30:30:1.8); + \node at \punkt{9.3}{0.6} {$\mathstrut\cdot X$}; + \fill[color=blue!20] \punkt{-1}{0} rectangle \punkt{0}{1}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node[color=darkgreen] at \punkt{-0.5}{0.5} {\texttt{0}}; + \node at \punkt{0.5}{0.5} {\texttt{0}}; + \node at \punkt{1.5}{0.5} {\texttt{1}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{1}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{0}}; + +% \draw[->,color=darkgreen] +% \punkt{-0.5}{0.1} -- \punkt{-0.5}{-0.5} -- \punkt{3.1}{-0.5}; +% \node[color=darkgreen] at \punkt{3.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{4.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{6.5}{-0.5} {\texttt{1}}; +% \node[color=darkgreen] at \punkt{7.5}{-0.5} {\texttt{1}}; + \node[color=darkgreen] at \punkt{4}{-0.5} {$\|$}; + + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + \node at \punkt{0.5}{-1.5} {\texttt{0}}; + \node at \punkt{1.5}{-1.5} {\texttt{1}}; + \node at \punkt{2.5}{-1.5} {\texttt{1}}; + \node at \punkt{3.5}{-1.5} {\texttt{0}}; + \node at \punkt{4.5}{-1.5} {\texttt{1}}; + \node at \punkt{5.5}{-1.5} {\texttt{1}}; + \node at \punkt{6.5}{-1.5} {\texttt{1}}; + \node at \punkt{7.5}{-1.5} {\texttt{1}}; + +% \pfeile +\end{scope} + +\begin{scope}[xshift=9cm] + +\begin{scope}[yshift=0.1cm] + \draw[->] \punkt{-11.8}{0.5} -- \punkt{-0.1}{0.5}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \draw \punkt{4}{-0.1} -- \punkt{4}{-3}; + \node at \punkt{0.5}{0.5} {\texttt{1}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{0}}; + \node at \punkt{3.5}{0.5} {\texttt{1}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{1}}; +\end{scope} + +\def\summation#1#2#3#4#5#6#7#8{ + \draw[->] \punkt{4}{2.3} -- \punkt{4}{1}; + + \draw[->] \punkt{-11.8}{0.5} -- \punkt{3.5}{0.5}; + + \draw \punkt{4}{0.5} circle[radius=0.2]; + \draw \punkt{4}{0.20} -- \punkt{4}{0.80}; + \draw \punkt{3.7}{0.5} -- \punkt{4.3}{0.5}; + + \draw[->] \punkt{4}{-0.05} -- \punkt{4}{-0.95}; + \draw \punkt{0}{-2} rectangle \punkt{8}{-1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{-2} -- \punkt{\x}{-1}; + } + + \node at \punkt{0.5}{-1.5} {\texttt{#1}}; + \node at \punkt{1.5}{-1.5} {\texttt{#2}}; + \node at \punkt{2.5}{-1.5} {\texttt{#3}}; + \node at \punkt{3.5}{-1.5} {\texttt{#4}}; + \node at \punkt{4.5}{-1.5} {\texttt{#5}}; + \node at \punkt{5.5}{-1.5} {\texttt{#6}}; + \node at \punkt{6.5}{-1.5} {\texttt{#7}}; + \node at \punkt{7.5}{-1.5} {\texttt{#8}}; +} + +\begin{scope}[yshift=-1.9cm] + \summation{1}{0}{0}{1}{0}{1}{0}{1} +\end{scope} + +\begin{scope}[yshift=-3.9cm] + \summation{1}{1}{1}{1}{0}{1}{1}{1} +\end{scope} + +\begin{scope}[yshift=-5.9cm] + \summation{1}{1}{1}{1}{0}{1}{1}{1} +\end{scope} + +\begin{scope}[yshift=-7.9cm] + \summation{0}{1}{1}{0}{0}{1}{0}{0} +\end{scope} + +\begin{scope}[yshift=-9.9cm] + \summation{0}{1}{0}{1}{1}{0}{0}{1} +\end{scope} + +\begin{scope}[yshift=-11.9cm] + \summation{0}{1}{0}{1}{1}{0}{0}{1} +\end{scope} + +\begin{scope}[yshift=-13.9cm] + \summation{0}{0}{1}{1}{0}{1}{1}{0} + \node at \punkt{0}{-1.5} [left] {$p(X)\cdot q(X)=\mathstrut$}; +\end{scope} + +\end{scope} + +\begin{scope}[xshift=5cm] + +\begin{scope}[yshift=2cm] + \node at \punkt{0}{0.5} [left] {$q(X)=\mathstrut$}; + \draw \punkt{0}{0} rectangle \punkt{8}{1}; + \foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; + } + \node at \punkt{0.5}{0.5} {\texttt{1}}; + \node at \punkt{1.5}{0.5} {\texttt{0}}; + \node at \punkt{2.5}{0.5} {\texttt{1}}; + \node at \punkt{3.5}{0.5} {\texttt{1}}; + \node at \punkt{4.5}{0.5} {\texttt{0}}; + \node at \punkt{5.5}{0.5} {\texttt{1}}; + \node at \punkt{6.5}{0.5} {\texttt{0}}; + \node at \punkt{7.5}{0.5} {\texttt{1}}; + + \draw[->] \punkt{7.5}{-0.1} -- ({7.5*\s},{-1.3}); + \node at ({7.5*\s},{-1.2}) [below] {$\mathstrut\cdot\texttt{1}$}; + + \def\y{1.2} + + \draw[->] \punkt{6.5}{-0.1} -- ({6.5*\s},{-1*2-\y-0.1}); + \node at ({6.5*\s},{-1*2-\y}) [below] {$\mathstrut\cdot\texttt{0}$}; + + \draw[->] \punkt{5.5}{-0.1} -- ({5.5*\s},{-2*2-\y-0.1}); + \node at ({5.5*\s},{-2*2-\y}) [below] {$\mathstrut\cdot\texttt{1}$}; + + \draw[->] \punkt{4.5}{-0.1} -- ({4.5*\s},{-3*2-\y-0.1}); + \node at ({4.5*\s},{-3*2-\y}) [below] {$\mathstrut\cdot\texttt{0}$}; + + \draw[->] \punkt{3.5}{-0.1} -- ({3.5*\s},{-4*2-\y-0.1}); + \node at ({3.5*\s},{-4*2-\y}) [below] {$\mathstrut\cdot\texttt{1}$}; + + \draw[->] \punkt{2.5}{-0.1} -- ({2.5*\s},{-5*2-\y-0.1}); + \node at ({2.5*\s},{-5*2-\y}) [below] {$\mathstrut\cdot\texttt{1}$}; + + \draw[->] \punkt{1.5}{-0.1} -- ({1.5*\s},{-6*2-\y-0.1}); + \node at ({1.5*\s},{-6*2-\y}) [below] {$\mathstrut\cdot\texttt{0}$}; + + \draw[->] \punkt{0.5}{-0.1} -- ({0.5*\s},{-7*2-\y-0.1}); + \node at ({0.5*\s},{-7*2-\y}) [below] {$\mathstrut\cdot\texttt{1}$}; +\end{scope} + +\end{scope} + +\end{tikzpicture} +\end{document} + diff --git a/buch/chapters/90-crypto/images/schieberegister.pdf b/buch/chapters/90-crypto/images/schieberegister.pdf new file mode 100644 index 0000000..30b675b Binary files /dev/null and b/buch/chapters/90-crypto/images/schieberegister.pdf differ diff --git a/buch/chapters/90-crypto/images/schieberegister.tex b/buch/chapters/90-crypto/images/schieberegister.tex new file mode 100644 index 0000000..7c24e52 --- /dev/null +++ b/buch/chapters/90-crypto/images/schieberegister.tex @@ -0,0 +1,120 @@ +% +% schieberegister.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] + +\definecolor{darkgreen}{rgb}{0,0.6,0} + +\def\s{0.8} + +\def\punkt#1#2{({#1*\s},{#2*\s})} + +\fill[color=blue!20] \punkt{0}{0} rectangle \punkt{8}{1}; + +\node at \punkt{0.5}{1} [above] {$X^7\mathstrut$}; +\node at \punkt{3}{1} [above] {$+\mathstrut$}; +\node at \punkt{3.5}{1} [above] {$X^4\mathstrut$}; +\node at \punkt{5}{1} [above] {$+\mathstrut$}; +\node at \punkt{5.5}{1} [above] {$X^2\mathstrut$}; +\node at \punkt{7}{1} [above] {$+\mathstrut$}; +\node at \punkt{7.5}{1} [above] {$1\mathstrut$}; + +\node at \punkt{0}{1} [above left] {\llap{$p(X)=\mathstrut$}}; + +\node at \punkt{0.5}{0.5} {\texttt{1}}; +\node at \punkt{1.5}{0.5} {\texttt{0}}; +\node at \punkt{2.5}{0.5} {\texttt{0}}; +\node at \punkt{3.5}{0.5} {\texttt{1}}; +\node at \punkt{4.5}{0.5} {\texttt{0}}; +\node at \punkt{5.5}{0.5} {\texttt{1}}; +\node at \punkt{6.5}{0.5} {\texttt{0}}; +\node at \punkt{7.5}{0.5} {\texttt{1}}; + +\draw \punkt{0}{0} rectangle \punkt{8}{1}; +\foreach \x in {1,...,7}{ + \draw \punkt{\x}{0} -- \punkt{\x}{1}; +} + +\fill[color=blue!20] \punkt{-1}{-3} rectangle \punkt{7}{-2}; +\fill[color=darkgreen!20] \punkt{0}{-4} rectangle \punkt{8}{-3}; + +\node[color=darkgreen] at \punkt{-1}{-1.5} [left] + {$m(X) = X^8+X^4+X^3+X+1$}; + +\node[color=darkgreen] at \punkt{-1}{-2.7} [left] + {$\underbrace{X^4+X^3+X+1}_{}= X^8=\mathstrut$}; + +\coordinate (A) at ({-4.15*\s},{-3*\s}); +\coordinate (B) at ({0*\s},{-3.5*\s}); + +\draw[->,color=red,shorten >= 0.1cm] (A) to[out=-90,in=180] (B); +\node[color=red] at \punkt{-3.1}{-3.8} [below] {Feedback}; + +\node at \punkt{-0.5}{-2.5} {\texttt{1}}; +\node at \punkt{0.5}{-2.5} {\texttt{0}}; +\node at \punkt{1.5}{-2.5} {\texttt{0}}; +\node at \punkt{2.5}{-2.5} {\texttt{1}}; +\node at \punkt{3.5}{-2.5} {\texttt{0}}; +\node at \punkt{4.5}{-2.5} {\texttt{1}}; +\node at \punkt{5.5}{-2.5} {\texttt{0}}; +\node at \punkt{6.5}{-2.5} {\texttt{1}}; +\node at \punkt{7.5}{-2.5} {\texttt{0}}; + +\node[color=darkgreen] at \punkt{0.5}{-3.5} {\texttt{0}}; +\node[color=darkgreen] at \punkt{1.5}{-3.5} {\texttt{0}}; +\node[color=darkgreen] at \punkt{2.5}{-3.5} {\texttt{0}}; +\node[color=darkgreen] at \punkt{3.5}{-3.5} {\texttt{1}}; +\node[color=darkgreen] at \punkt{4.5}{-3.5} {\texttt{1}}; +\node[color=darkgreen] at \punkt{5.5}{-3.5} {\texttt{0}}; +\node[color=darkgreen] at \punkt{6.5}{-3.5} {\texttt{1}}; +\node[color=darkgreen] at \punkt{7.5}{-3.5} {\texttt{1}}; + +\draw \punkt{0}{-4} rectangle \punkt{8}{-2}; +\draw \punkt{0}{-3} -- \punkt{8}{-3}; +\foreach \x in {1,...,7}{ + \draw \punkt{\x}{-4} -- \punkt{\x}{-2}; +} + +\foreach \x in {0.5,1.5,...,7.5}{ + \draw[->,color=blue] \punkt{\x}{-0.1} -- \punkt{(\x-1)}{-1.9}; +} + +\draw \punkt{0}{-6} rectangle \punkt{8}{-5}; +\foreach \x in {1,...,7}{ + \draw \punkt{\x}{-6} -- \punkt{\x}{-5}; +} + +\node at \punkt{0.5}{-5.5} {\texttt{0}}; +\node at \punkt{1.5}{-5.5} {\texttt{0}}; +\node at \punkt{2.5}{-5.5} {\texttt{1}}; +\node at \punkt{3.5}{-5.5} {\texttt{1}}; +\node at \punkt{4.5}{-5.5} {\texttt{0}}; +\node at \punkt{5.5}{-5.5} {\texttt{0}}; +\node at \punkt{6.5}{-5.5} {\texttt{0}}; +\node at \punkt{7.5}{-5.5} {\texttt{1}}; + +\node at \punkt{4}{-4.5} {$\|$}; + +\node at \punkt{10.3}{-3} [left] + {$\left.\begin{matrix}\\ \\ \\ \end{matrix}\right\} + = \text{XOR}$}; + +\draw[<-,shorten >= 0.1cm, shorten <= 0.1cm] + \punkt{8.0}{-2.0} arc (-30:30:{2.0*\s}); +\node at \punkt{8.3}{-1} [right] {$\mathstrut \cdot X$}; + +\node at \punkt{8.1}{-5.5} [right] {$=X\cdot p(X)\mathstrut$}; + +\end{tikzpicture} +\end{document} + -- cgit v1.2.1 From c4446c32a0fd6e829959ca2bf84bbad211554a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 6 Apr 2021 16:40:17 +0200 Subject: add new stuff --- buch/chapters/90-crypto/images/Makefile | 9 +- buch/chapters/90-crypto/images/sbox.m | 52 +++++++ buch/chapters/90-crypto/images/sbox.pdf | Bin 0 -> 23568 bytes buch/chapters/90-crypto/images/sbox.tex | 241 +++++++++++++++++++++++++++++++ buch/chapters/90-crypto/images/shift.pdf | Bin 0 -> 1182 bytes buch/chapters/90-crypto/images/shift.tex | 30 ++++ 6 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 buch/chapters/90-crypto/images/sbox.m create mode 100644 buch/chapters/90-crypto/images/sbox.pdf create mode 100644 buch/chapters/90-crypto/images/sbox.tex create mode 100644 buch/chapters/90-crypto/images/shift.pdf create mode 100644 buch/chapters/90-crypto/images/shift.tex (limited to 'buch/chapters/90-crypto/images') 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 Binary files /dev/null and b/buch/chapters/90-crypto/images/sbox.pdf 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 Binary files /dev/null and b/buch/chapters/90-crypto/images/shift.pdf 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} + -- cgit v1.2.1 From 8c4ba3a03eb7d0169d7b7ec29fce05840518e1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Wed, 7 Apr 2021 19:59:03 +0200 Subject: add missing files --- buch/chapters/90-crypto/images/Makefile | 5 +- buch/chapters/90-crypto/images/keys.pdf | Bin 0 -> 11043 bytes buch/chapters/90-crypto/images/keys.tex | 90 ++++++++++++++++++++++++ buch/chapters/90-crypto/images/shift.pdf | Bin 1182 -> 14903 bytes buch/chapters/90-crypto/images/shift.tex | 113 +++++++++++++++++++++++++++++-- 5 files changed, 201 insertions(+), 7 deletions(-) create mode 100644 buch/chapters/90-crypto/images/keys.pdf create mode 100644 buch/chapters/90-crypto/images/keys.tex (limited to 'buch/chapters/90-crypto/images') diff --git a/buch/chapters/90-crypto/images/Makefile b/buch/chapters/90-crypto/images/Makefile index 7d2f375..f4bed14 100644 --- a/buch/chapters/90-crypto/images/Makefile +++ b/buch/chapters/90-crypto/images/Makefile @@ -4,7 +4,7 @@ # (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule # all: dh.pdf elliptic.pdf schieberegister.pdf multiplikation.pdf sbox.pdf \ - shift.pdf + shift.pdf keys.pdf dh.pdf: dh.tex pdflatex dh.tex @@ -24,3 +24,6 @@ sbox.pdf: sbox.tex shift.pdf: shift.tex pdflatex shift.tex +keys.pdf: keys.tex + pdflatex keys.tex + diff --git a/buch/chapters/90-crypto/images/keys.pdf b/buch/chapters/90-crypto/images/keys.pdf new file mode 100644 index 0000000..99f991f Binary files /dev/null and b/buch/chapters/90-crypto/images/keys.pdf differ diff --git a/buch/chapters/90-crypto/images/keys.tex b/buch/chapters/90-crypto/images/keys.tex new file mode 100644 index 0000000..68920a5 --- /dev/null +++ b/buch/chapters/90-crypto/images/keys.tex @@ -0,0 +1,90 @@ +% +% keys.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] +\definecolor{darkgreen}{rgb}{0,0.6,0} +\def\s{0.5} +\def\punkt#1#2{({(#1)*\s},{(#2)*\s})} +\def\wort#1#2#3{ + \fill[color=#3] \punkt{#1}{#2} rectangle \punkt{(#1+1)}{(#2+4)}; + \draw \punkt{#1}{#2} rectangle \punkt{(#1+1)}{(#2+4)}; +} + +\def\summe{ + \foreach \x in {0,3,...,21}{ + \draw[->] \punkt{(\x+0.5)}{-0.1} -- \punkt{(\x+0.5)}{-2.1}; + \draw \punkt{(\x+0.5)}{-2.5} circle[radius={0.3*\s}]; + \draw \punkt{(\x+0.5-0.2)}{-2.5} + -- + \punkt{(\x+0.5+0.2)}{-2.5}; + \draw \punkt{(\x+0.5)}{-2.5+0.2} + -- + \punkt{(\x+0.5)}{-2.5-0.2}; + \draw[->] \punkt{(\x+0.5)}{-2.9} -- \punkt{(\x+0.5)}{-4.9}; + } + \foreach \x in {0,3,...,18}{ + \draw[->] \punkt{(\x+1)}{-7} -- \punkt{(\x+2)}{-7} + -- \punkt{(\x+2)}{-2.5} -- \punkt{(\x+3.1)}{-2.5}; + } + \fill[color=white] + \punkt{(9+1.5)}{-5.25} + rectangle + \punkt{(9+2.5)}{-4.25}; + \draw + \punkt{(9+1.5)}{-5.25} + rectangle + \punkt{(9+2.5)}{-4.25}; + \node at \punkt{(9+2)}{-4.75} {$S$}; +} +\def\blocks#1{ + \foreach \x in {0,3,...,21}{ + \wort{\x}{0}{#1} + } +} + +\def\schlange{ + \draw[->] \punkt{22.1}{2} -- \punkt{23}{2} + -- \punkt{23}{-1.0} -- \punkt{-3}{-1.0} + -- \punkt{-3}{-8} -- \punkt{-1}{-8} -- \punkt{-1}{-2.5} + -- \punkt{0.1}{-2.5}; + ; + \fill[color=white] \punkt{-3.5}{-1.5} rectangle \punkt{-2.5}{-3.5}; + \draw \punkt{-3.5}{-1.5} rectangle \punkt{-2.5}{-3.5}; + \node at \punkt{-3}{-2.5} {$\pi$}; + \fill[color=white] \punkt{-3.5}{-3.5} rectangle \punkt{-2.5}{-5.5}; + \draw \punkt{-3.5}{-3.5} rectangle \punkt{-2.5}{-5.5}; + \node at \punkt{-3}{-4.5} {$S$}; + \fill[color=white] \punkt{-3.5}{-5.5} rectangle \punkt{-2.5}{-7.5}; + \draw \punkt{-3.5}{-5.5} rectangle \punkt{-2.5}{-7.5}; + \node at \punkt{-3}{-6.5} {$r$}; +} + +\begin{scope} + \blocks{blue!20} + \schlange + \summe +\end{scope} + +\begin{scope}[yshift=-4.5cm] + \blocks{darkgreen!20} + \summe +\end{scope} + +\begin{scope}[yshift=-9cm] + \blocks{darkgreen!20} +\end{scope} + +\end{tikzpicture} +\end{document} + diff --git a/buch/chapters/90-crypto/images/shift.pdf b/buch/chapters/90-crypto/images/shift.pdf index bc229a1..b007378 100644 Binary files a/buch/chapters/90-crypto/images/shift.pdf and b/buch/chapters/90-crypto/images/shift.pdf differ diff --git a/buch/chapters/90-crypto/images/shift.tex b/buch/chapters/90-crypto/images/shift.tex index 5cfdd92..bcdf819 100644 --- a/buch/chapters/90-crypto/images/shift.tex +++ b/buch/chapters/90-crypto/images/shift.tex @@ -14,17 +14,118 @@ \def\skala{1} \begin{tikzpicture}[>=latex,thick,scale=\skala] -\def\s{1} +\definecolor{darkgreen}{rgb}{0,0.6,0} + +\def\s{0.8} \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}; +\def\feld#1#2#3#4{ + \fill[color=#3] \punkt{#1}{#2} rectangle \punkt{(#1+1)}{(#2+1)}; + \node at \punkt{(#1+0.5)}{(#2+0.5)} {$\mathstrut #4$}; } -\foreach \y in {1,...,3}{ - \draw \punkt{0}{\y} -- \punkt{8}{\y}; +\def\gitter{ + \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}; + } } +\begin{scope} + \feld{0}{3}{red!20}{b_{0}} + \feld{0}{2}{red!20}{b_{1}} + \feld{0}{1}{red!20}{b_{2}} + \feld{0}{0}{red!20}{b_{3}} + + \feld{1}{3}{red!10}{b_{4}} + \feld{1}{2}{red!10}{b_{5}} + \feld{1}{1}{red!10}{b_{6}} + \feld{1}{0}{red!10}{b_{7}} + + \feld{2}{3}{yellow!20}{b_{8}} + \feld{2}{2}{yellow!20}{b_{9}} + \feld{2}{1}{yellow!20}{b_{10}} + \feld{2}{0}{yellow!20}{b_{11}} + + \feld{3}{3}{yellow!10}{b_{12}} + \feld{3}{2}{yellow!10}{b_{13}} + \feld{3}{1}{yellow!10}{b_{14}} + \feld{3}{0}{yellow!10}{b_{15}} + + \feld{4}{3}{darkgreen!20}{b_{16}} + \feld{4}{2}{darkgreen!20}{b_{17}} + \feld{4}{1}{darkgreen!20}{b_{18}} + \feld{4}{0}{darkgreen!20}{b_{19}} + + \feld{5}{3}{darkgreen!10}{b_{20}} + \feld{5}{2}{darkgreen!10}{b_{21}} + \feld{5}{1}{darkgreen!10}{b_{22}} + \feld{5}{0}{darkgreen!10}{b_{23}} + + \feld{6}{3}{blue!20}{b_{24}} + \feld{6}{2}{blue!20}{b_{25}} + \feld{6}{1}{blue!20}{b_{26}} + \feld{6}{0}{blue!20}{b_{27}} + + \feld{7}{3}{blue!10}{b_{28}} + \feld{7}{2}{blue!10}{b_{29}} + \feld{7}{1}{blue!10}{b_{30}} + \feld{7}{0}{blue!10}{b_{31}} + + \gitter + + \draw[->] \punkt{8.1}{2} -- \punkt{9.3}{2}; +\end{scope} + + +\begin{scope}[xshift=7.5cm] + + \feld{0}{3}{red!20}{b_{0}} + \feld{1}{2}{red!20}{b_{1}} + \feld{2}{1}{red!20}{b_{2}} + \feld{3}{0}{red!20}{b_{3}} + + \feld{1}{3}{red!10}{b_{4}} + \feld{2}{2}{red!10}{b_{5}} + \feld{3}{1}{red!10}{b_{6}} + \feld{4}{0}{red!10}{b_{7}} + + \feld{2}{3}{yellow!20}{b_{8}} + \feld{3}{2}{yellow!20}{b_{9}} + \feld{4}{1}{yellow!20}{b_{10}} + \feld{5}{0}{yellow!20}{b_{11}} + + \feld{3}{3}{yellow!10}{b_{12}} + \feld{4}{2}{yellow!10}{b_{13}} + \feld{5}{1}{yellow!10}{b_{14}} + \feld{6}{0}{yellow!10}{b_{15}} + + \feld{4}{3}{darkgreen!20}{b_{16}} + \feld{5}{2}{darkgreen!20}{b_{17}} + \feld{6}{1}{darkgreen!20}{b_{18}} + \feld{7}{0}{darkgreen!20}{b_{19}} + + \feld{5}{3}{darkgreen!10}{b_{20}} + \feld{6}{2}{darkgreen!10}{b_{21}} + \feld{7}{1}{darkgreen!10}{b_{22}} + \feld{0}{0}{darkgreen!10}{b_{23}} + + \feld{6}{3}{blue!20}{b_{24}} + \feld{7}{2}{blue!20}{b_{25}} + \feld{0}{1}{blue!20}{b_{26}} + \feld{1}{0}{blue!20}{b_{27}} + + \feld{7}{3}{blue!10}{b_{28}} + \feld{0}{2}{blue!10}{b_{29}} + \feld{1}{1}{blue!10}{b_{30}} + \feld{2}{0}{blue!10}{b_{31}} + + \gitter + +\end{scope} + \end{tikzpicture} \end{document} -- cgit v1.2.1 From 48a93a731e67c99c153ceeb13ef5bb978bba3cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Wed, 7 Apr 2021 21:26:53 +0200 Subject: add new stuff about AES --- buch/chapters/90-crypto/images/dh.pdf | Bin 27689 -> 27689 bytes buch/chapters/90-crypto/images/elliptic.pdf | Bin 21278 -> 21278 bytes buch/chapters/90-crypto/images/keys.pdf | Bin 11043 -> 22934 bytes buch/chapters/90-crypto/images/keys.tex | 59 +++++++++++++++++++++------- 4 files changed, 45 insertions(+), 14 deletions(-) (limited to 'buch/chapters/90-crypto/images') diff --git a/buch/chapters/90-crypto/images/dh.pdf b/buch/chapters/90-crypto/images/dh.pdf index 67b95a5..eede4bd 100644 Binary files a/buch/chapters/90-crypto/images/dh.pdf and b/buch/chapters/90-crypto/images/dh.pdf differ diff --git a/buch/chapters/90-crypto/images/elliptic.pdf b/buch/chapters/90-crypto/images/elliptic.pdf index d408f1e..e58639f 100644 Binary files a/buch/chapters/90-crypto/images/elliptic.pdf and b/buch/chapters/90-crypto/images/elliptic.pdf differ diff --git a/buch/chapters/90-crypto/images/keys.pdf b/buch/chapters/90-crypto/images/keys.pdf index 99f991f..2c6b4b9 100644 Binary files a/buch/chapters/90-crypto/images/keys.pdf and b/buch/chapters/90-crypto/images/keys.pdf differ diff --git a/buch/chapters/90-crypto/images/keys.tex b/buch/chapters/90-crypto/images/keys.tex index 68920a5..d556b7c 100644 --- a/buch/chapters/90-crypto/images/keys.tex +++ b/buch/chapters/90-crypto/images/keys.tex @@ -34,55 +34,86 @@ \draw[->] \punkt{(\x+0.5)}{-2.9} -- \punkt{(\x+0.5)}{-4.9}; } \foreach \x in {0,3,...,18}{ - \draw[->] \punkt{(\x+1)}{-7} -- \punkt{(\x+2)}{-7} + \draw[->] \punkt{(\x+1.1)}{-7} -- \punkt{(\x+2)}{-7} -- \punkt{(\x+2)}{-2.5} -- \punkt{(\x+3.1)}{-2.5}; } \fill[color=white] - \punkt{(9+1.5)}{-5.25} + \punkt{(9+1.25)}{-5.5} rectangle - \punkt{(9+2.5)}{-4.25}; + \punkt{(9+2.75)}{-4.00}; \draw - \punkt{(9+1.5)}{-5.25} + \punkt{(9+1.25)}{-5.5} rectangle - \punkt{(9+2.5)}{-4.25}; + \punkt{(9+2.75)}{-4.00}; \node at \punkt{(9+2)}{-4.75} {$S$}; } + \def\blocks#1{ \foreach \x in {0,3,...,21}{ \wort{\x}{0}{#1} } } -\def\schlange{ +\def\schlange#1{ \draw[->] \punkt{22.1}{2} -- \punkt{23}{2} -- \punkt{23}{-1.0} -- \punkt{-3}{-1.0} -- \punkt{-3}{-8} -- \punkt{-1}{-8} -- \punkt{-1}{-2.5} -- \punkt{0.1}{-2.5}; ; - \fill[color=white] \punkt{-3.5}{-1.5} rectangle \punkt{-2.5}{-3.5}; - \draw \punkt{-3.5}{-1.5} rectangle \punkt{-2.5}{-3.5}; + \fill[color=white] \punkt{-3.75}{-1.75} rectangle \punkt{-2.25}{-3.25}; + \draw \punkt{-3.75}{-1.75} rectangle \punkt{-2.25}{-3.25}; \node at \punkt{-3}{-2.5} {$\pi$}; - \fill[color=white] \punkt{-3.5}{-3.5} rectangle \punkt{-2.5}{-5.5}; - \draw \punkt{-3.5}{-3.5} rectangle \punkt{-2.5}{-5.5}; + + \fill[color=white] \punkt{-3.75}{-3.75} rectangle \punkt{-2.25}{-5.25}; + \draw \punkt{-3.75}{-3.75} rectangle \punkt{-2.25}{-5.25}; \node at \punkt{-3}{-4.5} {$S$}; - \fill[color=white] \punkt{-3.5}{-5.5} rectangle \punkt{-2.5}{-7.5}; - \draw \punkt{-3.5}{-5.5} rectangle \punkt{-2.5}{-7.5}; - \node at \punkt{-3}{-6.5} {$r$}; + + \fill[color=white] \punkt{-3.75}{-5.75} rectangle \punkt{-2.25}{-7.25}; + \draw \punkt{-3.75}{-5.75} rectangle \punkt{-2.25}{-7.25}; + \node at \punkt{-3}{-6.5} {$r_{#1}$}; } \begin{scope} \blocks{blue!20} - \schlange + \foreach \x in {0,...,7}{ + \node at \punkt{(3*\x+0.5)}{2} {$K_\x$}; + } + \schlange{1} \summe \end{scope} \begin{scope}[yshift=-4.5cm] \blocks{darkgreen!20} + \foreach \x in {8,...,15}{ + \node at \punkt{(3*(\x-8)+0.5)}{2} {$K_{\x}$}; + } + \schlange{2} \summe \end{scope} \begin{scope}[yshift=-9cm] \blocks{darkgreen!20} + \foreach \x in {16,...,23}{ + \node at \punkt{(3*(\x-16)+0.5)}{2} {$K_{\x}$}; + } + \schlange{3} + \summe +\end{scope} + +\begin{scope}[yshift=-13.5cm] + \blocks{darkgreen!20} + \foreach \x in {24,...,31}{ + \node at \punkt{(3*(\x-24)+0.5)}{2} {$K_{\x}$}; + } + \foreach \x in {0,3,...,21}{ + \draw[->,color=gray] + \punkt{(\x+0.5)}{-0.1} -- \punkt{(\x+0.5)}{-2.1}; + \node[color=gray] at \punkt{(\x+0.5)}{-2.1} [below] {$\vdots$}; + } + \draw[color=gray] \punkt{22.1}{2} -- \punkt{23}{2} + -- \punkt{23}{-1.0} -- \punkt{-3}{-1.0} + -- \punkt{-3}{-2.1}; + \node[color=gray] at \punkt{-3}{-2.1} [below] {$\vdots$}; \end{scope} \end{tikzpicture} -- cgit v1.2.1