0% found this document useful (0 votes)
4 views12 pages

CNS Unit 2

The document provides an overview of symmetric and asymmetric key ciphers, including definitions, explanations, and examples of various algorithms such as DES, AES, RC5, and RSA. It discusses the principles of block ciphers, including confusion and diffusion, as well as the modes of operation for block ciphers. Additionally, it covers the Diffie-Hellman key exchange method for secure key sharing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

CNS Unit 2

The document provides an overview of symmetric and asymmetric key ciphers, including definitions, explanations, and examples of various algorithms such as DES, AES, RC5, and RSA. It discusses the principles of block ciphers, including confusion and diffusion, as well as the modes of operation for block ciphers. Additionally, it covers the Diffie-Hellman key exchange method for secure key sharing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Symmetric Key Cipher

Definition

A Symmetric Key Cipher is a cryptographic method in which the same secret key is used for
both encryption and decryption of data. The sender and receiver must share the same key
before communication begins.

In this system, the sender converts the plaintext (original message) into ciphertext
(encrypted message) using a secret key. The receiver then uses the same key to decrypt the
ciphertext and obtain the original plaintext.

Explanation

Symmetric key encryption is one of the oldest and fastest encryption techniques used in
cryptography. Because the same key is used for encryption and decryption, it is important
that the key remains secret and securely shared between both parties.

The general working process is:

Sender → Encrypts message using secret key → Sends ciphertext


Receiver → Decrypts ciphertext using the same key → Gets original message

The security of symmetric encryption depends entirely on protecting the secret key. If the
key becomes known to an attacker, the encrypted data can easily be decrypted.

Mathematical Representation

Encryption function:

C = E(K, P)

Decryption function:

P = D(K, C)

Where:

• P = Plaintext

• C = Ciphertext

• K = Secret key

• E = Encryption algorithm

• D = Decryption algorithm
Example

Suppose the plaintext message is:

HELLO

Using a secret key and encryption algorithm, it may be converted to:

XJRTQ

This encrypted message is sent through the network. The receiver uses the same key to
decrypt it back to HELLO.

Advantages

1. Encryption and decryption are very fast.

2. Requires less computational power.

3. Suitable for large amount of data encryption.

4. Widely used in database security and network communication.

Disadvantages

1. Key distribution problem – the key must be shared securely.

2. If the key is compromised, entire communication becomes insecure.

3. Not suitable for communication between many users.

2. Block Cipher

Definition

A Block Cipher is a symmetric encryption technique that divides the plaintext into fixed-size
blocks and encrypts each block using the same secret key.

Each block is processed independently using an encryption algorithm.

Explanation
In block cipher encryption, the plaintext message is first divided into blocks of fixed length
such as 64 bits or 128 bits. Each block is then encrypted using multiple rounds of
mathematical operations.

The encryption process usually includes:

1. Substitution

2. Permutation

3. XOR operations

4. Key mixing

These operations make it difficult for attackers to determine the original plaintext.

Example

Plaintext message:

HELLOWORLD

Block size = 5 characters

Blocks formed:

HELLO
WORLD

Each block is encrypted separately using the encryption key.

Characteristics of Block Ciphers

1. Fixed block size.

2. Uses multiple rounds of encryption.

3. Provides strong security through confusion and diffusion.

4. Examples include DES, AES, RC5, IDEA.

3. Principles of Block Cipher

The security of block ciphers is based on two important principles introduced by Claude
Shannon.

These principles are:


1. Confusion

2. Diffusion

Confusion

Definition

Confusion refers to making the relationship between the ciphertext and the encryption key
very complex and difficult to understand.

Explanation

Confusion hides the connection between the plaintext, ciphertext, and key. Even if an
attacker analyzes the ciphertext, it should be extremely difficult to determine the key.

This is usually achieved using substitution techniques.

Example

A substitution rule may change letters like this:

A→Q
B→T
C→M

This substitution makes it difficult to identify the original message.

Diffusion

Definition

Diffusion spreads the influence of each plaintext bit over many ciphertext bits so that small
changes in plaintext produce large changes in ciphertext.

Explanation

Diffusion prevents attackers from analyzing patterns in the ciphertext. It ensures that the
statistical structure of the plaintext is hidden.

Diffusion is achieved using permutation operations.

Example

If a single letter in the plaintext changes, many letters in the ciphertext will change as well.

4. DES (Data Encryption Standard)


Definition

DES is a symmetric key block cipher developed by IBM and adopted as a federal standard
by the U.S. government in 1977.

It was widely used for secure communication in banking and financial systems.

Features of DES

Block size = 64 bits


Key size = 56 bits
Number of rounds = 16
Type = Symmetric block cipher

Structure of DES

DES uses a structure called Feistel Network, which splits the block into two halves and
processes them through several rounds.

Steps of DES Encryption

Step 1: Initial Permutation

The 64-bit plaintext undergoes an initial permutation which rearranges the bits.

Step 2: Splitting the Block

The block is divided into two halves:

Left Half (L0)


Right Half (R0)

Step 3: 16 Rounds of Processing

Each round performs the following operations:

1. Expansion of right half

2. XOR operation with round key

3. Substitution using S-boxes

4. Permutation
The formulas used are:

Li = Ri-1

Ri = Li-1 XOR f(Ri-1, Ki)

Where Ki is the round key.

Step 4: Final Permutation

After completing all 16 rounds, the two halves are combined and a final permutation is
applied to produce the ciphertext.

Applications of DES

• Banking security

• ATM networks

• Financial transactions

However, DES is now considered insecure because the key length is too small.

5. AES (Advanced Encryption Standard)

Definition

AES is a modern symmetric encryption algorithm adopted by the U.S. government in 2001
to replace DES.

It is one of the most secure encryption standards used today.

Features

Block size = 128 bits


Key size = 128 / 192 / 256 bits
Rounds = 10 / 12 / 14

AES Encryption Process

Step 1: Key Expansion

The original key is expanded into several round keys.


Step 2: Initial Round

The plaintext block is combined with the first round key using AddRoundKey operation.

Step 3: Main Rounds

Each round performs four operations:

1. SubBytes – substitution of bytes using S-box

2. ShiftRows – rows of the matrix are shifted

3. MixColumns – columns are mixed using mathematical operations

4. AddRoundKey – round key is added to the block

Step 4: Final Round

The final round performs all operations except MixColumns.

Applications of AES

AES is widely used in:

• Wi-Fi security (WPA2)

• HTTPS encryption

• VPN communication

• Cloud storage encryption

6. RC5 Algorithm

Definition

RC5 is a symmetric key block cipher designed by Ronald Rivest in 1994.

It is known for its simplicity and flexibility.

Features
Variable block size
Variable key length
Variable number of rounds

Working of RC5

The RC5 algorithm consists of three main phases:

1. Key Expansion

The secret key is expanded into several subkeys.

2. Encryption

The plaintext is divided into two halves. Several rounds of operations are applied.

Operations used:

• XOR

• Modular addition

• Bit rotation

3. Decryption

The reverse process of encryption is applied.

7. IDEA (International Data Encryption Algorithm)

Definition

IDEA is a symmetric block cipher designed by James Massey and Xuejia Lai.

It was developed to replace DES.

Features

Block size = 64 bits


Key size = 128 bits
Rounds = 8

Operations Used in IDEA

IDEA uses three different mathematical operations:


1. XOR

2. Addition modulo 216

3. Multiplication modulo 216 + 1

These operations provide strong security.

8. Block Cipher Modes of Operation

Block cipher modes define how blocks of plaintext are encrypted when the message length
is larger than the block size.

Common modes include:

1. ECB (Electronic Code Book)

In ECB mode, each block is encrypted independently.

Example:

P1 → C1
P2 → C2

Problem: identical plaintext blocks produce identical ciphertext blocks.

2. CBC (Cipher Block Chaining)

In CBC mode, each plaintext block is XORed with the previous ciphertext block before
encryption.

Formula:

Ci = E(K, Pi XOR Ci-1)

This improves security.

9. Stream Cipher

Definition

A Stream Cipher encrypts plaintext one bit or one byte at a time instead of blocks.

Explanation
A stream cipher generates a keystream, which is combined with plaintext using XOR
operation.

Formula:

Ciphertext = Plaintext XOR Keystream

Advantages

• Fast encryption

• Suitable for real-time communication

• Used in wireless communication

10. RC4 Algorithm

Definition

RC4 is a stream cipher designed by Ronald Rivest in 1987.

RC4 Working Steps

Step 1: Key Scheduling Algorithm

Initialize array S with values 0–255.

Then shuffle the array using the secret key.

Step 2: Pseudo Random Generation

Generate keystream bytes.

Step 3: Encryption

Ciphertext is obtained by XORing plaintext with keystream.

11. Asymmetric Key Cipher

Definition

Asymmetric encryption uses two different keys:


1. Public key

2. Private key

Explanation

Public key is shared with everyone, while the private key remains secret.

Data encrypted with the public key can only be decrypted using the private key.

12. RSA Algorithm

RSA is one of the most widely used public key encryption algorithms.

Steps of RSA

1. Choose two large prime numbers p and q

2. Compute n = p × q

3. Compute φ(n) = (p − 1)(q − 1)

4. Choose public key e

5. Compute private key d

Encryption:

C = M^e mod n

Decryption:

M = C^d mod n

13. ElGamal Cryptography

ElGamal is a public key cryptosystem based on the Diffie-Hellman key exchange principle.

It is mainly used for digital signatures and encryption.

14. Diffie-Hellman Key Exchange

Definition
Diffie-Hellman is a method used for securely exchanging cryptographic keys over an
insecure communication channel.

Working Steps

1. Select prime number p and generator g.

2. User A chooses private key a.

3. User B chooses private key b.

4. Exchange public values.

5. Both compute the shared secret key.

Both users obtain the same secret key without directly transmitting it

You might also like