UNIT-2
Stream ciphers
and block ciphers
Unit-2
 Stream ciphers and block ciphers
 Block Cipher structure
 Data Encryption standard (DES)
 Design principles of block cipher
 AES with structure
 AES Transformation functions
 Key expansion
Stream Cipher
 A stream cipher is one that encrypts a digital data stream one bit
or one byte at a time.
 Examples of classical stream ciphers are Autokeyed Vigenère
cipher ,A5/1, RC4 and Vernam cipher.
Block Cipher
 A block cipher is one in which a block of plaintext is treated as a
whole and used to produce a ciphertext block of equal length.
 Typically, a block size of 64 or 128 bits is used.
 Examples are Feistel Cipher, DES, Triple DES and AES
Diffusion and Confusion
 Diffusion hides the relationship between the ciphertext and the
plaintext.
 This is achieved by having each plaintext digit affect the value of
many ciphertext digits.
 Confusion hides the relationship between the ciphertext and the
key.
 This is achieved by the use of a complex substitution algorithm.
Round 1
Plaintext (2w bits)
F
w bits
w bits R0
L0
K1
R1
L1
Rn+1
Ln+1
Round i
F
Ki
Ri
Li
Round n
F
Kn
Ln Rn
Rn
Ln
Ciphertext (2w bits)
Feistel Cipher Structure
Or Block Cipher Structure
Feistel Cipher Structure
 Input plaintext block of length 2w bits
 key K = n bits , Sub-keys: K1, K2, …, Kn (Derived from K)
 All rounds have the same structure.
 A substitution is performed by taking exclusive-OR on left half(Li)
of the data and the output of round function F which has inputs
right half(Ri) and sub key ki.
 A permutation is performed that consists of interchange of two
halves of data.
 This structure is called Substitution-Permutation Network (SPN)
Feistel Network Factors
 Block size: Common block size of 64-bit. However, the new
algorithms uses a 128-bit, 256-bit block size.
 Key size: Key sizes of 64 bits or less are now widely considered to
be insufficient, These days at least 128 bit, more better, e.g. 192 or
256 bit
 Number of rounds: A typical size is 16 rounds.
 Round function F: Again, greater complexity generally means
greater resistance to cryptanalysis.
 Subkey generation algorithm: Greater complexity in this
algorithm should lead to greater difficulty of cryptanalysis.
Feistel Encryption & Decryption
 Prove that o/p of first round
of Decryption is equal to 32-
bit swap of i/p of 16th
round of
Encryption
 LD1=RE15 & RD1=LE15
𝐿𝐸16=𝑅 𝐸15
𝑅𝐸16=𝐿𝐸15 ⊕ 𝐹(𝑅𝐸15 ,𝐾16)
 On Encryption Side:
𝐿𝐷1=𝑅𝐷0=𝐿𝐸16=𝑅𝐸15
𝑅𝐷1=𝐿 𝐷0⊕ 𝐹 (𝑅 𝐷0 ,𝐾16)
 On Decryption Side:
¿ 𝑅𝐸16 ⊕ 𝐹 (𝑅𝐸15 , 𝐾 16 )
¿[𝐿𝐸¿¿15⊕𝐹 (𝑅𝐸15 , 𝐾16)] ⊕𝐹 (𝑅𝐸15 , 𝐾16)¿
XOR Associativity
Property
Data Encryption Standard (DES)
 Type: Block Cipher
 Block Size : 64-bit
 Key Size: 64-bit, with only 56-bit effective
 Number of Rounds: 16
Initial Permutation
Round 1
Round 2
Round 16
32-bit swap
Inverse
Initial Permutation
Permuted choice 2
Permuted choice 1
Left circular shift
Permuted choice 2 Left circular shift
Permuted choice 2 Left circular shift
64-bit plaintext 64-bit key
64-bit ciphertext
64 56
64
64
56
56
56
56
48
K1
48
K2
48
K16
DES Encryption
Algorithm
DES Encryption Algorithm (Cont…)
 First, the 64-bit plaintext passes through an initial permutation
(IP) that rearranges the bits to produce the permuted input.
 This is followed by a phase consisting of sixteen rounds of the
same function, which involves both permutation and substitution
functions.
 Finally, the preoutput is passed through a permutation that is the
inverse of the initial permutation function, to produce the 64-bit
ciphertext.
 The 56-bit key is passed through a permutation function.
 For each of the sixteen rounds, a subkey (Ki) is produced by the
combination of a left circular shift and a permutation.
DES Single Round
𝐿𝑖 −1
32-bits
𝑅𝑖 −1
32-bits
𝐶𝑖 − 1
28-bits
𝐷𝑖 −1
28-bits
Expansion/ permutation
(E table)
XOR
Substitution/choice
(S-box)
Permutation
(P)
XOR
𝐿𝑖 𝑅𝑖 𝐶 𝑖 𝐷𝑖
Left Shift
(S)
Left Shift
(S)
Permutation/
compression
(Permuted choice 2)
48
Ki
48
48
32
32
DES Single Round (Cont…)
1. Key Transformation
• Permutation of selection of sub-key from original key
2. Expansion Permutation (E-table)
• Right half is expanded from 32-bits to 48-bits
3. S-box Substitution
• Accepts 48-bits from XOR operation and produce 32-bits using
8 substitution boxes (each S-boxes has a 6-bit i/p and 4-bit
o/p).
4. P-Box Permutation
5. XOR and Swap
Role of S-box
Role of S-box (Cont…)
 The outer two bits of each group select one row of an S-box.
 Inner four bits selects one column of an S-box.
 Example:
S-box 1
0 1 1 0 0 1
Row Column
Input Output 1 0 0 1
Avalanche Effect
 Desirable property of any encryption algorithm is that a change in
one bit of the plaintext or of the key should produce a change in
many bits of cipher text.
 DES performs strong avalanche effect.
 Although the two plaintext blocks differ only in the rightmost bit,
the ciphertext blocks differ in 29 bits.
 This means that changing approximately 1.5 % of the plaintext
creates a change of approximately 45 % in the ciphertext.
AES (Advanced Encryption Standard)
 The Rijndael proposal for AES defined a cipher in which the block length
and the key length can be independently specified to be 128, 192, or 256
bits.
 AES designed to have characteristics
1. Resistance against all known attacks
2. Speed and code compactness on a wide range of platforms
3. Design simplicity
Key size (words/ bytes/ bits) 4/16/128 6/24/192 8/32/256
Block size (words/ bytes/ bits) 4/16/128 4/16/128 4/16/128
Round key size (words/ bytes/ bits) 4/16/128 4/16/128 4/16/128
Number of Rounds 10 12 14
AES (Advanced Encryption Standard)
AES
Plaintext (128 bits)
Ciphertext (128 bits)
Key (128-256 bits)
AES Structure
Initialization
1. Expand 16-byte key to get
the actual key block to be
used.
2. Initialize 16-byte plaintext
block called as state.
3. XOR the state with the key
block.
For each round
1. Apply S-box
2. Rotate rows of state
3. Mix columns
4. Add Round key: XOR the
state with key block.
Data Units in AES
Block to State & State to Block
Plain Text to State
AES Structure
 The first N-1 rounds consist of four distinct transformation
functions.
• The 16 input bytes are substituted using an S-
box
SubBytes
• Each of the four rows of the matrix is shifted
to the left
ShiftRows
• Each column of four bytes is now transformed
using a special mathematical function.
MixColumns
• The 16 bytes of the matrix are now considered as
128 bits and are XORed to the 128 bits of the
round key.
AddRoundKey
SubByte Transformation
 The forward substitute byte transformation, called SubBytes, is a
simple table lookup
ShiftRows
 The first row of State is not altered.
 For the second row, a 1-byte circular left shift is performed.
 For the third row, a 2-byte circular left shift is performed.
 For the fourth row, a 3-byte circular left shift is performed.
MixColumns
 Each byte of a column is mapped into a new value that is a
function of all four bytes in that column.
AddRoundKey
 In the forward add round key transformation, the 128 bits of State
are bitwise XORed with the 128 bits of the round key.
State Round Key
AES Overall Structure
 The AES key expansion algorithm takes as
input a four-word (16-byte) key and produces
a linear array of 44 words (176 bytes).
 Each added word w[i] depends on the
immediately preceding word, w[i - 1].
 In three out of four cases, a simple XOR is
used.
AES Key Expansion
Key Expansion Example

More Related Content

PPTX
Stream Ciphers and Block Ciphers in Security.pptx
PDF
sheet4.pdf
PDF
paper4.pdf
PDF
lecture3.pdf
PDF
doc4.pdf
PDF
doc4.pdf
PDF
chap3.pdf
PPTX
Block ciphers & public key cryptography
Stream Ciphers and Block Ciphers in Security.pptx
sheet4.pdf
paper4.pdf
lecture3.pdf
doc4.pdf
doc4.pdf
chap3.pdf
Block ciphers & public key cryptography

Similar to Information and Network Security types of cipher (20)

PDF
Network security R.Rathna Deepa 2nd M.sc.,Computer Science
PDF
Data encryption techniques and standard
PPTX
PPTX
Cryptographic algorithms
PPTX
Cryptographic algorithms
PPT
4255596.ppt
PPTX
Block Ciphers and DES.pptx
PPTX
Software EngineeringModule 2 (Complete).pptx
PPTX
Cyber security
PPTX
Lecture 05 - 04 Nov 21.pptx
PPTX
Module 2.pptx
PPT
block ciphers
PPTX
Information and data security block cipher and the data encryption standard (...
PDF
Network Security UNIT-II
PDF
Block Ciphers and the Data Encryption Standard
PPTX
Block Ciphers Data Encryption Advanced Encryption
PPT
AES.ppt
PPTX
Block Cipher.cryptography_miu_year5.pptx
PDF
CRYPTOGRAPHY AND NETWORK SECURITY
PPTX
information security(Feistal Cipher)
Network security R.Rathna Deepa 2nd M.sc.,Computer Science
Data encryption techniques and standard
Cryptographic algorithms
Cryptographic algorithms
4255596.ppt
Block Ciphers and DES.pptx
Software EngineeringModule 2 (Complete).pptx
Cyber security
Lecture 05 - 04 Nov 21.pptx
Module 2.pptx
block ciphers
Information and data security block cipher and the data encryption standard (...
Network Security UNIT-II
Block Ciphers and the Data Encryption Standard
Block Ciphers Data Encryption Advanced Encryption
AES.ppt
Block Cipher.cryptography_miu_year5.pptx
CRYPTOGRAPHY AND NETWORK SECURITY
information security(Feistal Cipher)
Ad

Recently uploaded (20)

PPTX
Blue And White Modern Business Presentation.pptx
PDF
karuna yoga vidya peetham school Unique Lineage.pdfTTC
PPTX
Paper 3.pptx complete the hgakaho isgwoiwgbsiw isgeueuebeois aosgwjkw sist3be...
PPTX
materi minggu ke 5.ppt mata kuliah mobile
PPTX
BIOS-and-VDU-The-Foundations-of-Computer-Startup-and-Display (1).pptx
PPTX
Ch06. CDR (CRM_Clarity) EPP E2 E3 CFA (1).pptx
PDF
Salesforce-Proxy-Statement-Supplement-May-2025.pdf
PDF
THE UNTOLD STORY OF SWAMI VIJAY KUMAR DURAI BUILDING PRS INTERNATIONAL Contac...
PPT
Comparison of 2 Population Kuch toh bhadwa chodi karwa raha
PDF
Website Design Services Maintenance - Ongoing Support & Updates.pdf
PPTX
日本横滨国立大学毕业证书文凭定制YNU成绩单硕士文凭学历认证
PPTX
Network wired & wireless network ppt for
PPTX
Data Flows presentation hubspot crm.pptx
PPT
SEMOGA BERMANFAAT MATERI DASAR KOMPUTER.ppt
PDF
Manifestation and the End of Poverty_ A Vision for Human Potential.pdf
PPTX
Internet_Addiction_Presentation_2025.pptx
PPTX
Unguided-Transmission-Media-Wireless-Communication-Explained.pptx
PPTX
How social media influences our body image.pptx
PPTX
c_languagew_structure_and_functions.pptx
PPTX
REE IN CARBONATITE EEPOSIT AND INCLUDE CASE STUDY ON AMBADUNGAR
Blue And White Modern Business Presentation.pptx
karuna yoga vidya peetham school Unique Lineage.pdfTTC
Paper 3.pptx complete the hgakaho isgwoiwgbsiw isgeueuebeois aosgwjkw sist3be...
materi minggu ke 5.ppt mata kuliah mobile
BIOS-and-VDU-The-Foundations-of-Computer-Startup-and-Display (1).pptx
Ch06. CDR (CRM_Clarity) EPP E2 E3 CFA (1).pptx
Salesforce-Proxy-Statement-Supplement-May-2025.pdf
THE UNTOLD STORY OF SWAMI VIJAY KUMAR DURAI BUILDING PRS INTERNATIONAL Contac...
Comparison of 2 Population Kuch toh bhadwa chodi karwa raha
Website Design Services Maintenance - Ongoing Support & Updates.pdf
日本横滨国立大学毕业证书文凭定制YNU成绩单硕士文凭学历认证
Network wired & wireless network ppt for
Data Flows presentation hubspot crm.pptx
SEMOGA BERMANFAAT MATERI DASAR KOMPUTER.ppt
Manifestation and the End of Poverty_ A Vision for Human Potential.pdf
Internet_Addiction_Presentation_2025.pptx
Unguided-Transmission-Media-Wireless-Communication-Explained.pptx
How social media influences our body image.pptx
c_languagew_structure_and_functions.pptx
REE IN CARBONATITE EEPOSIT AND INCLUDE CASE STUDY ON AMBADUNGAR
Ad

Information and Network Security types of cipher

  • 2. Unit-2  Stream ciphers and block ciphers  Block Cipher structure  Data Encryption standard (DES)  Design principles of block cipher  AES with structure  AES Transformation functions  Key expansion
  • 3. Stream Cipher  A stream cipher is one that encrypts a digital data stream one bit or one byte at a time.  Examples of classical stream ciphers are Autokeyed Vigenère cipher ,A5/1, RC4 and Vernam cipher.
  • 4. Block Cipher  A block cipher is one in which a block of plaintext is treated as a whole and used to produce a ciphertext block of equal length.  Typically, a block size of 64 or 128 bits is used.  Examples are Feistel Cipher, DES, Triple DES and AES
  • 5. Diffusion and Confusion  Diffusion hides the relationship between the ciphertext and the plaintext.  This is achieved by having each plaintext digit affect the value of many ciphertext digits.  Confusion hides the relationship between the ciphertext and the key.  This is achieved by the use of a complex substitution algorithm.
  • 6. Round 1 Plaintext (2w bits) F w bits w bits R0 L0 K1 R1 L1 Rn+1 Ln+1 Round i F Ki Ri Li Round n F Kn Ln Rn Rn Ln Ciphertext (2w bits) Feistel Cipher Structure Or Block Cipher Structure
  • 7. Feistel Cipher Structure  Input plaintext block of length 2w bits  key K = n bits , Sub-keys: K1, K2, …, Kn (Derived from K)  All rounds have the same structure.  A substitution is performed by taking exclusive-OR on left half(Li) of the data and the output of round function F which has inputs right half(Ri) and sub key ki.  A permutation is performed that consists of interchange of two halves of data.  This structure is called Substitution-Permutation Network (SPN)
  • 8. Feistel Network Factors  Block size: Common block size of 64-bit. However, the new algorithms uses a 128-bit, 256-bit block size.  Key size: Key sizes of 64 bits or less are now widely considered to be insufficient, These days at least 128 bit, more better, e.g. 192 or 256 bit  Number of rounds: A typical size is 16 rounds.  Round function F: Again, greater complexity generally means greater resistance to cryptanalysis.  Subkey generation algorithm: Greater complexity in this algorithm should lead to greater difficulty of cryptanalysis.
  • 9. Feistel Encryption & Decryption  Prove that o/p of first round of Decryption is equal to 32- bit swap of i/p of 16th round of Encryption  LD1=RE15 & RD1=LE15 𝐿𝐸16=𝑅 𝐸15 𝑅𝐸16=𝐿𝐸15 ⊕ 𝐹(𝑅𝐸15 ,𝐾16)  On Encryption Side: 𝐿𝐷1=𝑅𝐷0=𝐿𝐸16=𝑅𝐸15 𝑅𝐷1=𝐿 𝐷0⊕ 𝐹 (𝑅 𝐷0 ,𝐾16)  On Decryption Side: ¿ 𝑅𝐸16 ⊕ 𝐹 (𝑅𝐸15 , 𝐾 16 ) ¿[𝐿𝐸¿¿15⊕𝐹 (𝑅𝐸15 , 𝐾16)] ⊕𝐹 (𝑅𝐸15 , 𝐾16)¿ XOR Associativity Property
  • 10. Data Encryption Standard (DES)  Type: Block Cipher  Block Size : 64-bit  Key Size: 64-bit, with only 56-bit effective  Number of Rounds: 16
  • 11. Initial Permutation Round 1 Round 2 Round 16 32-bit swap Inverse Initial Permutation Permuted choice 2 Permuted choice 1 Left circular shift Permuted choice 2 Left circular shift Permuted choice 2 Left circular shift 64-bit plaintext 64-bit key 64-bit ciphertext 64 56 64 64 56 56 56 56 48 K1 48 K2 48 K16 DES Encryption Algorithm
  • 12. DES Encryption Algorithm (Cont…)  First, the 64-bit plaintext passes through an initial permutation (IP) that rearranges the bits to produce the permuted input.  This is followed by a phase consisting of sixteen rounds of the same function, which involves both permutation and substitution functions.  Finally, the preoutput is passed through a permutation that is the inverse of the initial permutation function, to produce the 64-bit ciphertext.  The 56-bit key is passed through a permutation function.  For each of the sixteen rounds, a subkey (Ki) is produced by the combination of a left circular shift and a permutation.
  • 14. 𝐿𝑖 −1 32-bits 𝑅𝑖 −1 32-bits 𝐶𝑖 − 1 28-bits 𝐷𝑖 −1 28-bits Expansion/ permutation (E table) XOR Substitution/choice (S-box) Permutation (P) XOR 𝐿𝑖 𝑅𝑖 𝐶 𝑖 𝐷𝑖 Left Shift (S) Left Shift (S) Permutation/ compression (Permuted choice 2) 48 Ki 48 48 32 32
  • 15. DES Single Round (Cont…) 1. Key Transformation • Permutation of selection of sub-key from original key 2. Expansion Permutation (E-table) • Right half is expanded from 32-bits to 48-bits 3. S-box Substitution • Accepts 48-bits from XOR operation and produce 32-bits using 8 substitution boxes (each S-boxes has a 6-bit i/p and 4-bit o/p). 4. P-Box Permutation 5. XOR and Swap
  • 17. Role of S-box (Cont…)  The outer two bits of each group select one row of an S-box.  Inner four bits selects one column of an S-box.  Example: S-box 1 0 1 1 0 0 1 Row Column Input Output 1 0 0 1
  • 18. Avalanche Effect  Desirable property of any encryption algorithm is that a change in one bit of the plaintext or of the key should produce a change in many bits of cipher text.  DES performs strong avalanche effect.  Although the two plaintext blocks differ only in the rightmost bit, the ciphertext blocks differ in 29 bits.  This means that changing approximately 1.5 % of the plaintext creates a change of approximately 45 % in the ciphertext.
  • 19. AES (Advanced Encryption Standard)  The Rijndael proposal for AES defined a cipher in which the block length and the key length can be independently specified to be 128, 192, or 256 bits.  AES designed to have characteristics 1. Resistance against all known attacks 2. Speed and code compactness on a wide range of platforms 3. Design simplicity Key size (words/ bytes/ bits) 4/16/128 6/24/192 8/32/256 Block size (words/ bytes/ bits) 4/16/128 4/16/128 4/16/128 Round key size (words/ bytes/ bits) 4/16/128 4/16/128 4/16/128 Number of Rounds 10 12 14
  • 20. AES (Advanced Encryption Standard) AES Plaintext (128 bits) Ciphertext (128 bits) Key (128-256 bits)
  • 21. AES Structure Initialization 1. Expand 16-byte key to get the actual key block to be used. 2. Initialize 16-byte plaintext block called as state. 3. XOR the state with the key block. For each round 1. Apply S-box 2. Rotate rows of state 3. Mix columns 4. Add Round key: XOR the state with key block.
  • 23. Block to State & State to Block
  • 24. Plain Text to State
  • 25. AES Structure  The first N-1 rounds consist of four distinct transformation functions. • The 16 input bytes are substituted using an S- box SubBytes • Each of the four rows of the matrix is shifted to the left ShiftRows • Each column of four bytes is now transformed using a special mathematical function. MixColumns • The 16 bytes of the matrix are now considered as 128 bits and are XORed to the 128 bits of the round key. AddRoundKey
  • 26. SubByte Transformation  The forward substitute byte transformation, called SubBytes, is a simple table lookup
  • 27. ShiftRows  The first row of State is not altered.  For the second row, a 1-byte circular left shift is performed.  For the third row, a 2-byte circular left shift is performed.  For the fourth row, a 3-byte circular left shift is performed.
  • 28. MixColumns  Each byte of a column is mapped into a new value that is a function of all four bytes in that column.
  • 29. AddRoundKey  In the forward add round key transformation, the 128 bits of State are bitwise XORed with the 128 bits of the round key. State Round Key
  • 31.  The AES key expansion algorithm takes as input a four-word (16-byte) key and produces a linear array of 44 words (176 bytes).  Each added word w[i] depends on the immediately preceding word, w[i - 1].  In three out of four cases, a simple XOR is used. AES Key Expansion

Editor's Notes

  • #2: X.800 and RFC 2828 International Telecommunication Union (ITU)
  • #14: confusion step is the S-box substitution, while the diffusion step is where the output of the S-boxes is rearranged according to the P-box permutation rules.