Basic and Historical Cryptography
Basic and Historical Cryptography
THE SAME IMAGE VIEWED BY WHITE, BLUE, GREEN AND RED LIGHTS REVEALS DIFFERENT HIDDEN NUMBERS.
• In Greek
• Steganos = covered
• Graphein = to write
• Steganography is about hiding messages
• Historically, secret messages were often hidden (or memorized)
• Today, steganography is used primarily to protect digital rights
• “watermarking” copyright notices
• “fingerprinting” a serial ID
4
HISTORY OF STEGANOGRAPHY
(PHYSICALLY HIDING)
• Runners were memorizing messages
• Sometimes killed after delivering the message
Wax tablet and a Roman stylus Writing with stylus and folding
wax tablet. painter, Douris, ca
500 BC
6
HISTORY OF STEGANOGRAPHY
(PHYSICALLY HIDING)
• Greek Histaiaeus encouraged Aristagoras of
Miletus to revolt against the Persian King.
• Writes message on the shaved head of the
messenger, and sends him after his hair grew, with the
instruction, "When thou art come to Miletus, bid
Aristagoras shave thy head, and look thereon."
7
HISTORY OF STEGANOGRAPHY (CONT.)
• Invisible Ink
• Certain organic fluids (milk, fruit juice) are transparent when dried but the deposit can be
charred and is then visible
• Romans used to write between the lines
• A mixture of alum and vinegar may be used to write on hardboiled eggs, so that can only
be read once shell is broken
• Pin punctures: Small pin punctures on selected letters are ordinarily not visible unless the
paper is held up in front of a light
8
HISTORY OF STEGANOGRAPHY (CONT.)
9
HISTORY OF STEGANOGRAPHY (CONT.)
• Microdots
• is text or an image substantially
reduced in size onto a small disc to
prevent detection by unintended
recipients.
• WW2 Germany - documents shrunk
to the size of a dot, and embedded
within innocent letters
• DNA microdot, embedding
synthetically formed DNA sequence
(secret) into a normal DNA strand,
then posting as microdot
• Microdots with barcode-like
information
10
HISTORY OF STEGANOGRAPHY (CONT.)
• Easter eggs
• Programmers embed in software
• See http://www.eeggs.com
• Claims that Beatles embedded secret messages in
their music http://www.bbc.com/culture/story/20141003-the-hidden-messages-in-songs
11
HIDING A MESSAGE WITHIN A TEXT
The codebreakers/Khan
12
HIDING A MESSAGE WITHIN A TEXT
14
MODERN STEGANOGRAPHY
• Hiding one message within another (“container”)
• Most containers are rich media
• Images, audio, video are very redundant, can be tweaked without affecting
human eye/ear
• US argued that Bin Laden implanted instructions within taped interviews
16
EXAMPLE (STEGANOS)
Original Picture Embedded Picture (bombe)
17
STEGANALYSIS
• Detection: is there a hidden message?
• Develop signatures for known steganographic tools, e.g. in
LSB method, expect local homogeneity
• When content is encrypted, the message should have a
high entropy (“white noise”)
• Promising results: high detection rates
• Decoding: recover hidden message
• No significant work in this area !
• Prevention: destroy or remove a hidden message
• Most steganographies not robust to image alterations
• Short messages (e.g. copyright) can be encoded
redundantly and survive an alternation 18
STEGANOGRAPHY (SUMMARY)
http://en.wikipedia.org/wiki/Cryptography 20
BASIC TERMINOLOGY
22
CIPHER CLASSIFICATION
Ciphers
Symmetric
Public Key Unkeyed
Key
Transposition Substitution
CRYPTOGRAPHY
• transposition of letters
• Scytale is first cryptographic device (Lysander of Sparta 500 BC)
• Message written on a leather strip (the inside of a servant's belt), which is
then unwound to scramble the message.
• Unreadable without proper diameter of wooden rod
• The message warned Lysander that Persia was about to go to war against
him. He immediately set sail and defeated the Persians.
• substitution
• Hebrew ATBASH ( )אתבשhttps://en.wikipedia.org/wiki/Atbash
• Kama-Sutra suggests that women learn
th
to encrypt their love messages
by substituting pre-paired letters (4 Century AD)
• Cipher – replace letters 24
• Code – replace words
POLYBIUS SQUARE
28
MONOALPHABETIC CIPHERS
• Subsequently can look for the rest of the letters and letter pairs
BREAKING MONOALPHABETIC CIPHERS
33
HOMOPHONIC SUBSTITUTION
• Usually, the highest-frequency plaintext symbols are given more
equivalents than lower frequency letters. In this way, the
frequency distribution is flattened, making analysis more difficult.
• Keyed 2-digit substitution
A B C D E F G H I J K L M N O P Q R S T U V W X Y/Z
T 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 00 01 02 03 04 05
H 43 44 45 46 47 48 49 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
E 71 72 73 74 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
K 90 91 92 93 94 95 96 97 98 99 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
• Reverse frequency
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 00 01 02 03 04 68 05
43 44 45 46 47 48 49 25 26 29 30 31 32 33 35 36 37 38 40 87
71 73 74 50 53 54 57 59 60 63 64 65 66
90 93 94 97 98 76 78 79 82 83 84
72 51 56 58 61 34 39 86 42
91 95 81 77 80 62 67 88 70
92 52 85 89
75 96 41 34
27 69
55
99
28
POLYALPHABETIC CIPHERS
• Polyalphabetic substitution cipher
• Improves on the simple monoalphabetic technique by using different
monoalphabetic substitutions as one proceeds through the plaintext
message
A A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
frequency analysis H
I
H
I
I
J
J
K
K
L
L
M
M
N
N
O
O
P
P
Q
Q
R
R
S
S
T
T
U
U
V
V
W
W
X
X
Y
Y
Z
Z
A
A
B
B
C
C
D
D
E
E
F
F
G
G
H
J J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
(STRONGER) VIGENÈRE AUTOKEY SYSTEM
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z 41
PLAYFAIR CIPHER
Plaintext is encrypted two letters at a time, according to the following rules:
1. Repeating plaintext letters that are in the same pair are separated with a filler letter, such as x, so
that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each replaced by the letter to the
right, with the first element of the row circularly following the last. For example, ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the letter beneath, with the
top element of the column circularly following the last. For example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and the
column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM (or JM, as
the encipherer wishes).
Assume one wants to encrypt the digram OR. There are five general cases:
1) 2) 3) 4) 5)
* * * * * **O** Z**O* ***** *****
* OY RZ **B ** *** * * ***** **R**
* * * * * ** *** *** * * *ORC* **O**
* * * * * **R ** R**X * ***** ** I**
* * * * * **Y ** *** * * ***** *****
Hence, OR → YZ Hence, OR → BY Hence, OR → ZX Hence, OR → RC Hence, OR → IO
42
https://en.wikipedia.org/wiki/Playfair_cipher
43
TRANSPOSITION CIPHER
44
TRANSPOSITION CIPHERS
• Railfence with large cycles: TRHCEEIETGSSMAIAEASS
T 5 T R
H 3 H C E E
E 1 I E T G
K 4 S S M A
E 2 I A E S
Y 6 S S
• Columnar
T H E K E Y
5 3 1 4 2 6
• IEEIRSHSMESCSTATGSEA T H I S I S
A S E C R E
T M E S S A 45
G E
HILL CIPHER
• Developed by the mathematician Lester Hill in 1929
• Strength is that it completely hides single-letter
frequencies
• The use of a larger matrix hides more frequency information
• A 3 x 3 Hill cipher hides not only single-letter but also two-letter
frequency information
• https://en.wikipedia.org/wiki/Hill_cipher
46
HISTORICAL CODING
• Louis XIV’s Great Cipher (Rossignols) used one symbol (3-
digit number) per syllable (held 200 years)
• https://en.wikipedia.org/wiki/Great_Cipher
• Mary Queen of Scots used a combination of cipher and
coded words https://en.wikipedia.org/wiki/Babington_Plot
• Referred to as a nomenclature because many codes were for names
• e.g,
•Anagramming
• If 1-gram frequencies match English frequencies, but
other n-gram frequencies do not, probably
transposition
• Rearrange letters to form n-grams with highest
frequencies
48
EXAMPLE, DECODING RAIL-FENCE
• Ciphertext: HLOOLELWRD
• Frequencies of 2-grams beginning with H
• HE 0.0305
• HO 0.0043
• HL, HW, HR, HD < 0.0010
• Frequencies of 2-grams ending in H
• WH 0.0026
• EH, LH, OH, RH, DH ≤ 0.0002
• Implies E follows H
49
EXAMPLE
Slide #8-54
ESTIMATE OF PERIOD
55
CHECK ON PERIOD
56
COMPUTE IC
•Here, IC = 0.043
• Indicates a key of slightly more than 5
• A statistical measure, so it can be in error, but it agrees
57
alphabet 1: AIKHOIATTOBGEEERNEOSAI
alphabet 2: DUKKEFUAWEMGKWDWSUFWJU
alphabet 3: QSTIQBMAMQBWQVLKVTMTMI
alphabet 4: YBMZOAFCOOFPHEAXPQEPOX
alphabet 5: SOIOOGVICOVCSVASHOGCC
alphabet 6: MXBOGKVDIGZINNVVCIJHH
• ICs (#1, 0.069; #2, 0.078; #3, 0.078; #4, 0.056;
#5, 0.124; #6, 0.043) indicate all alphabets have
period 1, except #4 and #6; assume statistics off
58
FREQUENCY EXAMINATION
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1 31004011301001300112000000
2 10022210013010000010404000
3 12000000201140004013021000
4 21102201000010431000000211
5 10500021200000500030020000
6 01110022311012100000030101
Letter frequencies are (H high, M medium, L low):
HMMMHMMHHMMMMHHMLHHHMLLLLL
59
BEGIN DECRYPTION
• Feinberg, Leonard. The Secret of Humor. Rodopi, 1978. ISBN 9789062033706. p102
64
UNBREAKABLE ENCRYPTION
• One time pads
• Sender and receiver use a pre-arranged random stream of letters
• Encryption=addition modulo 26 M E S S A G E
• XOR when binary T H I S K E Y
• Every letter in the key used only once
F L A K K K C
• One time pads provide for the only perfectly secure
encryption algorithms
• Why? Look at ciphertext DXQR. Equally likely to correspond to
plaintext DOIT (key AJIY) and to plaintext DONT (key AJDY) and
any other 4 letters
• All the rest are only computationally secure
• Used by Soviet spies, and also for US-USSR hotline.
• https://en.wikipedia.org/wiki/One-time_pad 65
EXAMPLE OF ONE-TIME PAD
66
ONE-TIME PAD FUNDAMENTAL DIFFICULTIES
69
73
POLES CRACK THE ENIGMA
• Rejewski’s algorithm to discover the day key
• First, use catalog to identify the scrambler setting and orientation
• Then, run the ciphertext through an Enigma and look at the text to
identify swapped letter pairs
https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Enigma
• Bombe machines were constructed to mechanize the search
• A one-ton machine that essentially stringed together 6 Enigmas
(one for each ordering of the scramblers)
74
BRITISH CRACK IMPROVED ENIGMA
77
Computer and Code Breaking
• The computer was as big
as a room 5 metres long,
3 metres deep and 2.5
metres high - and was
made mainly from parts
used for post office
telephone and telegraph
systems.
78
SIGABA
• It was suited for fixed
station secure
communications, and used
by U.S. for high-level
communications, was the
only machine system used
by any participant to
remain completely
unbroken by an enemy
during World War II.
79
B-21 MACHINE BY BORIS
HAGELIN
• Patterned on the
Enigma and produced
for the Swedish
General staff, Boris
Hagelin of Sweden
developed the B-21
machine in 1925. It also
had the capability to be
connected to an electric
typewriter.
80
BC-38 BY CRYPTO AG ZUG
• Boris Hagelin of
Sweden developed a
long line of cipher
systems, beginning
with the B-21, B-211,
C-35, C-36, C-38
(which later became
America's M-209).
81
BID 590 (NOREEN)
• The BID 590 was a
British built crypto
machine and was used
by Canada's foreign
service communicators
at various diplomatic
missions to
communicate with
various government
departments.
82
H-4605 (CRYPTO AG)
• The Crypto AG H4605
was designed as an off-
line, keyboard operated
cipher machine with twin
printing (of cipher and
plain text) system with
automatic 5-letter
grouping. It's a solid piece
of equipment, almost
'battleship grade’.
83
JAPANESE "ENIGMA"
ROTOR CIPHER MACHINE
85
KY-28 (NESTOR)
86
RACAL-MILGO 64-1027C
DATACRYPTOR
• The Racal-Milgo 64-
1027C Datacryptor was
used to send and
receive secure data via
computer. This is the
commercial version of
the KG-84, and has
ability to be loaded via
the KYK-13 Fill device.
87
THE “CLOCK CRYPTOGRAPH”
• It is basically a nicely
implemented
Wheatstone cipher
disk. It was in active
use in the Danish
armed forces from
1934 (or a little
earlier) until around
1948.
88
COMPUTER AND CODE
BREAKING
• This Cray XMP was donated
to the museum by Cray
Research, Inc. It denotes
the newest era of
partnership between NSA
and the American computer
industry in the employment
of computers for
cryptologic processes.
89
NEVER-ENDING CIPHERS
91