0% found this document useful (0 votes)
5 views

Unit 3 Part 1 NIS

Cryptography is the art and science of secure communication, involving techniques like encryption, decryption, and key management to protect information from unauthorized access. Key concepts include symmetric and asymmetric cryptography, hash functions, and digital signatures, which are essential for secure data transmission and integrity verification. Various methods such as substitution and transposition techniques, including the Caesar cipher and Rail Fence cipher, illustrate the principles of encoding and decoding messages.

Uploaded by

solankesnehal96k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Unit 3 Part 1 NIS

Cryptography is the art and science of secure communication, involving techniques like encryption, decryption, and key management to protect information from unauthorized access. Key concepts include symmetric and asymmetric cryptography, hash functions, and digital signatures, which are essential for secure data transmission and integrity verification. Various methods such as substitution and transposition techniques, including the Caesar cipher and Rail Fence cipher, illustrate the principles of encoding and decoding messages.

Uploaded by

solankesnehal96k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Unit 3 : Cryptography

Explain cryptography -:

Cryptography is the art and science of secure communication in the presence of third parties,
often referred to as adversaries. It involves techniques for encoding information in such a way
that only authorized parties can understand it, while unauthorized parties cannot.

Cryptography plays a vital role in various aspects of modern life, including secure
communication over the internet, data protection, financial transactions, and ensuring the
privacy of sensitive information.

Here's a breakdown of some key concepts in cryptography:

1. Encryption: Encryption is the process of transforming plaintext (ordinary, readable data)


into ciphertext (unreadable data) using an algorithm and a key. The ciphertext can then be
transmitted over insecure channels with reduced risk of interception. The process can be
symmetric (using the same key for both encryption and decryption) or asymmetric (using
different keys for encryption and decryption).

2. Decryption: Decryption is the reverse process of encryption. It involves converting


ciphertext back into plaintext using the appropriate decryption algorithm and key. Only parties
possessing the correct decryption key can decipher the ciphertext.

3. Symmetric Cryptography: In symmetric cryptography, the same key is used for both
encryption and decryption. This means that both the sender and the recipient must possess the
same secret key. Popular symmetric encryption algorithms include AES (Advanced Encryption
Standard) and DES (Data Encryption Standard).

4. Asymmetric Cryptography: Asymmetric cryptography, also known as public-key


cryptography, uses a pair of keys: a public key for encryption and a private key for decryption.
The public key can be freely distributed, allowing anyone to encrypt messages, but only the
holder of the corresponding private key can decrypt them. RSA (Rivest-Shamir-Adleman) and
ECC (Elliptic Curve Cryptography) are examples of asymmetric encryption algorithms.

5. Hash Functions: Hash functions are cryptographic algorithms that transform input data into
a fixed-size string of bytes, known as a hash value or digest. These functions are used for data
integrity verification, digital signatures, and password hashing. A key characteristic of hash
functions is that they are one-way, meaning it is computationally infeasible to reverse the
process and obtain the original input from the hash value.

6. Digital Signatures: Digital signatures are cryptographic techniques used to verify the
authenticity and integrity of digital messages or documents. They involve using asymmetric
cryptography to create a unique digital signature for a message, which can be verified by
anyone with access to the corresponding public key. Digital signatures provide non-
repudiation, meaning the signer cannot deny their involvement in the message.

7. Key Management: Key management is the process of generating, storing, exchanging, and
revoking cryptographic keys securely. It is crucial for maintaining the security of encrypted
communications and ensuring that keys are only accessible to authorized parties.

Substitution technique

Substitution techniques in cryptography involve replacing plaintext characters with ciphertext


characters according to a predefined rule or algorithm. This technique is one of the fundamental
methods used in classical cryptography and is the basis for modern encryption algorithms.

Caesar Cipher -:

The Caesar cipher is one of the simplest and most well-known substitution techniques in
cryptography. It involves shifting each letter of the plaintext by a fixed number of positions
down or up the alphabet.

The Caesar cipher is a basic example of a substitution cipher and is not secure against modern
cryptographic attacks, such as frequency analysis, due to its simplicity. However, it serves as
an educational tool for understanding the concept of encryption through substitution.
working with an example:

Let's say we want to encrypt the plaintext message "HELLO" using a Caesar cipher with a shift
of 3.

1. Alphabet: Write down the alphabet.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

2. Encryption: Shift each letter of the plaintext by three positions to the right (or left).

Plaintext: H E L L O

Ciphertext: K H O O R

In this example, each letter in the plaintext "HELLO" has been shifted three positions down
the alphabet to produce the ciphertext "KHOOR".

To decrypt a message encrypted with the Caesar cipher, you simply shift each letter in the
ciphertext by the same number of positions in the opposite direction.

For example, if we want to decrypt the ciphertext "KHOOR" using the same Caesar cipher with
a shift of 3:

1. Decryption: Shift each letter of the ciphertext three positions to the left (or right).

Ciphertext: K H O O R

Plaintext: H E L L O

So, "KHOOR" decrypts back to "HELLO".


Monoalphabetic Cipher -:

A monoalphabetic cipher is a type of substitution cipher where each letter in the plaintext is
consistently replaced with a corresponding letter in the ciphertext. In other words, the same
letter in the plaintext will always be replaced by the same letter in the ciphertext.

This type of cipher is very easy to crack using frequency analysis, where the most commonly
occurring letters in the ciphertext are compared to the frequency distribution of letters in the
language being used (usually English).

Here's an example of a simple monoalphabetic cipher known as the Caesar cipher:

Let's say we're using a Caesar cipher with a shift of 3. This means each letter in the plaintext is
shifted three positions to the right in the alphabet.

Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

So, for example, the letter 'A' would be replaced with 'D', 'B' with 'E', 'C' with 'F', and so on.

Using this key, the plaintext "HELLO" would be encrypted as follows:

Plain: H E L L O

Cipher: K H O O R

Decryption is simply the reverse process, where each letter in the ciphertext is shifted back by
3 positions.
Hill Cipher -:

The Hill cipher is a cryptographic algorithm that operates on blocks of text. It's a polygraphic
substitution cipher based on linear algebra. Here's how it works:

1. Key Generation: The first step is to choose a key matrix. This matrix must be invertible
modulo some number, typically the size of the alphabet used (e.g., 26 for the English alphabet).
The size of the matrix determines the block size for encryption and decryption.

2. Encryption: To encrypt a message, you break it into blocks of size equal to the dimensions
of the key matrix. Each block is then treated as a vector and multiplied by the key matrix
modulo the alphabet size. The resulting vector corresponds to the encrypted block.

3. Decryption: Decryption is the reverse process of encryption. You multiply the encrypted
block by the inverse of the key matrix modulo the alphabet size to obtain the original message
block.

Here's a step-by-step example:

Let's say we want to encrypt the message "HELLO" using a 2x2 key matrix:
Polyalphabetic Substitution

Polyalphabetic substitution is a cryptographic technique where each letter in the plaintext is


shifted by different amounts according to a predetermined key. This contrasts with simpler
substitution ciphers like the Caesar cipher, where each letter is shifted by the same amount.

One famous example of a polyalphabetic substitution cipher is the Vigenère cipher. In the
Vigenère cipher, a keyword is repeated to match the length of the plaintext. Each letter of the
keyword corresponds to a Caesar cipher shift value. Then, each letter of the plaintext is
shifted according to the corresponding letter in the keyword.
Let's demonstrate the Vigenère cipher with an example:

Suppose we want to encrypt the plaintext "HELLO" using the keyword "KEY".

1. Repeat the keyword to match the length of the plaintext:

Keyword: KEYKEY

Plaintext: HELLOH

2. Convert both the plaintext and the keyword into numbers (A=0, B=1, ..., Z=25):

Plaintext: 7 4 11 11 14 7

Keyword: 10 4 24 10 4 24

3. Add the corresponding numbers together, modulo 26:

Ciphertext: (7+10)%26 (4+4)%26 (11+24)%26 (11+10)%26 (14+4)%26 (7+24)%26

= 17 8 9 21 18 5

4. Convert the resulting numbers back into letters:

Ciphertext: Q I J V S F

So, the encrypted message for "HELLO" using the keyword "KEY" in the Vigenère cipher is
"QIJVSF".
Transposition technique -:

Transposition techniques in cryptography involve rearranging the order of characters in the


plaintext to create the ciphertext, without altering the actual characters themselves. It's like
reshuffling the letters of a message to disguise its original meaning. There are various ways to
perform transposition, but one common method is the columnar transposition cipher.

Transposition ciphers like this offer a different level of security compared to substitution
ciphers, and they're often used in conjunction with other techniques to create stronger
encryption methods.

Here's how columnar transposition works:

1. Key Selection: Choose a keyword or phrase that determines the order in which columns are
read during encryption and decryption. For example, the keyword could be "CRYPTO".

2. Matrix Creation: Write the plaintext message into a grid (matrix), filling the cells row by
row. The number of columns should match the length of the keyword. If there are remaining
spaces at the end, fill them with placeholders or ignore them.

Example:

Keyword: CRYPTO

Plaintext: "THIS IS A SECRET MESSAGE

Matrix:
3. Encryption: Read the columns of the matrix in the order specified by the keyword.
Concatenate the characters of each column to create the ciphertext.

Example:

Reading columns in the order of the keyword "CRYPTO", we get:

Concatenating these columns together, we get the ciphertext: "TATHEGISMESASSISECE"

4. Decryption: To decrypt, rearrange the columns of the ciphertext according to the keyword
and then read the rows.

Example:

Ciphertext: "TATHEGISMESASSISECE"

Reading columns in the order of the keyword "CRYPTO", we get:

Concatenating these columns row by row, we get the original plaintext:


"THISISASECRETMESSAGE"
Rail Fence Cipher

The Rail Fence Cipher is a transposition cipher that rearranges the plaintext by writing it in a
zigzag pattern across multiple "rails" or lines, and then reading off the ciphertext from the
pattern formed by the rails. It's named for its appearance, which resembles a fence with rails.

The Rail Fence Cipher is relatively easy to understand and implement, but it's not very secure
compared to modern encryption methods. It's often used for educational purposes or in
situations where a simple encryption method is sufficient.

Here's how the Rail Fence Cipher works:

1. Key Selection: Choose the number of rails, which determines the pattern of the zigzag.

2. Encryption:

• Write the plaintext in a zigzag pattern across the number of rails chosen.
• Start by writing the first character in the top rail, the second character on the second
rail, and so on, until reaching the bottom rail.
• When reaching the bottom rail, reverse the direction and start moving upwards until
reaching the top rail again.
• Continue this zigzag pattern until all characters are written.
• The ciphertext is formed by reading off the characters from the rails in order from top
to bottom and left to right.

Let's demonstrate with an example:

Plaintext: "HELLO WORLD"

Number of Rails: 3

Zigzag Pattern:
Ciphertext: "HORELWLDO"

3. Decryption:

• To decrypt the ciphertext, recreate the same zigzag pattern with the same number of
rails.
• Write the ciphertext characters in the pattern, filling in the rails from top to bottom
and left to right.
• The plaintext is formed by reading off the characters in a linear fashion from left to
right, following the zigzag pattern.

Using the same example ciphertext "HORELWLDO" and number of rails 3

Zigzag Pattern:

Plaintext: "HELLO WORLD"

You might also like