Trible Data Encryption Standard
(3DES)
Prepared by: Ahmed Mohamed
Ahmedmohamed.eece@gmail.com
Contents:
Introduction: a short history of DES
 Basic Terminology
 DES
 3DES
 Simulations
Introduction:
• The Data Encryption Standard (DES) is a symmetric-key block cipher published by
the National Institute of Standards and Technology (NIST).
• DES was developed as a standard for communications and data protection by an
IBM research team, in response to a public request for proposals by the NBS - the
National Bureau of Standards (which is now known as NIST).
Basic Terminology
• plaintext - the original message
• ciphertext - the coded message
• cipher - algorithm for transforming plaintext to ciphertext
• key - info used in cipher known only to sender/receiver
• encipher (encrypt) - converting plaintext to ciphertext
• decipher (decrypt) - recovering ciphertext from plaintext
• Permutation !
Permutation:
…….
……..
1 2 3 4 32
22 6 13 32 3
Input:
Output
0 0 1 0 1
1 0 1 1 1
1 bit
DES
Key: 64 bit quantity=8-bit parity+56-bit key
Every 8th bit is a parity bit.
64 bit input, 64 bit output.
DES STRUCTURE
Initial and Final Permutations
Continue
Example:
• Find the output of the initial permutation box when the input is given in
hexadecimal as:
• Solution:
Only bit 25 and bit 63 are 1s; the other bits are 0s. In the final permutation, bit 25
becomes bit 64 and bit 63 becomes bit 15. The result is
Initial Permutations VHDL Code
Note
DES top view
Permutation
Permutation
Swap
Round 1
Round 2
Round 16
Generate keys
Initial Permutation
48-bit K1
48-bit K2
48-bit K16
Swap 32-bit halves
Final Permutation
64-bit Output
48-bit K164-bit Input
56-bit Key
…...
DES
64 bit plaintext block
IP
L0 R0
L1=R0 R1=L0 f(R0,K1)
f
K1 (derived from
56 bit key)=48 bit
L16=R15
f
K16 (derived from
56 bit key)= 48 bit
IP-1
repeat 16 times…
64 bit ciphertext block
R16=L15 f(R15,K16)
32 32


Per-Round Key Generation
28 bits 28 bits
48 bits
Ki
One
round
Circular Left Shift Circular Left Shift
28 bits 28 bits
Permutation
with Compression,
PC-2
Initial Permutation of DES key ,PC-1
C i-1 D i-1
C i D i
Key generation:
• Parity-bit drop table:
Key-compression table:
Rounds
𝐿 𝑛 = 𝑅 𝑛−1
L0 R0
L1 R1
48 bit subkey
Generator
K48 = g(i,K56)
(The key for
each round is
deterministically
found from the
input 56 bit key).
Expansion Permutation
S-Box Substitution
P-Box Permutation
32
48
48
48
32
32
3232
32
Expansion P-box
• Since RI−1 is a 32-bit input and KI is a 48-bit key, we first need to expand RI−1 to
48 bits.
Continue
• Although the relationship between the input and output can be defined
mathematically, DES uses Table to define this P-box.
Expansion P-box VHDL Code
S-Boxes
• The S-boxes do the real mixing (confusion). DES uses 8 S-boxes, each with a 6-bit
input and a 4-bit output.
S-box rule
S-box
1
14 4 13 1 2 15 11 8
3 10 6 12 5 9 0 7
0 15 7 4 14 2 13 1
10 6 12 11 9 5 3 8
4 1 14 8 13 6 2 11
15 12 9 7 3 10 5 0
15 12 8 2 4 9 1 7
5 11 3 14 10 0 6 13
Pageselect
Example:
• The input to S-box 1 is 100011. What is the output?
• Answer:
• If we write the first and the sixth bits together, we get 11 in binary, which is 3 in
decimal. The remaining bits are 0001 in binary, which is 1 in decimal. We look for the
value in row 3, column 1, in Table (S-box 1).
• The result is 12 in decimal, which in binary is 1100. So the input 100011 yields the output
1100.
S-Box1 VHDL Code
And So on ..
Straight Permutation
Straight Permutation VHDL Code
Decryption
• The same algorithm as encryption.
• Reversed the order of key (Key16, Key15, … Key1).
• For example:
IP undoes IP-1 step of encryption.
1st round with SK16 undoes 16th encrypt round.
DES Security:
• Not too good:
• Trying all 256 possible keys
is not that hard these days.
• If you spend ~$25k you can build
a DES password cracker that can
will succeed in a few hours.
• The major criticism of DES regards its key length. Fortunately DES is not a group.
This means that we can use double or triple DES to increase the key size.
Triple DES - More Secure
True cryptographic strength of 3DES key is 2x56 bits = 112 bits
Ci  EK3
DK2
EK1
Pi   
Triple DES - More Secure
Triple DES with two keys
• Run DES three times
Why Encrypt then Decrypt then
Encrypt with 2 keys?!
• Backwards compatibility
• If K2 = K3, this is DES
E(D(E(P,K),K),K)= E(P,K)
C=E(D(E(P,K1),K2),K1)
P=D(E(D(C,K1),K2),K1)
Comparison
Simulation:K1=K2=K3: Encryption
Simulation:K1=K2=K3: Decryption
Simulation:K1=K3: Encryption
Simulation:K1=K3: Decryption
Simulation:K1≠K2≠K3: Encryption
Simulation:K1≠K2≠K3: Decryption
Any Questions ?
Thank You

Trible data encryption standard (3DES)

  • 1.
    Trible Data EncryptionStandard (3DES) Prepared by: Ahmed Mohamed Ahmedmohamed.eece@gmail.com
  • 2.
    Contents: Introduction: a shorthistory of DES  Basic Terminology  DES  3DES  Simulations
  • 3.
    Introduction: • The DataEncryption Standard (DES) is a symmetric-key block cipher published by the National Institute of Standards and Technology (NIST). • DES was developed as a standard for communications and data protection by an IBM research team, in response to a public request for proposals by the NBS - the National Bureau of Standards (which is now known as NIST).
  • 4.
    Basic Terminology • plaintext- the original message • ciphertext - the coded message • cipher - algorithm for transforming plaintext to ciphertext • key - info used in cipher known only to sender/receiver • encipher (encrypt) - converting plaintext to ciphertext • decipher (decrypt) - recovering ciphertext from plaintext • Permutation !
  • 5.
    Permutation: ……. …….. 1 2 34 32 22 6 13 32 3 Input: Output 0 0 1 0 1 1 0 1 1 1 1 bit
  • 6.
    DES Key: 64 bitquantity=8-bit parity+56-bit key Every 8th bit is a parity bit. 64 bit input, 64 bit output.
  • 7.
  • 8.
    Initial and FinalPermutations
  • 9.
  • 10.
    Example: • Find theoutput of the initial permutation box when the input is given in hexadecimal as: • Solution: Only bit 25 and bit 63 are 1s; the other bits are 0s. In the final permutation, bit 25 becomes bit 64 and bit 63 becomes bit 15. The result is
  • 11.
  • 12.
  • 13.
    DES top view Permutation Permutation Swap Round1 Round 2 Round 16 Generate keys Initial Permutation 48-bit K1 48-bit K2 48-bit K16 Swap 32-bit halves Final Permutation 64-bit Output 48-bit K164-bit Input 56-bit Key …...
  • 14.
    DES 64 bit plaintextblock IP L0 R0 L1=R0 R1=L0 f(R0,K1) f K1 (derived from 56 bit key)=48 bit L16=R15 f K16 (derived from 56 bit key)= 48 bit IP-1 repeat 16 times… 64 bit ciphertext block R16=L15 f(R15,K16) 32 32  
  • 15.
    Per-Round Key Generation 28bits 28 bits 48 bits Ki One round Circular Left Shift Circular Left Shift 28 bits 28 bits Permutation with Compression, PC-2 Initial Permutation of DES key ,PC-1 C i-1 D i-1 C i D i
  • 16.
  • 17.
    • Parity-bit droptable: Key-compression table:
  • 18.
    Rounds 𝐿 𝑛 =𝑅 𝑛−1
  • 19.
    L0 R0 L1 R1 48bit subkey Generator K48 = g(i,K56) (The key for each round is deterministically found from the input 56 bit key). Expansion Permutation S-Box Substitution P-Box Permutation 32 48 48 48 32 32 3232 32
  • 20.
    Expansion P-box • SinceRI−1 is a 32-bit input and KI is a 48-bit key, we first need to expand RI−1 to 48 bits.
  • 21.
    Continue • Although therelationship between the input and output can be defined mathematically, DES uses Table to define this P-box.
  • 22.
  • 23.
    S-Boxes • The S-boxesdo the real mixing (confusion). DES uses 8 S-boxes, each with a 6-bit input and a 4-bit output.
  • 24.
    S-box rule S-box 1 14 413 1 2 15 11 8 3 10 6 12 5 9 0 7 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13 Pageselect
  • 25.
    Example: • The inputto S-box 1 is 100011. What is the output? • Answer: • If we write the first and the sixth bits together, we get 11 in binary, which is 3 in decimal. The remaining bits are 0001 in binary, which is 1 in decimal. We look for the value in row 3, column 1, in Table (S-box 1). • The result is 12 in decimal, which in binary is 1100. So the input 100011 yields the output 1100.
  • 26.
  • 27.
  • 28.
  • 29.
    Decryption • The samealgorithm as encryption. • Reversed the order of key (Key16, Key15, … Key1). • For example: IP undoes IP-1 step of encryption. 1st round with SK16 undoes 16th encrypt round.
  • 30.
    DES Security: • Nottoo good: • Trying all 256 possible keys is not that hard these days. • If you spend ~$25k you can build a DES password cracker that can will succeed in a few hours. • The major criticism of DES regards its key length. Fortunately DES is not a group. This means that we can use double or triple DES to increase the key size.
  • 31.
    Triple DES -More Secure True cryptographic strength of 3DES key is 2x56 bits = 112 bits Ci  EK3 DK2 EK1 Pi   
  • 32.
    Triple DES -More Secure Triple DES with two keys • Run DES three times Why Encrypt then Decrypt then Encrypt with 2 keys?! • Backwards compatibility • If K2 = K3, this is DES E(D(E(P,K),K),K)= E(P,K) C=E(D(E(P,K1),K2),K1) P=D(E(D(C,K1),K2),K1)
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.

Editor's Notes

  • #8 The encryption process is made of two permutations (P-boxes), which we call initial and final permutations, and sixteen Feistel rounds.
  • #30 DES Decryption i) Use same function ii) Key is the key… Used in reverse order (K1,…, K16 becomes K16,…, K1) Right circular shift of 0-2 bits 0 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1) With DES it is possible to use the same function to encrypt or decrypt a block. The only difference is that the keys must be used in the reversed order. That is , if the encryption keys for each round are K1,K2,K3,…K16, then the decryption keys are K16, K15, K14, …,K1.The algorithm that generates the key used for each round is circular as well. The key shift is shown above.