You might be interested in TikZ for Cryptographers:
PGF/TikZ is a tandem of languages for producing vector graphics from a geometric/algebraic description. PGF is a lower-level language, while TikZ is a set of higher-level macros that use PGF. The top-level PGF and TikZ commands are invoked as TeX macros. Together with the LaTeX language, it is the most efficient way to write research papers.
Here is an example of a substitution permutation network diagram that was drawn with it:

And here is the source that created it:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{crypto.symbols}
\usetikzlibrary {positioning}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
%% Subkey XORs
\foreach \z in {0,...,15} {
\node[XOR, scale=0.8] (xor\z) at ($\z*(0.75em, 0)$) {};
\node[XOR, scale=0.8] (xorr\z) at ($\z*(0.75em, 0)+(0,-9em)$) {};
}
%% Nodes positions
\foreach \z in {0,...,15} {
\node (i\z) [above = 0.75em of xor\z] {};
\node (o\z) [below = 2.5em of xor\z] {};
\node (ii\z) [above = 0.25em of xorr\z] {};
\node (oo\z) [below = 3em of xorr\z] {};
\node (t\z) [below = 4em of oo\z] {};
\draw[thick] (i\z) -- (xor\z);
}
%% Permutation layer
\foreach \z [evaluate=\z as \zz using {int(mod(11*\z,15))}] in {0,...,14} {
\draw[thick] (xor\z) -- (o\z.center) -- (ii\zz.center) -- (xorr\zz) -- (oo\zz);
\draw[thick] (oo\z.north) -- (t\zz.south) -- +(0,-0.5em);
}
\draw[thick] (xor15) -- (o15.center) -- (ii15.center) -- (xorr15) -- (oo15);
\draw[thick] (oo15.north) -- (t15.south) -- +(0,-0.5em);
%% SBoxes
\foreach \z in {0,...,3} {
\node[draw,thick,minimum width=2.75em,minimum height=2em,fill=white] (p4) at ($\z*(3em,0) + (1.1em,-2em)$) {$S$};
\node[draw,thick,minimum width=2.75em,minimum height=2em,fill=white] (p4) at ($\z*(3em,0) + (1.1em,-11em)$) {$S$};
}
\node[left = 0em of xor0] {$k_{1}$};
\node[left = 0em of xorr0] {$k_{2}$};
\end{tikzpicture}
\end{document}