diff options
author | Andreas Müller <andreas.mueller@ost.ch> | 2021-06-14 07:26:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-14 07:26:10 +0200 |
commit | 114633b43a0f1ebedbc5dfd85f75ede9841f26fd (patch) | |
tree | 18e61c7d69883a1c9b69098b7d36856abaed5c1e /buch/chapters/90-crypto/images | |
parent | Delete buch.pdf (diff) | |
parent | Fix references.bib (diff) | |
download | SeminarMatrizen-114633b43a0f1ebedbc5dfd85f75ede9841f26fd.tar.gz SeminarMatrizen-114633b43a0f1ebedbc5dfd85f75ede9841f26fd.zip |
Merge branch 'master' into master
Diffstat (limited to '')
-rw-r--r-- | buch/chapters/90-crypto/images/Makefile | 18 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/dh.pdf | bin | 27689 -> 27689 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/elliptic.pdf | bin | 21278 -> 21278 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/keys.pdf | bin | 0 -> 22934 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/keys.tex | 121 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/multiplikation.pdf | bin | 0 -> 25263 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/multiplikation.tex | 464 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/sbox.m | 52 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/sbox.pdf | bin | 0 -> 23568 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/sbox.tex | 241 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/schieberegister.pdf | bin | 0 -> 28254 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/schieberegister.tex | 120 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/shift.pdf | bin | 0 -> 14903 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/shift.tex | 131 |
14 files changed, 1146 insertions, 1 deletions
diff --git a/buch/chapters/90-crypto/images/Makefile b/buch/chapters/90-crypto/images/Makefile index 9480163..f4bed14 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 +all: dh.pdf elliptic.pdf schieberegister.pdf multiplikation.pdf sbox.pdf \ + shift.pdf keys.pdf dh.pdf: dh.tex pdflatex dh.tex @@ -11,3 +12,18 @@ 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 + +sbox.pdf: sbox.tex + pdflatex sbox.tex + +shift.pdf: shift.tex + pdflatex shift.tex + +keys.pdf: keys.tex + pdflatex keys.tex + diff --git a/buch/chapters/90-crypto/images/dh.pdf b/buch/chapters/90-crypto/images/dh.pdf Binary files differindex 67b95a5..eede4bd 100644 --- a/buch/chapters/90-crypto/images/dh.pdf +++ b/buch/chapters/90-crypto/images/dh.pdf diff --git a/buch/chapters/90-crypto/images/elliptic.pdf b/buch/chapters/90-crypto/images/elliptic.pdf Binary files differindex d408f1e..e58639f 100644 --- a/buch/chapters/90-crypto/images/elliptic.pdf +++ b/buch/chapters/90-crypto/images/elliptic.pdf diff --git a/buch/chapters/90-crypto/images/keys.pdf b/buch/chapters/90-crypto/images/keys.pdf Binary files differnew file mode 100644 index 0000000..2c6b4b9 --- /dev/null +++ b/buch/chapters/90-crypto/images/keys.pdf diff --git a/buch/chapters/90-crypto/images/keys.tex b/buch/chapters/90-crypto/images/keys.tex new file mode 100644 index 0000000..d556b7c --- /dev/null +++ b/buch/chapters/90-crypto/images/keys.tex @@ -0,0 +1,121 @@ +% +% 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.1)}{-7} -- \punkt{(\x+2)}{-7} + -- \punkt{(\x+2)}{-2.5} -- \punkt{(\x+3.1)}{-2.5}; + } + \fill[color=white] + \punkt{(9+1.25)}{-5.5} + rectangle + \punkt{(9+2.75)}{-4.00}; + \draw + \punkt{(9+1.25)}{-5.5} + rectangle + \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#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.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.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.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} + \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} +\end{document} + diff --git a/buch/chapters/90-crypto/images/multiplikation.pdf b/buch/chapters/90-crypto/images/multiplikation.pdf Binary files differnew file mode 100644 index 0000000..86345b8 --- /dev/null +++ b/buch/chapters/90-crypto/images/multiplikation.pdf 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/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 Binary files differnew file mode 100644 index 0000000..7a5bdf3 --- /dev/null +++ b/buch/chapters/90-crypto/images/sbox.pdf 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/schieberegister.pdf b/buch/chapters/90-crypto/images/schieberegister.pdf Binary files differnew file mode 100644 index 0000000..30b675b --- /dev/null +++ b/buch/chapters/90-crypto/images/schieberegister.pdf 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} + diff --git a/buch/chapters/90-crypto/images/shift.pdf b/buch/chapters/90-crypto/images/shift.pdf Binary files differnew file mode 100644 index 0000000..b007378 --- /dev/null +++ b/buch/chapters/90-crypto/images/shift.pdf diff --git a/buch/chapters/90-crypto/images/shift.tex b/buch/chapters/90-crypto/images/shift.tex new file mode 100644 index 0000000..bcdf819 --- /dev/null +++ b/buch/chapters/90-crypto/images/shift.tex @@ -0,0 +1,131 @@ +% +% 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] + +\definecolor{darkgreen}{rgb}{0,0.6,0} + +\def\s{0.8} +\def\punkt#1#2{({#1*\s},{#2*\s})} + +\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$}; +} +\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} + |