mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-24 22:08:04 +02:00
added OFB-Mode-Decryption
This commit is contained in:
parent
149c8c3984
commit
4aed46f86e
4 changed files with 85 additions and 0 deletions
35
tikz/OFB-Mode-Decryption/Makefile
Normal file
35
tikz/OFB-Mode-Decryption/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
|||
SOURCE = OFB-Mode-Decryption
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
make
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
||||
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
|
||||
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
|
||||
rm $(SOURCE)2.svg
|
BIN
tikz/OFB-Mode-Decryption/OFB-Mode-Decryption.png
Normal file
BIN
tikz/OFB-Mode-Decryption/OFB-Mode-Decryption.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
47
tikz/OFB-Mode-Decryption/OFB-Mode-Decryption.tex
Normal file
47
tikz/OFB-Mode-Decryption/OFB-Mode-Decryption.tex
Normal file
|
@ -0,0 +1,47 @@
|
|||
\documentclass{article}
|
||||
\usepackage[pdftex,active,tightpage]{preview}
|
||||
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{calc}
|
||||
|
||||
\begin{document}
|
||||
\begin{preview}
|
||||
% thanks to http://tex.stackexchange.com/a/75838/5645
|
||||
\tikzset{XOR/.style={fill=black!15,draw,minimum size=13pt,circle,append after command={
|
||||
[shorten >=\pgflinewidth, shorten <=\pgflinewidth,]
|
||||
(\tikzlastnode.north) edge (\tikzlastnode.south)
|
||||
(\tikzlastnode.east) edge (\tikzlastnode.west)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\tikzstyle{encrypt}=[draw,fill=black!15,rectangle,minimum size=20pt,inner sep=0pt]
|
||||
\begin{tikzpicture}
|
||||
\newcommand{\n}{3}
|
||||
\foreach \nr in {1, ..., \n}{
|
||||
\node (M\nr) at (0,{(\n-\nr)*3}) {$C_\nr$};
|
||||
\node (x\nr)[XOR] at (2,{(\n-\nr)*3}) {};
|
||||
\node (E\nr)[encrypt] at (2,{(\n-\nr)*3+1}) {$E$};
|
||||
\node (K\nr) at (2,{(\n-\nr)*3+2}) {$K$};
|
||||
\node (C\nr) at (4,{(\n-\nr)*3}) {$M_\nr$};
|
||||
|
||||
\draw[->,very thick] (M\nr) -- (x\nr);
|
||||
\draw[->,very thick] (x\nr) -- (C\nr);
|
||||
\draw[->,very thick] (K\nr) -- (E\nr);
|
||||
\draw[->,very thick] (E\nr) -- (x\nr);
|
||||
}
|
||||
|
||||
\foreach \nr in {2, ..., \n}{
|
||||
\pgfmathtruncatemacro{\tmp}{\nr-1}
|
||||
\draw[->,very thick] (2, {(\n-\tmp)*3+0.5}) -- (1, {(\n-\tmp)*3+0.5}) -- (1, {(\n-\nr)*3+1}) -- (E\nr);
|
||||
}
|
||||
|
||||
\node (IV) at (0.5,{\n*3-2}) {$IV$};
|
||||
\draw[->, very thick] (IV) -- (E1);
|
||||
|
||||
\node (Mx) at (0,-1) {$\vdots$};
|
||||
\node (xx) at (2,-1) {$\vdots$};
|
||||
\node (Ex) at (4,-1) {$\vdots$};
|
||||
\end{tikzpicture}
|
||||
\end{preview}
|
||||
\end{document}
|
3
tikz/OFB-Mode-Decryption/Readme.md
Normal file
3
tikz/OFB-Mode-Decryption/Readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
Loading…
Add table
Add a link
Reference in a new issue