CodeX
Published in

CodeX

EXCERPT

The Cryptographer’s Toolbox

From Secret Key Cryptography by Frank Rubin

  • The rating system used for ciphers
  • Substitution ciphers
  • Transposition ciphers
  • Fractionation, breaking letters into smaller units
  • Pseudorandom number generators

Rating System

  • One indicates a cipher that can be broken by a beginner with no training using only paper and pencil and moderate effort.
  • Two indicates a cipher that can be broken by an experienced amateur or hobbyist using only paper and pencil.
  • Three is a cipher that a skilled amateur cryptographer can breach with hand methods.
  • Four or Five means that a computer, a trained cryptographer, or both are needed.
  • From Six to Nine indicates how much computing power an expert opponent would need.
  • Ten denotes a cipher that will hold up against a national cryptographic agency with legions of trained cryptographers using today’s largest supercomputers.

Substitution

Huffman Codes

E 100     D 00000     P 010010     
T 111 L 01000 B 010011
A 0001 U 10110 V 110101
O 0010 C 10111 K 1101000
I 0011 M 11000 X 11010011
N 0101 F 11001 Q 110100101
S 0110 Y 11011 J 1101001000
R 0111 W 000010 Z 1101001001
H 1010 G 000011

Transposition

T H E R E     Plaintext:  THERE IS NO LOVE AMONG THIEVES
I S N O L
O V E A M Ciphertext: TIOOI HSVNE ENEGV ROATE ELMHS
O N G T H
I E V E S

Fractionation

1  2  3  4  5
1 U V W X Y A mixed Polybius Square using
2 Z S A M P the keyword SAMPLE
3 L E B C D
4 F G H IJ K
5 N O Q R T
E X    A  M  P    L    E   Plaintext
·/-··-/·-/--/·--·/·-··/· Morse equivalents
1 4 2 2 4 4 1 Code group lengths
1 4 4 2 2 4 1 Lengths in reverse order
·/-··-/·---/·-/-·/·-··/· Regrouped Morse
E X J A N L E Equivalent letters
M ·     P -·-    Y ·-··   N -·--  
I - H --· Z ·-·- O --··
X ··· B --- C ·--· Q --·-
E ··- T ···· F ·--- R ---·
D ·-· U ···- G -··· S ----
A ·-- V ··-· J -··-
L -·· W ··-- K -·-·

Random Number Generators

Chained Digit Generator

39205169800562199940232...
Table 1

Useful Combinations, Wasteful Combinations

ABCDEFGHIJKLMNOPQRSTUVWXYZ    First substitution
XYZFIRSTABCDEGHJKLMONPQUVW
ABCDEFGHIJKLMNOPQRSTUVWXYZ Second substitution
UVWXYZSECONDABFGHIJKLMPQRT
ABCDEFGHIJKLMNOPQRSTUVWXYZ Equivalent
QRTZCIJKUVWXYSEONDAFBGHLMP
12155 12155 12155 12155   Superencipherment key
61587 02954 70069 53028 Plaintext code groups
73632 14009 82114 65173 Superenciphered code groups

Bazeries Type 4 Cipher

ABCDEFGHIJKLMNOPQRSTUVWXYZ   Plaintext alphabet
HGFDCBAZERISYXWVUTQPONMLKJ Ciphertext alphabet
THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG Message plaintext
PZCUOEFIGTWMXBWLROYVQWNCTPZCSHJKDWA After substitution
4 2 3 4 2 3 4 2 3 4 2 3 Transposition key
PZCU OE FIG TWMX BW LRO YVQW NC TPZ CSHJ KD WA
UCZP EO GIF XMWT WB ORL WQVY CN ZPT JHSC DK AW Final ciphertext
UCZPE OGIFX MWTWB ORLWQ VYCNZ PTJHS CDKAW Ciphertext grouped by fives
3   4    -3  2   3   4    -3  2   3   4    -3  2  
THE QUIC KBR OW NFO XJUM PSO VE RTH ELAZ YDO GS Plaintext
EHT CIUQ KBR WO OFN MUJX PSO EV HTR ZALE YDO SG Transposed

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manning Publications

Follow Manning Publications on Medium for free content and exclusive discounts.