CT UNIT 2 Session 1

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 31

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

COURSE CODE: U21CS601

COURSE TITLE : CRYPTOGRAPHY TECHNIQUES

FACULTY NAME : Dr.A.BALAMURUGAN

ACADEMIC YEAR :2023 – 2024 (EVEN SEM)


UNIT -2 UNIT II SYMMETRIC AND STREAM
CIPHERS
Block cipher principles – Data Encryption Standard (DES) –
Fields and finite field arithmetic – Advanced Encryption Standard
(AES) – Block cipher modes of operation – Principles of random
number generation – Random number generators, Stream ciphers,
RC4

CO2: Implement symmetric key algorithms and stream ciphers for


encrypting text and multimedia data (Apply)
UNIT -2

SESSION 1 - Block Ciphers and the Data Encryption


Standard(DES)
SESSION 2 - Fields and finite field arithmetic
SESSION 3 - Advanced Encryption Standard(AES)
SESSION 4 - Block cipher modes of operation
SESSION 5 - Random number generation
SESSION 6 - Stream ciphers, RC4
SESSION-1
Block Ciphers and the Data Encryption
Standard
Modern Block Ciphers
Now look at modern block ciphers

One of the most widely used types of cryptographic algorithms

Provide secrecy /authentication services

Focus on DES (Data Encryption Standard)

Illustrate block cipher design principles


Block vs Stream Ciphers

Block ciphers process messages in blocks, each of which is then


en/decrypted

Like a substitution on very big characters


64-bits or more

Stream ciphers process messages a bit or byte at a time when


en/decrypting

Many current ciphers are block ciphers

Broader range of applications


Block Cipher Principles
• Most symmetric block ciphers are based on a Feistel
Cipher Structure
• Block cipher operates on a plaintext block of n bits to
produce a ciphertext block of n bits.
• Block ciphers look like an extremely large substitution
• n-bit general substitution block cipher, the size of the key is
n x 2n
• For a 64-bit block, the key size is 64 x 264 = 270 = 1021 bits.
• would need table of 264 entries for a 64-bit block
• Instead create from smaller building blocks
• Using idea of a product cipher
Ideal Block Cipher
Claude Shannon and Substitution-
Permutation Ciphers
Claude Shannon introduced idea of substitution-permutation (S-P)
networks in 1949 paper, form basis of modern block ciphers

S-P nets are based on the two primitive cryptographic operations :


substitution (S-box)
permutation (P-box)

He also introduced the ideas of confusion and diffusion


Diffusion and Confusion
Cipher needs to completely obscure statistical properties of original
message

One-time pad does this

More practically Shannon suggested combining S & P elements to


obtain:
diffusion – dissipates statistical structure of plaintext over bulk of
ciphertext
confusion – makes relationship between ciphertext and key as
complex as possible
Feistel Cipher Structure
Horst Feistel devised the feistel cipher
based on concept of invertible product cipher
Partitions input block into two halves
process through multiple rounds which
perform a substitution on left data half
based on round function of right half & sub key
then have permutation swapping halves

One layer of S-boxes and the following P-box are used to form the
round function

Implements Shannon’s S-P net concept


Feistel Cipher Encryption and Decryption
Feistel Cipher Design Elements
•block size - increasing size improves security, but slows cipher

•key size - increasing size improves security, makes exhaustive key


searching harder, but may slow cipher

•number of rounds - increasing number improves security, but slows


cipher

•subkey generation algorithm - greater complexity can make analysis


harder, but slows cipher

•round function - greater complexity can make analysis harder, but


slows cipher

•fast software en/decryption - more recent concern for practical use

•ease of analysis - for easier validation & testing of strength


Data Encryption Standard (DES)
most widely used block cipher

adopted in 1977 by NBS (now NIST)

encrypts 64-bit data using 56-bit key

has widespread use

has been considerable controversy over its security


DES Encryption Overview

https://www.youtube.com/watch?v=0uA86l22FzQ
Initial Permutation IP
• First step of the data computation

• IP reorders the input data bits

• even bits to LH half, odd bits to RH half


DES Round Structure
• Uses two 32-bit L & R halves

• Any Feistel cipher can describe as:

Li = Ri–1

Ri = Li–1  F(Ri–1, Ki)

• F takes 32-bit R half and 48-bit subkey:


• expands R to 48-bits using permutation Expansion
• adds to subkey using XOR
• passes through 8 S-boxes to get 32-bit result
• finally permutes using 32-bit permutation P
Single Round of DES Algorithm
DES Round Structure (Function)
Expansion Permutation
Substitution Boxes S

Have eight S-boxes which map 6 to 4 bits

Each S-box is actually 4 little 4 bit boxes


outer bits 1 & 6 (row bits) select one row of 4
inner bits 2-5 (col bits) are substituted
result is 8 lots of 4 bits, or 32 bits

Row selection depends on both data & key


feature known as autoclaving (auto keying)
Definition of DES S-Boxes
Definition of DES S-Boxes
DES Key Schedule
• Forms subkeys used in each round
• Initial permutation of the key (PC1) which selects 56-bits in two 28-bit
halves (bits 8,16,24,32,40,48,56,64 are dropped)
• 16 stages consisting of:
• Rotating each half separately either 1 or 2 places depending on the
key rotation schedule K (1 shift operation for Rounds 1,2 9,16 and
2 shift operation for other rounds)
• Selecting 24-bits from each half & permuting them by PC2 for use in
round function F
DES Decryption
• Decrypt must unwind steps of data computation
• With Feistel design, do encryption steps again
using subkeys in reverse order (SK16 … SK1)
• IP undoes final FP step of encryption
• 1st round with SK16 undoes 16th encrypt round
• ….
• 16th round with SK1 undoes 1st encrypt round
• then final FP undoes initial encryption IP
• thus recovering original data value
Avalanche Effect

Key desirable property of encryption algorithm

Where a change of one bit of the plaintext or one bit of the key
results in changing approx. half output bits

DES exhibits strong avalanche effect


Strength of DES – Key Size
56-bit keys have 256 = 7.2 x 1016 values

Brute force search looks hard

 in 1998 on dedicated h/w Electronic Frontier Foundation (EFF) in a


few days

 Still must be able to recognize plaintext

Must now consider alternatives to DES


Strength of DES – Nature of the DES
Algorithm
• utilise some deep structure of the cipher
• by gathering information about encryptions
• can eventually recover some/all of the sub-key bits
• if necessary then exhaustively search for the rest
• Generally these are statistical attacks
Strength of DES – Timing Attacks

Attacks actual implementation of cipher

Use knowledge of consequences of implementation to


derive information about some/all subkey bits

Specifically use fact that calculations can take varying


times depending on the value of the inputs to it
Example
This problem provides a numerical example of encryption using a one-round version
of DES. We start with the same bit pattern for the key K and the plaintext, namely:
Hexadecimal notation: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary notation: 0000 0001 0010 0011 0100 0101 0110 0111
1000 1001 1010 1011 1100 1101 1110 1111
a. Derive K1, the first-round subkey.
b. Derive L0, R0.
c. Expand R0 to get E[R0], where E[ # ] is the expansion function.
d. Calculate A=E[R0]⊕K1.
e. Group the 48-bit result of (d) into sets of 6 bits and evaluate the corresponding S-box
substitutions.
f. Concatenate the results of (e) to get a 32-bit result, B.
g. Apply the permutation to get P(B).
h. Calculate R1 = P(B) ⊕ L0.
i. Write down the ciphertext.

You might also like