aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/90-crypto/images/schieberegister.tex
blob: 7c24e526ddaad79277cb28a967915b4043812f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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}