Are there any packages to draw a chart which illustrates the processing of several 32/64 bit variables via bit-wise operations (on byte level), similar to the chart below? If not, maybe any recommendations how to achieve this type chart? Thank's in advance!

enter image description here

  • Not as such, but a TikZ matrix should be relatively easy to set up. – John Kormylo Mar 8 '18 at 20:49
  • Welcome to TeX.SX! The short answer is that, yes, this is possible but I have to warn you that questions of the form "Please draw this for me" that show no effort on the part of OP, often don't get answered. You will get more help if you post some code showing what you have tried and give a minimal working example. A quick search on TeX.SX for drawing functions (with tikz or pstricks) will give you an idea of where to start from. – Andrew Mar 9 '18 at 9:33

TikZ and some time to procrastinate can help you.

\usetikzlibrary{positioning, arrows.meta, matrix, backgrounds, shapes.misc}

    word/.style={matrix of nodes,
        inner sep=0pt,
        nodes={draw, minimum height=6mm, minimum width=3mm},
        column sep=-\pgflinewidth, nodes in empty cells}

\matrix[word] (opool1)
\draw[thick] (opool1.north west) rectangle (opool1.south east);  
\draw[ultra thick] (opool1.north) -- (opool1.south); 

\node[rounded rectangle, below=1cm of opool1, draw] (sha1) {Sha 1};

\matrix[word, below =5mm of sha1] (hash1) {&&&&\\};
\draw[thick] (hash1.north west) rectangle (hash1.south east); 

\node[rounded rectangle, below=5mm of hash1, draw] (mix) {mixing};

\matrix[word, below=5mm of mix] (opool2)
\draw[thick] (opool2.north west) rectangle (opool2.south east); 
\begin{scope}[on background layer]
\fill[blue!50] (opool2-1-1.north west) rectangle (opool2-1-13.south east);
\fill[blue!50] (opool2-1-26.north west) rectangle (opool2-1-32.south east);

\matrix[word, below=5mm of opool2] (opool3)
\draw[thick] (opool3.north west) rectangle (opool3.south east); 
\begin{scope}[on background layer]
\fill[violet!50] (opool3-1-11.north west) rectangle (opool3-1-26.south east);

\node[rounded rectangle, below=8mm of opool3, draw] (sha2) {Sha 1};

\matrix[word, below =5mm of sha2] (hash2) {&&&&\\};
\draw[thick] (hash2.north west) rectangle (hash2.south east); 
\draw[ultra thick] (hash2.north) -- (hash2.south); 

\node[rounded rectangle, below=5mm of hash2, draw, minimum width=15mm] (fold) {fold};

\node[draw, thick, minimum width=7mm, minimum height=6mm, below=5mm of fold] (end) {};

\draw[<-](sha1.north)--++(90:4mm)--(opool1.south west); 
\draw[<-](sha1.north)--++(90:4mm)--(opool1.south east); 
\draw[->](opool3-1-18.south east)--++(-90:4mm)-| coordinate[pos=.25] (aux) (sha2);
\draw (aux)--+(135:2mm)--+(-45:2mm);
\draw[->]([yshift=1mm]opool2-1-13.north west)--([yshift=1mm]opool2.north west);
\draw[->]([yshift=1mm]opool2.north east)--([yshift=1mm]opool2-1-27.north west);

\node[above=1mm of opool1-1-8.north east] {16 32-bit words};
\node[above=1mm of opool1-1-24.north east] {16 32-bit words};
\node[left=4mm of opool1] (lo1) {output pool};
\node[left=0mm of lo1.east|-hash1] {5-word hash};
\node[right=2mm of mix.east] {5 words = 20 bytes};
\node[left=0mm of lo1.east|-opool2] {output pool};
\node[left=0mm of lo1.east|-opool3] {output pool};
\node[right=5mm of aux] {16 words};
\node[left=0mm of lo1.east|-hash2] {5-word hash};
\node[left=0mm of lo1.east|-end] {10-byte output};

%side labels
\draw ([shift={(1mm,1mm)}]opool1.north east)--++(0:3mm)|-([shift={(1mm,-1mm)}]opool2.south east) node[pos=.25, rotate=270, right=1mm, anchor=south]{feedback phase}; 
\coordinate (aux3) at ([yshift=-1mm]end.south);
\draw ([shift={(1mm,1mm)}]opool3.north east)--++(0:3mm) coordinate(aux2)--(aux2|-aux3) node[midway, rotate=270, right=1mm, anchor=south]{extraction phase}--++(180:3mm); 

%red marks
\begin{scope}[>={Turned Square[length=2mm]}, thick, red]
\draw[<-] (opool1-1-13.north)--++(90:3mm);
\draw[<-] (opool2-1-14.north)--++(90:3mm);
\draw[<-] (opool2-1-26.north)--++(90:3mm);
\draw[<-] (opool3-1-26.north)--++(90:3mm);
\draw[<-] ([shift={(15mm,5mm)}]end.east)--++(90:3mm) coordinate (aux4);
\node[black, right=2mm of aux4, align=left] (aux5) {position of last\\ added byte};
\draw[black] (aux5.north east) rectangle ([xshift=-5mm]aux5.south west);

enter image description here

  • Indeed terrific! Well yes, some kind of procrastination implied :). Thanks a lot Ignasi. – OliverJL Mar 9 '18 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.