Professional Documents
Culture Documents
John Manferdelli
jlm@cs.washington.edu
jmanfer@microsoft.com
This material is provided without warranty of any kind including, without limitation, warranty of non-infringement or suitability
for any purpose. This material is not guaranteed to be error free and is intended for instructional use only.
The Source
Sender: Alice
Noisy insecure
channel
Plaintext Compress Encrypt Encode
(to save space) (for confidentiality) (to correct errors)
(P)
The Sink
Receiver:Bob
Noisy insecure
channel
Decode Decrypt Decompress Plaintext
(for confidentiality) (to save space)
(to correct errors) (P)
Algorithm Speed
RSA-1024 Encrypt .32 ms/op (128B), 384 KB/sec
Algorithm Speed
SHA-1 48.46 MB/sec
SHA-256 24.75 MB/sec
Timings do not include setup. All results are for an 850MHz x86.
80 3:1
112 6:1
128 10:1
192 32:1
256 64:1
Wiretap Adversary
Eve Bob
Alice
Alice Bob
• WW II
– Universally available (simple, light instrumentation) - interoperability
– Compact , rugged: Easy for people to use
– Security in key only: We assume that the attacker knows the
complete details of the cryptographic algorithm and implementation
– Adversary has access to some corresponding plain and ciphertext
• Now
– Adversary has access to unlimited ciphertext and lots of chosen text
– Implementation in digital devices (power/speed) paramount
– Easy for computers to use
– Resistant to ridiculous amount of computing power
• Indistinguishability:
– Given two messages and the encryption of one of the
messages (the target ciphertext), it is hard to determine
which message is encrypted
– Related to Semantic Security
• Non-Malleability :
– Given a target ciphertext y, it is hard to find another
ciphertext y’ such that the corresponding plaintexts are
“meaningfully related”
• Groups are sets of elements that have a binary operation with the
following properties:
1. If x,y,z G, xy G and (xy)z=x(yz). It is not always true xy=yx.
2. There is an identity element 1 G and 1x=x1=x for all x in G
3. For all, x in G there is an element x -1 G and x x-1 =1= x-1 x
• One very important group is the group of all bijective maps from a
set of n elements to itself denoted Sn or n. These are called the
“permutations of n elements.” The “binary operation” is the
composition of mappings. The identity element leaves every
element alone. The inverse of a mapping, x, “undoes” what x
does.
• If Sn and the image of x is y we can write this two ways: y= (x);
this is the usual functional notation your used to where mappings
are applied “from the left”. When mappings are applied from the
left and and are elements of Sn denotes the mapping
obtained by applying first and then - i.e. y= (x)).
• Some people apply mappings from the right. They would write
y=(x) For them, denotes the mapping obtained by applying
first and then - i.e. y= ((x).
JLM 20060107 22:16 20
Group Theory in Cryptography - 2
• The smallest k such that k=1 is called the order of . G is finite if it has
a finite number of elements. In a finite group, all elements have finite
order and the order of each element divides the number of elements of
G (Lagrange’s Theorem).
• Example. Let G= S4.
– = 12, 23, 34, 41, = 13, 24, 31, 42.
= 14, 21, 32, 43
– Applying mappings “from the left”, = 14, 21,32,43.
– Sometimes is written like this:
= 1 2 3 4
2 3 4 1
– Sometimes permutations are written as products of cycles:
=(1234)and (13)(24).
• Grilles
B U L L
W I N K
L E I S BWLAEUINEDLNIOLKSP
A D O P
E
Procedure
1. Determine rectangle dimensions (l,w) by noting that message
length=m = l x w. Here m=77, so l=7, w=11 or l=11, w=7
2. Anagram to obtain relative column positions
1 2 3 4 5 6 7 3 6 1 5 7 2 4
E E G A E R C G R E E C E A
O C N E U N N N N O U N C E
E E D R S Y T D Y E S T E R
Y H D A I A T D A Y I T H A
E H D E A R C D R E A C H E
G E D M R A E D A G R E E M
T T E H W N I E N T W I T H
R Y T T K U E T U R K E Y T
N H O E D E T O E N D T H E
P S C C R Y U C Y P R U S C
S N R S I I S R I S I S N S
JLM 20060107 22:16 24
Alphabetic Substitution
Caeser Cipher
B U L L W I N K L E I S A D O P E
D W N N Y K P M N G K U C F Q S G
• Letter Frequency
A .0651738 B .0124248 C .0217339 D .0349835
E .1041442 F .0197881 G .0158610 H .0492888
I .0558094 J .0009033 K .0050529 L .0331490
M .0202124 N .0564513 O .0596302 P .0137645
Q .0008606 R .0497563 S .0515760 T .0729357
U .0225134 V .0082903 W .0171272 X .0013692
Y .0145984 Z .0007836 sp .1918182
• Probable word.
• Corresponding plain/cipher text makes this trivial.
30 m
n
o
p
20
q
r
s
10 t
u
v
w
0
1 x
y
Letter
z
Direct Standard:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Reverse Standard:
ZYXWVUTSRQPONMLKJIHGFEDCBA
Keyword Direct (Keyword: NEW YORK CITY):
NEWYORKCITABDFGHJLMPQRSUVZ
Keyword Transposed (Keyword: CHICAGO):
CHIAGO
BDEFJK
LMNPQR
STUVWX
YZ
CBLSYHDMTZIENUAFPVGJQWOKRX
• Other Statistics
– Vowel Consonant pairing
– Digraph, trigraph frequency
OHNMA
FERDL
IBCGK TH QM
PQSTU
VWXYZ
• Apply the inverse of the “key matrix” [k11 k12 | k21 k22] to transform
ciphertext into plaintext
• Works better if we add space (27=33 letters) or throw out a letter (25=52)
Meaningful Messages
2Hn
Cipher Messages
||n Non-Meaningful Messages
• Diffusion – transposition
– Using group theory, the action of a transposition on a1 a2 …ak could be
written as a(1) a(2) …a(k) .
• Confusion – substitution
– Using group theory, the action of a substitution on a1 a2 …ak could be
written as (a1) (a2) … (ak) .
• Transpositions and substitutions may depend on keys. Keyed
permutations may be written as k(x). Incidentially, a block cipher on b
bits is nothing more than a keyed permutation on 2b symbols.
Reference:
Rotman, Group Theory.
Lang, Algebra.
Hall, Group Theory. Chelsea.
U L M N S
Lamps
S: Stecker (plugboard)
B
Diagram courtesy of Carl Ellison
Encryption Equation
c= (p) PiNP-i PjMP-j PkLP-k U PkL-1P-k PjM-1P-j PiN-1P-i
– K: Keyboard
– P=(ABCDEFGHIJKLMNOPQRSTUVWXYZ)
– N: First Rotor
– M: Second Rotor
– L: Third Rotor
– U: Reflector. Note: U=U-1.
– i,j,k: Number of rotations of first, second and third rotors respectively.
• Later military models added plug-board (S) and additional
rotor (not included). The equation with Plugboard is:
c=(p)S PiNP-i PjMP-j PkLP-k U PkL-1P-k PjM-1P-j PiN-1P-i S-1
Rotors
• Using the first theorem, the expression for CF gives 13 possibilities for C and
F, 27(=3x9) possibilities for B and E and 20(=2x10) possibilities for A and D.
• Histograms of the enciphered message keys showed spikes. Rejewski
deduced, correctly, that these were often for plaintext keys AAA, BBB, CCC,
etc. --- that allowed him to line up cycles between the three Enigma pairs.
• This determines A,B,C,D,E and F.
• Rejewski was given 2 months of key sheets, carrying the Stecker settings.
From them he removed the Stecker and solved the equations for the fast rotor.
For example:
– S-1AS= P1NP-1QP1N-1P-1 with S-1AS and P, known.
– This leaves only two permutations Q and N (the fast rotor) unknown and Q is in
precisely the right form to apply the second group theory result.
– Thus we can obtain both Q and N (see postscript).
• Since all the rotors are in the fast position at some time, we (as Rejewski) can
obtain all the wirings.
Characteristics:
• Fast
• Data encrypted in fixed “block sizes” (64,128,256 bit blocks are
common).
• Key and message bits non-linearly mixed in ciphertext
• Federal History
• 1972 study
• RFP: 5/73, 8/74
• NSA: S-Box influence, key size reduction
• Published in Federal Register: 3/75
• FIPS 46: January, 1976.
• IBM
• Descendant of Feistel’s Lucifer
• Designers: Horst Feistel, Walter Tuchman, Don Coppersmith, Alan
Konheim, Carl Meyer, Mike Matyas, Roy Adler, Edna Grossman, Bill
Notz, Lynn Smith, and Bryant Tuckerman
• Brute Force Cracking
• EFS DES Cracker: $250K, 1998. 1,536 custom chips. Can brute
force a DES key in days
• Deep Crack and distributed.net break a DES key in 22.25 hours.
• Early 1970s: First serious needs for civilian encryption (in electronic
banking)
• IBM’s response: Lucifer, an iterated SP cipher
• Lucifer (v0): x
– Two fixed, 4x4 s-boxes, S0 & S1
S0 S1 S0 S1 . . . . S0 S1
– A fixed permutation P
P
– Key bits determine
which s-box is to be S0 S1 S0 S1 . . . . S0 S1
used at each position
...
S0 S1 S0 S1 . . . .
– 8 x 64/4 = 128 key bits S0 S1
(for 64-bit block, 8 rounds)
P
Graphic by cschen@cc.nctu.edu.tw
EK(x)
JLM 20060107 22:16 71
From Lucifer to DES
Key Schedule
Plaintext
k1
k2
r Feistel
Rounds
kr
Ciphertext
JLM 20060107 22:16 73
Feistel Round
f ki
Note: If i(L,R)= (Lf(E(R) ki) ,R) and (L,R)= (R,L), this round
is i(L,R).
To invert: swap halves and apply same transform with same key:
ii(L,R)=(L,R).
JLM 20060107 22:16 74
DES Round Function
32 bits
Sub-key
48 bits
6/4-bit substitutions
32-bit permutation
f ki
f ki+1
64-bit Plaintext
k2
k1 (48 bits)
k16
64-bit Ciphertext
f ki (48 bits)
Each round (except last) is i. Note that i i= i2.
C0D0= PC1(K)
Ci+1 = LeftShift(Shifti, Ci), Di+1 = LeftShift(Shifti, Di),
Ki= PC2(Ci ||Di)
Shifti= <1,2,2,2,2,2,2,1,2,2,2,2,2,2,1,1>
pc1[64]
57 49 41 33 25 17 09 01 58 50 42 34 26 18 10 02
59 51 43 35 27 19 11 03 60 52 44 36 63 55 47 39
31 23 15 07 62 54 46 38 30 22 14 06 61 53 45 37
29 21 13 05 28 20 12 04 00 00 00 00 00 00 00 00
pc2[48]
14 17 11 24 01 05 03 28 15 06 21 10 23 19 12 04
26 08 16 07 27 20 13 02 41 52 31 37 47 55 30 40
51 45 33 48 44 49 39 56 34 53 46 42 50 36 29 32
JLM 20060107 22:16 86
DES Data
S4 (hex)
7 d e 3 0 6 9 a 1 2 8 5 b c 4 f
d 8 b 5 6 f 0 3 4 7 2 c 1 a e 9
a 6 9 0 c b 7 d f 1 3 e 5 2 8 4
3 f 0 6 a 1 d 8 9 4 5 b c 7 2 e
S5 (hex)
2 c 4 1 7 a b 6 8 5 3 f d 0 e 9
e b 2 c 4 7 d 1 5 0 f a 3 9 8 6
4 2 1 b a d 7 8 f 9 c 5 6 3 0 e
b 8 c 7 1 e 2 d 6 f 0 9 a 4 5 3
S6 (hex)
c 1 a f 9 2 6 8 0 d 3 4 e 7 5 b
a f 4 2 7 c 9 5 6 1 d e 0 b 3 8
9 e f 5 2 8 c 3 7 0 4 a 1 d b 6
4 3 2 c 9 5 f a b e 1 7 6 0 8 d
1,1:
56+4+35+2+26+25+246+245+236+2356+16+15+156+14+146+145+13+135+134+1346+1
345+13456+125+1256+1245+123+12356+1234+12346
1,2:
C+6+5+4+45+456+36+35+34+346+26+25+24+246+2456+23+236+235+234+2346+1+15+
156+134+13456+12+126+1256+124+1246+1245+12456+123+1236+1235+12356+
1234+12346
1,3:
C+6+56+46+45+3+35+356+346+3456+2+26+24+246+245+236+16+15+145+13+1356+13
4+13456+12+126+125+12456+123+1236+1235+12356+1234+12346
1,4: C+6+5+456+3+34+346+345+2+23+234+1+15+14+146+135+134+1346+1345+1256+
124+1246+1245+123+12356+1234+12346
P
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
2 8 24 14 32 27 3 9 19 13 30 6 22 11 4 25
Note on applying permutations: For permutations of bit positions, like P above, the table entries
consisting of two rows, the top row of which is “in order” means the following. If t is above
b, the bit at b is moved into position t in the permuted bit string. For example, after
applying P, above, the most significant bit of the output string was at position 16 of the input
string.
S1 (hex)
e 4 d 1 2 f b 8 3 a 6 c 5 9 0 7
0 f 7 4 e 2 d 1 a 6 c b 9 5 3 8
4 1 e 8 d 6 2 b f c 9 7 3 a 5 0
f c 8 2 4 9 1 7 5 b 3 e a 0 6 d
S2 (hex)
f 1 8 e 6 b 3 4 9 7 2 d c 0 5 a
3 d 4 7 f 2 8 e c 0 1 a 6 9 b 5
0 e 7 b a 4 d 1 5 8 c 6 9 3 2 f
d 8 a 1 3 f 4 2 b 6 7 c 0 5 e 9
S3 (hex)
a 0 9 e 6 3 f 5 1 d c 7 b 4 2 8
d 7 0 9 3 4 6 a 2 8 5 e c b f 1
d 6 4 9 8 f 3 0 b 1 2 c 5 a e 7
1 a d 0 6 9 8 7 4 f e 3 b 5 2 c
H0= IV
Hi= f(Hi-1, xi)
Compression
h(x)= g(ht)
Function (f)
Hash Value
512-bit input
160 bits of state
Compression
Function
Construction 1
Hi= E(g(Hi-1), xi) Hi-1
Construction 2
Hi= E(xi, Hi-1) Hi-1
Construction 3
Hi= E(g(Hi-1), xi) xi Hi-1
Note: Because of collisions n should be >64. Ideally, m=n and g= id. DES
with n= 64 is too small. AES with n=m=128 is better.
• SHA-1 has stood up best: best known theoretical attack (11/05) requires
263 operations.
ALLPE RSONS BORNO RNATU RALIZ EDINT HEUNI TEDST ATESA NDSUB JECTT
OTHEJ URISD ICTIO NTHER EOFAR ECITI ZENSO FTHEU NITED STATE SANDO
FTHES TATEW HEREI NTHEY RESID ENOST ATESH ALLMA KEORE NFORC EANYL
AWWHI CHSHA LLABR IDGET HEPRI VILEG ESORI MMUNI TIESO FCITI ZENSO
FTHEU NITED STATE SNORS HALLA NYSTA TEDEP RIVEA NYPER SONOF LIFEL
IBERT YORPR OPERT YWITH OUTDU EPROC ESSOF LAWNO RDENY TOANY PERSO
NWITH INITS JURIS DICTI ONTHE EQUAL PROTE CTION OFTHE LAWS
IGDLK MJSGC FMGEP PLYRC IGDLA TYBMR KDYVY XJGMR TDSVK ZCCWG ZRRIP
UERXY EEYHE UTOWS ERYWC QRRIP UERXJ QREWQ FPSZC ALDSD ULSWF FFOAM
DIGIY DCSRR AZSRB GNDLC ZYDMM ZQGSS ZBCXM OYBID APRMK IFYWF MJVLY
HCLSP ZCDLC NYDXJ QYXHD APRMQ IGNSU MLNLG EMBTF MLDSB AYVPU TGMLK
MWKGF UCFIY ZBMLC DGCLY VSCXY ZBVEQ FGXKN QYMIY YMXKM GPCIJ HCCEL
PUSXF MJVRY FGYRQ
Lamps
U R
Keyboard