diff options
-rw-r--r-- | buch/chapters/90-crypto/aes.tex | 6 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/Makefile | 5 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/keys.pdf | bin | 0 -> 11043 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/keys.tex | 90 | ||||
-rw-r--r-- | buch/chapters/90-crypto/images/shift.pdf | bin | 1182 -> 14903 bytes | |||
-rw-r--r-- | buch/chapters/90-crypto/images/shift.tex | 113 |
6 files changed, 207 insertions, 7 deletions
diff --git a/buch/chapters/90-crypto/aes.tex b/buch/chapters/90-crypto/aes.tex index 4df2e8d..968b2c6 100644 --- a/buch/chapters/90-crypto/aes.tex +++ b/buch/chapters/90-crypto/aes.tex @@ -160,6 +160,12 @@ für eine Blocklänge von 256\,Bits. \subsubsection{Zeilenshift} +\begin{figure} +\centering +\includegraphics[width=\textwidth]{chapters/90-crypto/images/shift.pdf} +\caption{Zeilenshift in einem Block von 256 bits +\label{buch:crypto:fig:shift}} +\end{figure} Die Verschlüsselung muss sicherstellen, dass die Bytes des Blockes untereinander gut gemischt werden. Die bisher beschriebenen Operationen operieren immer nur auf einzelnen 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 Binary files differnew file mode 100644 index 0000000..99f991f --- /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..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 Binary files differindex bc229a1..b007378 100644 --- a/buch/chapters/90-crypto/images/shift.pdf +++ 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 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} |