Преглед изворни кода

added ECB mode encryption diagram

Martin Thoma пре 12 година
родитељ
комит
5ca32bfafc

BIN
tikz/ECB-Mode-Encryption/ECB-Mode-Encryption.png


+ 29 - 0
tikz/ECB-Mode-Encryption/ECB-Mode-Encryption.tex

@@ -0,0 +1,29 @@
+\documentclass{article}
+\usepackage[pdftex,active,tightpage]{preview}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+
+\begin{document}
+\begin{preview}
+\tikzstyle{vertex}=[draw,fill=black!15,circle,minimum size=20pt,inner sep=0pt]
+\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)*2}) {$M_\nr$};
+        \node (C\nr) at (4,{(\n-\nr)*2}) {$C_\nr$};
+        \node (E\nr)[encrypt] at (2,{(\n-\nr)*2}) {$E$};
+        \node (K\nr) at (2,{(\n-\nr)*2+1}) {$K$};
+
+        \draw[->,very thick] (M\nr) -- (E\nr);
+        \draw[->,very thick] (K\nr) -- (E\nr);
+        \draw[->,very thick] (E\nr) -- (C\nr);
+    }
+
+   \node (Mx) at (0,-1) {$\vdots$};
+   \node (Ex) at (2,-1) {$\vdots$};
+   \node (Cx) at (4,-1) {$\vdots$};
+\end{tikzpicture}
+\end{preview}
+\end{document}

+ 35 - 0
tikz/ECB-Mode-Encryption/Makefile

@@ -0,0 +1,35 @@
+SOURCE = ECB-Mode-Encryption
+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

+ 3 - 0
tikz/ECB-Mode-Encryption/Readme.md

@@ -0,0 +1,3 @@
+Compiled example
+----------------
+![Example](ECB-Mode-Encryption.png)