\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{ipsec} \pdfinfo{ /Title (cryptography.pdf) /Creator (Cheatography) /Author (ipsec) /Subject (Cryptography Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{141DA3} \definecolor{LightBackground}{HTML}{F0F0F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Cryptography Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ipsec} via \textcolor{DarkBackground}{\uline{cheatography.com/163245/cs/34186/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}ipsec \\ \uline{cheatography.com/ipsec} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 16th September, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{1.296 cm} x{3.024 cm} x{2.016 cm} x{0.864 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Symmetric (Block)}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{Name}} & {\emph{Key Size(bits)}} & {\emph{Block Size(bits)}} & {\emph{Rounds}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{DES}} & 56 & 64 & 16 \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{3DES}} & 56 & 64 & 16 \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} {\bf{AES}} & 128,192,256 & 128 & 10,12,14 \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{IDEA}} & 128 & 64 & 8 \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} {\bf{Skipjack}} & 80 & 64 & 32 \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{Blowfish}} & 32-448 & 64 & 16 \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} {\bf{Twofish}} & 1-256 & 128 & 16 \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{Camellia}} & 128,192,256 & 128 & 18,24 \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} {\bf{RC2}} & 1-128 (40 min) & 64 & 18 \tn % Row Count 18 (+ 1) % Row 10 \SetRowColor{LightBackground} {\bf{RC5}} & 1-2048 & 32,64,128 & 1-255 \tn % Row Count 20 (+ 2) % Row 11 \SetRowColor{white} {\bf{RC6}} & Variable\{\{nl\}\}(128,192,256) & 32,64,128 & 20 \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} {\bf{XTEA}} & 128 & 64 & 64 \tn % Row Count 24 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.792 cm} x{2.448 cm} p{0.72 cm} x{3.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Symmetric (Stream)}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{Name}} & {\emph{Key Size(bits)}} & {\emph{Rounds}} & {\emph{Notes}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{RC4}} & 1-2048 & 1 & 40 bit key min,\{\{nl\}\}SSL, Web, WiFi \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{RCA}} & 1-256 & 1-255 & \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{FISH}} & & & Lagged Fibonacci PRNG,\{\{nl\}\}Data XOR'd w/ key \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{PIKE}} & & & FISH improvement to plaintext vulnerabilities,\{\{nl\}\}most common stream \tn % Row Count 13 (+ 4) % Row 5 \SetRowColor{white} {\bf{ChaCha}} & 256 bit key,\{\{nl\}\}64 bit nonce & & 3x faster than software,\{\{nl\}\}enabled AES and not sensitive to timing attacks \tn % Row Count 18 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.368 cm} x{3.116 cm} x{3.116 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Asymmetric}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{Name}} & {\emph{Description}} & {\emph{Notes}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{RSA}} & Leverages prime \#\{\{nl\}\}1024-4096 key size\{\{nl\}\}1 round & Most popular,\{\{nl\}\}provides auth/encrypt,\{\{nl\}\}auth via {\bf{digital signatures}} \tn % Row Count 6 (+ 5) % Row 2 \SetRowColor{LightBackground} {\bf{ECC}} & Leverages discrete logarithm & Provides auth/encrypt,\{\{nl\}\}faster than RSA,\{\{nl\}\}uses less resources\{\{nl\}\} ({\bf{like cell phones}}),\{\{nl\}\}auth via digital signatures \tn % Row Count 15 (+ 9) % Row 3 \SetRowColor{white} {\bf{El Gamal}} & Used in recent versions of PGP & Extension of Diffie,\{\{nl\}\}similar protection as RSA/ECC,\{\{nl\}\}usually the slowest \tn % Row Count 21 (+ 6) % Row 4 \SetRowColor{LightBackground} {\bf{DSA}} & Used to verify signatures,\{\{nl\}\}used Key pair,\{\{nl\}\}verified w/ public key & FIPS 186 Standard \tn % Row Count 26 (+ 5) % Row 5 \SetRowColor{white} {\bf{Knapsack}} & Used for encrypt & Considered insecure \tn % Row Count 28 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{Diffie Hellman}} & No auth,\{\{nl\}\}MITM proned & Provides a method for {\bf{key exchange}} using a one-way function. \tn % Row Count 32 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.76 cm} x{2.356 cm} x{4.484 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Block Cipher Modes (Symmetric)}} \tn % Row 0 \SetRowColor{LightBackground} & {\emph{Name}} & {\emph{Description}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{ECB}} & Electronic Code Book & \{\{fa-unlock\}\}Most basic, weak, and unsecure.\{\{fa-unlock\}\}Each block processed separately.\{\{fa-unlock\}\}No Salt or IV is used and the ~same key will be used to encrypt ~each block. \tn % Row Count 10 (+ 9) % Row 2 \SetRowColor{LightBackground} {\bf{CBC}} & Cipher Block Chaining & \{\{fa-unlock-alt\}\}Minor step up from ECB.\{\{nl\}\}\{\{fa-unlock-alt\}\}Added IV for the first block.\{\{nl\}\}\{\{fa-unlock-alt\}\}Results of encryption from the previous block is input into to encryption process of the current block. \tn % Row Count 20 (+ 10) % Row 3 \SetRowColor{white} {\bf{CFB}} & Cipher Feedback & \{\{fa-wifi\}\} Converts the block cipher into a ~self-synchronizing stream cipher.\{\{nl\}\}\{\{fa-wifi\}\} Current block takes output of the XOR ⊕ process vs from the cipher stage of the previous block\{\{nl\}\}{\emph{(difference between CFB and OFB)}}. \tn % Row Count 31 (+ 11) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{p{0.76 cm} x{2.356 cm} x{4.484 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Block Cipher Modes (Symmetric) (cont)}} \tn % Row 4 \SetRowColor{LightBackground} {\bf{OFB}} & Output Feedback & \{\{fa-wifi\}\} Converts the block cipher to a synchronous stream output.\{\{nl\}\}\{\{fa-wifi\}\} Current block takes output from cipher stage vs from the output of the XOR process of the previous block {\emph{(diff between CFB and OFB)}}.\{\{nl\}\}\{\{fa-wifi\}\} The first stage takes the data blocks and X-ORs it with encrypted version of the IV value. The output of the 1st stage encryption is then feed into the next stage, and encrypted, with the output being \{\{nl\}\}X-OR'ed with the second block. \tn % Row Count 21 (+ 21) % Row 5 \SetRowColor{white} {\bf{CTR}} & Counter Mode & \{\{fa-wifi\}\} Converts the block cipher into a ~stream cipher.\{\{nl\}\}\{\{fa-wifi\}\} Generates a counter value and a nonce, and encrypts this, in order to EX-OR with the plain text block.\{\{nl\}\}\{\{fa-wifi\}\} Advantage of CTR is that each block is processed independent of the others, facilitating ability to conduct parallel processing of blocks. i.e., feedback from other stages to feed into the current one is not required. \tn % Row Count 40 (+ 19) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Cryptographic Hash}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{Name}} & {\emph{Hash Value (bits)}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{MD2}} & 128 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{MD4}} & 128 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{MD5}} & 128 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{MD6}} & 1-512 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} {\bf{SHA-1}} & 160 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} {\bf{SHA-2}} & 256,384,512 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} {\bf{SHA-3}} & Variable \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} {\bf{SHA-256}} & 256 \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} {\bf{SHA-512}} & 512 \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Historical Ciphers}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{Name}} & {\emph{Description}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{Pigpen}} & Mono- alphabetic substitution cipher that makes use of mapping plaintext characters to graphical characters rather than to alphabetic ones. i.e. A=(pick a symbol), vs A=(pick a letter). Disadvantage: once the mapping is known, it is difficult to keep the message secret. \tn % Row Count 12 (+ 11) % Row 2 \SetRowColor{LightBackground} {\bf{Rail Code}} & Employs a method to scramble text by writing it in a sequence across a number of rails. \tn % Row Count 16 (+ 4) % Row 3 \SetRowColor{white} {\bf{BIFID}} & Makes use of a grid and which maps the letters into numeric values. \tn % Row Count 19 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{Playfair}} & 5 × 5 matrix containing the alphabet less the letter J. Cipher/decipher process consists of a set of rules outlining use of column and row combinations. \tn % Row Count 25 (+ 6) % Row 5 \SetRowColor{white} {\bf{Morse Code}} & Encoding method, rather than a cipher, that works by translating characters into sequences of dots (.) and dashes (-) \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Historical Ciphers (cont)}} \tn % Row 6 \SetRowColor{LightBackground} {\bf{Caesar}} & Mono-alphabetic substitution cipher known as "shift" cipher. Involves plaintext being replaced by a letter some fixed number of positions down the alphabet. i.e., a Caesar Cipher using a shift of +3 would mean a plaintext letter A would result in a ciphertext letter D (a shift of three positions to the right in the alphabet). \tn % Row Count 13 (+ 13) % Row 7 \SetRowColor{white} {\bf{Vigenere}} & Polyalphabetic cipher that involves using a different mapping, based on a keyword, for each character of the cipher. An advantage of this type of cipher is that the same plaintext character is likely to be coded to different mappings, depending on the position of the keyword, making guessing more difficult. \tn % Row Count 25 (+ 12) % Row 8 \SetRowColor{LightBackground} {\bf{One Time Pad}} & Cipher code mapping that is used only once. Advantage is it is essentially unbreakable, disadvantage is it takes lots of work as you'd have to generate the pad to be used, each time. \tn % Row Count 33 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Historical Ciphers (cont)}} \tn % Row 9 \SetRowColor{LightBackground} {\bf{Four-square Cipher}} & Uses four 5 × 5 matrices arranged in a square, are where each matrix contains 25 letters for encoding and decoding operations. \tn % Row Count 5 (+ 5) % Row 10 \SetRowColor{white} {\bf{Enigma Machine}} & Used a polyalphabetic substitution cipher, which did not repeat within a reasonable time period, along with a secret key. For the cracking of the Enigma cipher, the challenge was thus to determine both the algorithm used and the key. Enigma's main weakness, though, was that none of the plain text letters could be ciphered as itself \tn % Row Count 18 (+ 13) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}