Data Encryption Standard - DES and Other Symmetric Block Ciphers
Data Encryption Standard - DES and Other Symmetric Block Ciphers
1
= E(R
0
) K
1
= ( 010010 000010 000110 010111
011011 111001 101001 110011)
S
5
01
(1101) = S
5
1
(13) = 9 = 1001
S
6
11
(1100) = S
6
3
(12) = 6 = 0110
S
7
11
(0100) = S
7
3
(4) = 1 = 0001
S
8
11
(1001) = S
8
3
(9) = 12 = 1100
49
DES Example - Data
B
1
= (1010 0001 1110 1100 1001 0110 0001 1100)
P(B
1
) = (0010 1011 1010 0001 0101 0011 0110 1100)
R
1
= P(B
1
) L
0
= (1000 0101 1011 1010 1111 0010 1110 0101)
8 5 B A F 2 E 5
50
DES Example - Data
L
1
= (1101 1100 0001 1111 0001 0000 1111 0100)
D C 1 F 1 0 F 4
E(R
1
) = ( 110000 001011 110111 110101
011110 100101 011100 001011)
2
= E(R
1
) K
2
= ( 000110 100010 110000 101000
101011 011110 000001 000011)
51
DES Example - Data
S
1
00
(0011) = S
1
1
(3) = 1 = 0001
S
2
10
(0001) = S
2
3
(1) = 14 = 1110
S
3
10
(1000) = S
3
3
(8) = 11 = 1011
S
4
10
(0100) = S
4
3
(4) = 12 = 1100
S
5
11
(0101) = S
5
1
(5) = 14 = 1110
S
6
00
(1111) = S
6
3
(15) = 11 = 1011
S
7
01
(0000) = S
7
3
(0) = 13 = 1101
S
8
01
(0001) = S
8
3
(1) = 15 = 1111
52
DES Example - Data
B
2
= (0001 1110 1011 1100 1110 1011 1101 1111)
P(B
2
) = (0101 1111 0011 1110 0011 1001 1111 0111)
R
2
= P(B
2
) L
1
= (1000 0011 0010 0001 0010 1001 0000 0011)
8 3 2 1 2 9 0 3
L
2
= R
1
= (1000 0101 1011 1010 1111 0010 1110 0101)
8 5 B A F 2 E 5
53
DES Example - Data - Done !
Y = (y
1
, y
2
,y
3
, , y
64
)
= ( 1101 0111 0110 1001 1000 0010 0010 0100
0010 1000 0011 1110 0000 1010 1110 1010)
= ( D 7 6 9 8 2 2 4 2 8 3 E 0 A E A)
54
DES Modes of Use
DES encrypts 64-bit blocks of data, using a 56-bit key
We need some way of specifying how to use it in
practice, given that we usually have an arbitrary
amount of information to encrypt
The way we use a block cipher is called its Mode of
Use and four have been defined for the DES by ANSI
in the standard: ANSI X3.106-1983 Modes of Use)
55
DES Modes of Use
DES Modes of Use are either:
Block Modes
Splits messages in blocks (ECB, CBC)
Stream Modes
On byte stream messages (CFB, OFB)
56
Block Modes - ECB
Electronic Codebook Book (ECB)
where the message is broken into independent 64-
bit blocks which are encrypted
C(i) = DES
K
(P(i))
57
Subverting DES in ECB
Mode
A d a m s , L e s l i e C l e r k $ 1 0
B l a c k , R o b i n B o s s $ 5 0 0
C o l l i n s , K i m M a n a g e r $ 1 0 0
D a v i s , B o b b i e J a n i t o r $ 5
16 8 8
Bytes
Name Position Bonus
58
Block Modes - CBC
Cipher Block Chaining (CBC)
Again the message is broken into 64-bit blocks, but
they are linked together in the encryption operation
with an IV
C(i) = DES
K
(P(i) C(i-1))
C(-1)= IV
59
Cipher Block Chaining
(CBC)
Key
XOR
E
P
0
C
0
IV
XOR
E
P
1
C
1
XOR
E
P
2
C
2
XOR
E
P
3
C
3
Key
IV
XOR
D
C
0
P
0
XOR
D
C
1
P
1
XOR
D
C
2
P
2
XOR
D
C
3
P
3
60
Stream Modes - CFB
Cipher FeedBack (CFB)
where the message is treated as a stream of bytes,
added to the output of the DES, with the result
being feed back for the next stage
C
i
= P
i
SLMB(DES
K
(C(i-1)))
C
i
= SLMB(DES
K
(C(i-1)))
C(-1)= IV
C(i) = C
i-1
|| C
i-2
|| C
i-3
|| C
i-4
||
C
i-5
|| C
i-6
|| C
i-7
|| C
i-8
||
61
Stream Modes - CFB
XOR
E
C
2
C
3
C
4
C
5
C
6
C
7
C
8
C
9
SLMB
P
10
Key
DES Encryption
Box
Select Left Most
Byte
C
10
C
10
64-bit Shift Register
C(10)
62
Stream Modes - OFB
Output FeedBack (OFB)
where the message is treated as a stream of bytes,
added to the message, but with the feedback being
independent of the message
C
i
= P
i
O
i
O
i
= SLMB(DES
K
(O(i-1)))
O(-1)= IV
O(i) = O
i-1
|| O
i-2
|| O
i-3
|| O
i-4
||
O
i-5
|| O
i-6
|| O
i-7
|| O
i-8
||
63
Stream Modes - OFB
XOR
E
O
2
O
3
O
4
O
5
O
6
O
7
O
8
O
9
SLMB
P
10
Key
DES Encryption
Box
Select Left Most
Byte
C
10
O
10
64-bit Shift Register
O(10)
64
Limitations of Various
Modes - ECB
Repetitions in message can be reflected in
ciphertext, if aligned with message block.
Particularly with data such graphics.
Or with messages that change very little, which
become a code-book analysis problem.
Weakness is because enciphered message
blocks are independent of each other.
Can be solved using CBC.
65
Limitations of Various
Modes - CBC
Uses result of one encryption to modify input of
next.
Hence each ciphertext block is dependent on all
message blocks before it.
Thus a change in the message affects the
ciphertext block after the change as well as the
original block.
Susceptible to errors. Error in a single block
make all the subsequent blocks useless.
66
Triple DES - More Secure
DES
E
K
1
D
K
2
E
K
1
Ciphertext Plaintext
Encryption
A B
D
K
1
E
K
2
D
K
1
Plaintext Ciphertext
Decryption
B A
Why not Double DES?
Why Triple DES with two Keys?
Why EDE?
67
IDEA
International Data Encryption Algorithm also known
as Proposed Encryption Standard PES
European origins free from any NSA tampering
64-bit block cipher
128-bit key
Fast in software on general purpose processors
Consists of three basic operations:
XOR
Addition modulo 2
16
Multiplication modulo 2
16
+ 1
68
GOST
64-bit block cipher from USSR
256-bit key (up to 610 bits key considering S-boxes)
Better suited to software implementation than DES
32 rounds
For the i-th round
L
i
=R
i-1
R
i
=L
i-1
f(R
i-1
, K
i
)
f consists of:
Add right half and the i-th subkey modulo 2
32
Break result into 8 4-bit chunks and input into a different S-box
Outputs of all S-boxes are recombined
11-bit left circular shift
XOR with the left half
69
One Round of GOST
L
i-1
R
i-1
Choose One Subkey
S-Box Substitution
Left Circular Shift
L
i
R
i
S-boxes in GOST are
user defined and provide
additional keying material
8 32-bit Subkeys are
derived from 256-bit key
and are repeatedly used
according to the key
schedule of GOST
70
GOST S-Boxes and
Subkeys
Round
Number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Subkey 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
Round
Number
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Subkey 1 2 3 4 5 6 7 8 8 7 6 5 4 3 2 1
S-box 1:
4 10 9 2 13 8 0 14 6 11 1 12 7 15 5 3
S-box 2:
14 11 4 12 6 13 15 10 2 3 8 1 0 7 5 9
71
BLOWFISH
Designed by Bruce Schneier
Fast on 32-bit microprocessors
Compact
Simple
Variable key lengths up to 448-bits
Uses a large number of subkeys
16 iterations/rounds
Each round consists of a key-dependent permutation and
A key- and data-dependent substitution
All operations are additions and XORs on 32-bit words
72
RC5
Designed by Professor Ronald Rivest of MIT
Rons Cipher (RC) others also exist RC2,
RC4, RC6
Supports a variety of block sizes, key sizes and
number of rounds
Three basic operations
XOR
Addition
Rotations
Patented by RSADSI
73
AES
A replacement for DES after a very long time
Result of an open, international competition conducted
by NIST
Five finalists
MARS
Serpent
Twofish
RC6
Rijendael
Rijendael finally chosen as AES
74
AES
Design criteria included:
Security
Speed on a variety of platforms hardware,
software, smartcards, microcontrollers
Rijendael European submission finally chosen
as AES