\documentclass{article}

\usepackage[english]{babel}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{xcolor}
\usepackage{color}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{alltt}
\usepackage{graphicx}
\usepackage{layout}
\usepackage{fancyhdr}
\usepackage{float}

\title{Making symmetric block cipher meta permutating again}
\author{Heinrich Elsigan}

\begin{document}

\maketitle

\tableofcontents

\pagebreak

\section{Thanks to}

\begin{figure}
\includegraphics[width=1\textwidth]{Symmetric_Cipher_Pipeline.png}
\caption{\label{fig:CipherPipeline}Cipher Pipeline}
\end{figure}

Normally, thanks to are always at the end of each paper,
but the people or organizations I benefited from while trying to make AES strong again
are more important than a simple proof of concept showing that it works, except on my
raw experimental test form.

\begin{enumerate}
    \item git:\href{https://github.com/dotnet/}{github.com/dotnet}
	\item git:\href{https://github.com/microsoft}{github.com/microsoft}
	\item \href{https://www.bouncycastle.org/}{Legion of the Bouncy Castle}, git:\href{https://github.com/bcgit}{bcgit}
    \item \href{https://www.libtom.net/}{libtom.net}, git:\href{https://github.com/libtom/libtomcrypt}{libtom/libtomcrypt}
    \item \href{https://cryptopp.com/}{cryptopp.com} git:\href{https://github.com/weidai11/cryptopp}{weidai11/cryptopp}
	\item \url{https://schneier.com/}	
	\item \url{https://git.lysator.liu.se/nettle/nettle} (real easy to read c/c++ code)
\end{enumerate}

\pagebreak

\section{Software}

Source code of PermAgainCrypt is hosted at Github.
\href{https://github.com/heinrichelsigan/PermAgainCrypt/releases/}Github releases contains compiled and linked .exe files for windows, 
but most users prefer download from a seperate download site \url{https://cqrxs.eu/}.

\subsection{Git: PermAgainCrypt minimalistic repository}
\url{https://github.com/heinrichelsigan/PermAgainCrypt/}

\subsection{Download}
Go to \url{https://cqrxs.eu/} or \url{https://io.cqrxs.eu/} and choose latest version.
You can directly go to the download area \url{https://cqrxs.eu/download/} or \url{https://io.cqrxs.eu/download/}.
Attention, version before March 2025 have a 3-fish over Aes-Engine encryption bug, because 3-fish
uses AES default block size and key length and Bouncy Castle Aes-Engine parameters. It works, but
settings AES default engine for 3-fish, isn’t so serious and please download version after March 30.

\pagebreak

\section{Different Forms}

\subsection{Documentation online en-/decrypt form}

\begin{itemize}
    \item \href{https://cqrxs.eu/net/Crypt/}{cqrxs.eu/net/Crypt}
    \item \href{https://area23.at/net/Crypt/}{area23.at/net/Crypt}
\end{itemize}

\begin{figure}
\includegraphics[width=1\textwidth]{Symmetric_Cipher_WebForm.jpg}
\caption{\label{fig:SymmetricCipherWebForm}Symmetric Cipher WebForm}
\end{figure}

\begin{enumerate}
    \item \textit{ImageButton} \textbf{Key}: When clicking key your entered key will be stored temporary in session.
    \item \textit{Textbox} \textbf{secret key}: Enter your Email address and secret key.
    \item \textit{Buton} \textbf{Clear}: Clear and reset the entire form.
    \item \textit{DropDown} \textbf{CipherMode2} with Options \textit{CBC}, \textit{CFB} and full deterministic \textit{ECB} (without IV)
    \item \textit{Hyperlink} \textbf{Help}: Show this help
    \item \textit{RadioButtonList} \textbf{KeyHashes}
Choose the hash method to hash your secret key.
    \item \textit{ImageButton} \textbf{Hash}: Clicking will hash your key and display hashed key in textbox.    
    \item \textit{TextBox} \textbf{Hashtext} (readonly): Displays your hashed key.
    \item \textit{Button} \textbf{Set Pipe}: sets symmetric cipher pipe, dependent only on your entered key
    \item \textit{Button} \textbf{Hash Pipe}: sets symmetric cipher pipe, dependent primary on calculated hash
and secondary on your entered key.
    \item \textit{DropDown} \textbf{ZipTypes} Choose encryption type (Please only GZip or Zip or None)
    \item \textit{DropDown} \textbf{CipherTypes} Choose a symmetric cipher to add it to the symmetric cipher
pipe.
    \item \textit{ImageButton} \textbf{add algo}: Clicking on will add the in c. DropDown CipherTypes
selected symmetric cipher algorithm to CipherPipe.
    \item \textit{TextBox} \textbf{CipherPipe} (readonly): Displays the current Cipher Pipe algorithms.
    \item \textit{ImageButton} \textbf{Clear Pipe}: Clicking on will clear only the entire Cipher Pipe
    \item \textit{DropDown} \textbf{EncodingTypes}: Choose the final binary to ascii encoder, default is Base64.
Beware of using uuencode in Web, because <> will be interpreted as possible html
injection.
    \item \textit{Selector} \textbf{Choose File} to upload a plain or an encrypted file to be processed
    \item \textit{Label} \textbf{Filename} displays uploaded filename or "No file choosen."
    \item \textit{Button} \textbf{Encrypt file} encrypts a plain file with cipherpipe to an encrypted file
    \item \textit{Chechbox} \textbf{encode file} if checked, performs bin2ascii encoding at the end stage of pipeline, if not checked binary data after last stage of cipherpipeline will be written.
    \item \textit{Button} \textbf{Decrypt file} decrypts an encrypted uploaded file. You must care, that the settings match to the file, when it was encrypted
    \item \textit{TextArea} \textbf{Source}: paste or enter Text here.
    \item \textit{TextArea} \textbf{Destination}: (readonly) After clicking Encrypt or Decrypt processed text will
appear in the text area.
    \item \textit{Button} \textbf{Encrypt}: Encrypts text from TextArea Source and displays encrypted text in
\textit{TextArea} \textbf{Destination}.
    \item \textit{Button} \textbf{Random Text}: Adds a short fortune to \textit{TextArea} \textbf{Source}.
    \item \textit{Button} \textbf{Decrypt}: Decrypts text in TextArea Source and display decrypted text in
TextArea Destination.
\end{enumerate}

\subsection{Documentation of WinForm}

You can also go directly to \href{https://github.com/heinrichelsigan/PermAgainCrypt/releases}{github.com/heinrichelsigan/PermAgainCrypt/releases} to download newest Gui Form x86 and x64.
\dots 
\begin{figure}
    \centering
    \includegraphics[width=0.6\linewidth]{2026-04-23_WinForm_CSharp.png}
    \caption{WinForm CSharp}
    \label{fig:WinForm_CSharp}
\end{figure}

\pagebreak 

\begin{figure}
\includegraphics[width=1\textwidth]{2026-01-25_WinForm_CSharp.png}
\caption{\label{fig:WinForm_Csharp}WinForm CSharp}
\end{figure}

\subsection{Java}

\subsubsection{Java PreRequesites JDK release date > 2018 installed}
\begin{enumerate}
    \item openjdk-21 to openjdk-26
    \item Oracle OpenJDK 26
    \item IBM Semeru 26 (AdoptOpenJDK OpenJ9)
    \item Amazon Coretto 26
    \item BellSoft Liberica JDK 26
    \item Eclipse Temurin (AdoptOpenJDK HotSpot)
    \item Alibaba Dragonwell 21.0.10
    \item GraalVM Community Edition 25.0.2
    \item JetBrains Runtime 25.0.2
    \item Microsoft OpenJDK 25.0.2	
\end{enumerate}

\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{javax_swing_JFrame_java.jpg}
    \caption{\label{fig:javax.swing.JFrame.java}javax.swing.JFrame.java}
\end{figure}

\pagebreak

\subsubsection{Java on Windows: Compile, build, launch}

Change following lines in winmake.bat depdendent on your JDK installation and bouncy-castle version:

\begin{small}
\begin{verbatim}
echo Setting bouncy-castle jar
SET BCJAR=bcprov-lts8on-2.73.10.jar
echo Setting Path and CLASSPATH
SET Path=%Path%;%USERPROFILE%\.jdks\openjdk-25\bin
SET CLASSPATH=%CLASSPATH%;%USERPROFILE%\.jdks\openjdk-25\lib
SET MYCLASSPATH=%CLASSPATH%;.\;.\%BCJAR%;.\eu\cqrxs\;.\eu\cqrxs\gui\;.\eu\cqrxs\fw\net\;.\eu\cqrxs\fw\util\;.\eu\cqrxs\fw\crypt\;.\eu\cqrxs\fw\crypt\encoding\;.\eu\cqrxs\fw\crypt\cipher\;.\eu\cqrxs\fw\crypt\hash\;
\end{verbatim}
\end{small}

run: winmake.bat
\newline which calls finally 
\begin{small}
\begin{verbatim}
java.exe -classpath %MYCLASSPATH% eu\cqrxs\gui\CqrJdFrame.java
java.exe -classpath %MYCLASSPATH% eu\cqrxs\console\CryptConsole.java
\end{verbatim}
\end{small}


\subsubsection{Java on Linux (similiar on any other Unix or unix based MacOs on Apple)}

Change Makefile dependent on your JDK installation and bouncy-castle version, then run make
\begin{small}
\begin{verbatim}
make clean; make all; make launch
\end{verbatim}
\end{small}

Optional change these lines in jmake.sh depdendent on your JDK installation and bouncy-castle version: remember: classpath seperator under unix is : and NOT semicolon ;
\begin{small}
\begin{verbatim}
echo "setting bouncy castle jar and MYCLASSPATH"
BCJAR=bcprov-lts8on-2.73.10.jar
MYCLASSPATH="$CLASSPATH:./:./$BCJAR:./eu/cqrxs/:./eu/cqrxs/gui/:./eu/cqrxs/fw/net/:./eu/cqrxs/fw/util/:./eu/cqrxs/fw/crypt/:./eu/cqrxs/fw/crypt/encoding/:./eu/cqrxs/fw/crypt/cipher/:./eu/cqrxs/fw/crypt/hash/:"
\end{verbatim}
\end{small}
run: sh jmake.sh
\newline which calls finally:
\begin{small}
\begin{verbatim}
JAVAFLAGS=--enable-native-access=ALL-UNNAMED
echo "launching eu/cqrxs/gui/CqrJdFrame.java"
java $(JAVAFLAGS) -cp $(MYCLASSPATH) eu/cqrxs/gui/CqrJdFrame.java

echo "run eu/cqrxs/console/ConsoleApp"
java $(JAVAFLAGS) -cp $(MYCLASSPATH) eu/cqrxs/console/CryptConsole.java 
\end{verbatim}
\end{small}



\subsubsection{Java is JFrame based}
\begin{itemize}
\item \url{https://docs.oracle.com/javase/8/docs/api/javax/swing/JFrame.html}
\item \url{https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/javax/swing/JFrame.java}
\end{itemize}

\pagebreak

\subsection{Simple mode - SecureCipherPipe}

In the simple mode SecureCipherPipe is used as CipherPipe. Each stage of the pipe will not be encrypted with the same secure key; furthermore, each pipe stage will be encrypted with a secure hashed key with a different hash.

\begin{figure}
    \centering
    \includegraphics[width=1\linewidth]{Simple_SecureCipherPipe.png}
    \caption{Simple SecureCipherPipe}
    \label{fig:Simple_SecureCipherPipe}
\end{figure}

WebForm for simple mode is \url{https://area23.at/net/Crypt/AesImprove.aspx} 
or  \url{https://cqrxs.eu/net/Crypt/AesImprove.aspx}

\begin{figure}
    \centering
    \includegraphics[width=0.6\linewidth]{2026-04-23_WebForm_AesPipeline_Simple.png}
    \caption{WebForm AesPipeline Simple}
    \label{fig:WebForm_AesPipeline_Simple}
\end{figure}

\dots

\pagebreak

\subsection{En-/Decryption between C\# Java in Simple mode}

We can see, that simple mode is intercompatible between java and C\#.
Here you see a text encrypted in simple mode in java
and decrypted in C\#.

\begin{figure}
    \centering
    \includegraphics[width=1\linewidth]{2026-02-25_SimpleModes_CsJava.png}
    \caption{En-/Decryption in simple mode between C\# and Java}
    \label{fig:Java2Csharp_SimpleMode}
\end{figure}

\dots

\pagebreak 

\section{Console and cmd programs}

\subsection{Windows Console}

Download the lastest Windows Console from \href{https://io.cqrxs.eu/download/EU.CqrXs.Console/}{io.cqrxs.eu/download/EU.CqrXs.Console/}

\subsubsection{Usage:  EU.CqrXs.Console.exe}
\begin{small}
\begin{verbatim}
Usage:  EU.CqrXs.Console.exe
    -i  | --inFile= | --inText={string|EnviromentVariable} | --inStd
    -k  | --key=passKey encrypt
    -H  | --Hash={Blake2xs|BCrypt|CShake|Dstu7564|Hex|MD5|RipeMD256|SCrypt|Sha256|Sha512|Whirlpool|...}
        |   default: Hex
    -z  | --zip={gzip|bzip2|zip|none}
        |   default: none
    -C  | --CipherAlgost={algo1,algo2,...}
        |   algo:
        |     Aes,AesLight,Rijndael,Des,Des3,Dstu7624,
        |       Aria,Camellia,CamelliaLight,Cast5,Cast6,
        |       BlowFish,Fish2,Fish3,
        |       Gost28147,Idea,Noekeon,
        |       RC2,RC532,RC564,RC6,
        |       Seed,SkipJack,Serpent,SM4,
        |       Tea,Tnepres,XTea,
        |       ZenMatrix,ZenMatrix2
    -e  | --encode={raw|hex16|base16|hex32|base32|hex64|base64|uu|xx}
        |   default: base64
    -D  | --Decrypt [ = Inverse_Pipe_Direction ]
    -o  | --outFile= | --outText=EnviromentVariable | --outStd
    -S  | -simpleMode
    -V  | --verbose
    -?  | --gethelp
\end{verbatim}
\end{small}


\begin{figure}
\includegraphics[width=1\textwidth]{20260217_ConsoleText.png}
\caption{\label{fig:EU.CqrXs.Console.exe}Windows EU.CqrXs.Console.exe}
\end{figure}



\subsubsection{Examples: EU.CqrXs.Console.exe}
\begin{small}
\begin{verbatim}

    EU.CqrXs.Console.exe -i=.\README.MD -e=base16 -o=.\READMD.base16
    EU.CqrXs.Console.exe -D  -i=.\READMD.base16 -e=base16 -o=.\READ_MD.txt

    EU.CqrXs.Console.exe -i=.\README.MD -k=Hallo -z=gzip  -C=BlowFish,Fish2,Fish3 
        -e=base64 -o=.\README.MD.gz.BfF.base64
    EU.CqrXs.Console.exe -D -i=.\README.MD.gz.BfF.base64 -e=base64 -C=BlowFish,Fish2,Fish3 
        -p=Hallo -z=gzip -o=.\READ_GUNZIP.txt

    EU.CqrXs.Console.exe -i=.\README.MD -z=bz -k=heinrichelsigan.area23.at 
        -H=Whirlpool -e=hex32 -o=.\README.MD.Whirlpool.bz.Hex32
    EU.CqrXs.Console.exe -D -i=.\README.MD.Whirlpool.bz.Hex32 -e=hex32 
        -k=heinrichelsigan.area23.at -H=Whirlpool -z=bz -o=.\READ_BUNZIP.txt

    EU.CqrXs.Console.exe -i=.\README.MD -z=zip -k=io.cqrxs.eu 
        -C=Aes,Blowfish,Des3,Fish2,Fish3,Seed,Serpent,SM4 -H=SCrypt 
        -e=uu -o=.\README.MD.SCrypt.zip.uu
    EU.CqrXs.Console.exe -D -i=.\README.MD.SCrypt.zip.uu -e=uu 
        -k=io.cqrxs.eu -C=Aes,Blowfish,Des3,Fish2,Fish3,Seed,Serpent,SM4 
        -H=SCrypt -z=zip -o=.\READ_UNZIP.txt

    EU.CqrXs.Console.exe -i=.\README.MD -S -z=zip -k=io.cqrxs.eu -H=BCrypt
        -e=xx -o=.\README.MD.BCrypt.zip.xx
    EU.CqrXs.Console.exe -D -i=.\README.MD.BCrypt.zip.xx -S -e=xx -k=io.cqrxs.eu 
        -H=BCrypt -z=zip -o=.\README_SYM_BCRYPT_UNZIP.txt
\end{verbatim}
\end{small}


\pagebreak 

\section{Theory} 

\subsection{8-staged symmetric block cipher pipeline}

An eight staged symmetric block cipher crypto pipeline to improve advanced encryption standard based on meta DES, 3DES with P-Box S-Box.


The following image shows you an example of a symmetric cipher 8 staged encryption pipe and the corresponding decryption inverse pipe.

Before entering the encryption pipe, the file can be zipped to avoid huge amount of symmetric cipher blocks and after exiting the encryption pipe the file can be ascii encoded with base64 mime, uuencode, xxencode or hex16, because symmetric chiphered binary files might lose their block padding.

Implementation is based on my blog article: \href{https://area23-at.blogspot.com/2024/04/making-symetric-chiffer-encryption.html}{Making symmetric cipher encryption meta permutating again}\cite{c1}, including the follwing symmetric cipher algorithms:

\begin{itemize}
\item \href{https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}{Aes}, AesLight, \href{https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}{Rijndael}
\item \href{https://www.schneier.com/}{Bruce Schneier's} BlowFish, 2-Fish, 3-Fish
\item \href{https://en.wikipedia.org/wiki/Camellia_(cipher)}{Camellia}, CamelliaLight
\item \href{https://en.wikipedia.org/wiki/CAST-128}{Cast5}, Cast6
\item \href{https://nsa.gov/}{National security agency's} Des, 3-Des, \href{https://en.wikipedia.org/wiki/Skipjack_(cipher)}{SkipJack}
\item \href{https://en.wikipedia.org/wiki/Kupyna}{Dstu7624}
\item \href{https://en.wikipedia.org/wiki/GOST_(block_cipher)}{Ghost}, \href{https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm}{Idea}, \href{https://en.wikipedia.org/wiki/NOEKEON}{Noekeon}
\item \href{https://de.wikipedia.org/wiki/RC2_(Blockchiffre)}{RC2}, \href{https://en.wikipedia.org/wiki/RC5}{RC5}32, RC564, \href{https://en.wikipedia.org/wiki/RC6}{RC6}
\item \href{https://en.wikipedia.org/wiki/SEED}{SEED}, \href{https://en.wikipedia.org/wiki/SM4_(cipher)}{SM4}
\item \href{https://en.wikipedia.org/wiki/Serpent_(cipher)}{Serpent}, Tnepres
\item \href{https://de.wikipedia.org/wiki/Tiny_Encryption_Algorithm}{Tea}, \href{https://en.wikipedia.org/wiki/XTEA}{XTea}
\item and my own simplest symmetric block cipher alogrithms: ZenMatrix, ZenMatrix2
\end{itemize}


\subsection{What are advantages and disadvantages of Symmetric Block Cipher}

\subsubsection{Advantages}
Since symmetric block cipher ciphers each block in the same encrypting way

\begin{figure}
\includegraphics[width=1\textwidth]{SymmetricBlockCipher_Structure0.png}
\caption{\label{fig:SymmetricBlockCipherStructure}Symmetric BlockCipher Structure}
\end{figure}

parallel processing can be implemented quiet easy with average performance bust on huge multiprocessor machines.

\begin{figure}
\includegraphics[width=1\textwidth]{SymmetricBlockCipher_Structure1.png}
\caption{\label{fig:SymmetricBlockCipherParallelism}Symmetric BlockCipher Parallelism}
\end{figure}

\subsubsection{Disadvantages}

Since we often know concrete structure of a file header, 
because of more static tableized structure inside file header and the specific binary format signature (MIT magic cookie)

REPLAY algorithms could be used by trying encode only the 1st symmetric cipher block with some heuristic headers and
possible keys.

\begin{figure}
\includegraphics[width=1\textwidth]{SymmetricBlockCipher_Header_1st_Block.png}
\caption{\label{fig:SymmetricBlockCipherHeader1stBlock}Symmetric BlockCipher Header 1st Block}
\end{figure}


\subsubsection{Most blockcipher algorithms break on a lot of 0 byte inside}
Most blockcipher algorithms break, when you fill a > 2x BLOCKSIZE (byte)0 inside a text or some other file. You can generate such a NULL block with linux dd:
\begin{small}
\begin{verbatim}
sudo nice -n -17 dd if=/dev/zero of=/mnt/h/zeros.txt bs=4k  count=64
\end{verbatim}
\end{small}

That is why we have added a gzip, bzip2, zip before to compress illegal character blocks inside the file to encrypt.


\subsection{Mathematical theory}

\begin{large}    
Consider that there are full bijective desterministic inversible functions, \newline
where the inverse function of  
\begin{math}
y_x = F(x,...) 
\end{math}
is 
\begin{math}
x_y = f(y,..)
\end{math}
\newline then inverse function 
\newline
to 
\begin{math}
y_x = F( G( H( I( J( K( L( M( N(x, ...)))))))))
\end{math}
\newline is 
\begin{math}
x_y = n( m( l( k( j( i( h( g( f(y,...)))))))))
\end{math}
.
\newline

You can see a mappings from ascii-8  
$\longmapsto$ 
ascii-8,
\newline
also always as Matrix from R256 
$\longmapsto$ R256 
\newline
or hexadecimal from  Rx100  
$\longmapsto$ Rx100.
\newline
you can see mappings from UTF-8 
$\longrightarrow$
\href{https://en.wikipedia.org/wiki/UTF-8#:~:text=UTF%2D8%20is%20a%20character,than%20any%20alternative%20text%20encoding.}{UTF-8}
\newline
\end{large}

\pagebreak


\subsection{ZenMatrix a simplest possible algortihm to basically understand symmetric blockcipher}

Starting from a no permutating 1-matrix, where projection is same as base,
ZenMatrix generates a permutating mapping with blocksize 16
a matrix with only one 1 per row and column (rest is 0)
to change position inside block and value offset.

\url{https://area23.at/net/Crypt/ZenMatrixVisualize.aspx}

\begin{figure}
\includegraphics[width=1\textwidth]{2026-01-25_ZenMatrixVisualize.png}
\caption{\label{fig:ZenMatrixVisualize}ZenMatrix Visualize}
\end{figure}


\begin{tabular}{|c||c c c c c c c c c c c c c c c c c|}
 \hline
  x & x0 & x1 & x2 & x3 & x4 & x5 & x6 & x7 & x8 & x9 & xA & xB & xC & xD & xE & xF & \\ [0.5ex]
\hline
 x0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x2 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x3 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x4 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x5 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x6 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x7 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x8 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 x9 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & \\
 xA & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & \\
 xB & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & \\
 xC & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & \\
 xD & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & \\
 xE & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & \\
 xF & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & \\
 \hline
\end{tabular}

When entering hostmaster@nic.at with hash ripemd256 and not fully symmetric checked, 
the matrix will look like this:

\begin{tabular}{||c|c c c c c c c c c c c c c c c c|c||}
 \hline
  x & x0 & x1 & x2 & x3 & x4 & x5 & x6 & x7 & x8 & x9 & xA & xB & xC & xD & xE & xF & Mx \\ [0.5ex]
 \hline
 x0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 8 \\
 x1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 7 \\
 x2 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 \\
 x3 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 4 \\
 x4 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 3 \\
 x5 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
 x6 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 \\
 x7 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & E \\
 x8 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & D \\
 x9 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & A \\
 xA & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & C \\
 xB & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 9 \\
 xC & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & B \\
 xD & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & F \\
 xE & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 5 \\
 xF & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
 \hline
\end{tabular}

\pagebreak
\section{Code Examples}

\subsection{C\# Code Example}
\begin{small}
\begin{verbatim}    
    string s = "This is another boring example text to test CipherPipe en-/decryption.";
    string hash = KeyHash.Hex.Hash(key), key = "myKey", hashIv = KeyHash.Hex.Hash(key);
    
    // 1. CSharp constructing a CipherPipe with parameter key and hash
    CipherPipe cPipe = new CipherPipe(key, hash, 
        EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);
        
    // 2. constructing with an array of ciphers, e.g. BlowFish;TwoFish;ThreeFish
    string algos = "BlowFish;TwoFish;ThreeFish";
    CipherEnum[] pipeAlgos = CipherEnumExtensions.ParsePipeText(algos);
    cPipe = new CipherPipe(pipeAlgos, 8, 
        EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);    
                
    // 3. calling CipherPipe encrypt text
    string encryptext = cPipe.EncrpytTextGoRounds(s, key, hashIv, 
        EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);
                            
    // 4. calling CipherPipe encrypt bytes
    byte[] cbytes = cPipe.EncryptEncodeBytes(System.Text.Encoding.Utf8.GetBytes(s), 
        key, hashIv, EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);                        
                        
    // 5. calling CipherPipe decrypt text
    string dcrypt = cPipe.DecryptTextRoundsGo(encryptext, key, hashIv, 
        EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);
                          
    // 6. calling CipherPipe decypt bytes
    byte[] outBytes = cPipe.DecodeDecrpytBytes(cbytes, key, hashIv, 
        EncodingType.Base64, ZipType.None, KeyHash.Hex, CipherMode2.CFB);
                            
\end{verbatim}
\end{small}

\pagebreak
\subsection{Java Example}

\begin{small}
\begin{verbatim}
    boolean reverseDirection = false;		// variables we need later for cipher pipe
    ZipType zipType = ZipType.None;
    EncodeEnum encodingType = EncodeEnum.None;
    KeyHash keyHash = KeyHash.Hex;
    String inString = "Hallo, byte[] inside String will converted soonly!", outString = "";
    String passKey = "MySecureKey", optCryptAlgos = "Aes,Des,Des3,Blowfish,Fish2,Fish3";
    String[] algos = optCryptAlgos.split(",;:");   
    byte[] outBytes = null, inBytes = inString.getBytes(StandardCharsets.UTF_8);
    
    CipherPipe pipe;                        // Create cipher pipe 4 en-/decrypting
    if (passKey == null || passKey.isEmpty() || algos.length > 0) {
        pipe =  new CipherPipe(algos, Constants.MAX_PIPE_LEN,
                encodingType, zipType, keyHash, CipherMode2.CFB);  // CFB is default CipherMode
        verbout("Created pipe without passkey: " + pipe.getPipeString());
    } else {
        pipe = new CipherPipe(passKey, keyHash.hash(passKey),
                encodingType, zipType, keyHash, CipherMode2.CFB); // CFB instead old ECB
        verbout("Created pipe with passkey=" + passKey + " pipe=" + pipe.getPipeString());
    }
    if (!reverseDirection) {                // encrypt
        PrintPipe(pipe, reverseDirection);        
        try {                               // CipherPipe encrypt encode
            passKey = (passKey.length() == 0) ? " " : passKey;
            outBytes = pipe.encryptEncodeBytes(inBytes,
                        passKey, keyHash.hash(passKey),
                        encodingType, zipType, keyHash, CipherMode2.CFB);
        } catch (Exception exi) {
            exi.printStackTrace();
        }
        outString = new String(outBytes);
    } else {                                // decrypt
        String inString = new String(inBytes);
        PrintPipe(pipe, reverseDirection);        
        try {                               // CipherPipe decode decrypt
            passKey = (passKey == null || passKey.isEmpty()) ? "" : passKey;
            outBytes = pipe.decodeDecrpytBytes(inBytes,
                        passKey, (passKey.isEmpty() ? "" : keyHash.hash(passKey)),
                        encodingType, zipType, keyHash, CipherMode2.CFB); 
        } catch (Exception exi) {
            exi.printStackTrace();
        }
    }
\end{verbatim}
\end{small}

\pagebreak

\subsection{Good luck!}

We hope you find PermAgainCrypt useful, and good luck.
To contact me, use the contacts at \url{https://heinrichelsigan.area23.at}.


\begin{abstract}

Hi, I’m \href{https://heinrichelsigan.area23.at/}{Heinrich Elsigan}
I am interested in C\#, Java, MSSQL, .Net Core, Android and politics, society and the future;
currently working as freelancer (one person company) and planning a secure endpoint 2 endpoint chat and looking to collaborate on reviews for other repositories and projects. Article written in \LaTeX{}.

\begin{enumerate}
    \item personal tech and political blog \href{https://area23-at.blogspot.com/}{blog.area23.at}
	\item GitHub repositories \href{https://github.com/heinrichelsigan}{github.com/heinrichelsigan/}
	\item StackOverflow \href{https://stackoverflow.com/users/12213151/heinrich-elsigan?tab=profile}{stackoverflow.com/users/12213151/heinrich-elsigan}
    \item Curriculum vitae \href{https://heinrichelsigan.area23.at/cv}{heinrichelsigan.area23.at/cv}
    \item live demo .Net \href{https://area23.at/net/}{area23.at/net}		
\end{enumerate}

\end{abstract}


\bibliographystyle{alpha}
\bibliography{sample}



\end{document}
