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

unit 2 ns-converted

The document provides an overview of cryptography, including symmetric and asymmetric encryption techniques, various ciphers (Caesar, Playfair, Vernam, Vigenere, and Hill), and concepts like steganography, hashing functions, digital signatures, and key escrow. It explains fundamental terms such as plaintext, ciphertext, encryption, and decryption, and outlines the objectives of cryptography like confidentiality and authentication. Additionally, it covers the algorithms and processes for encrypting and decrypting messages using these techniques.

Uploaded by

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

unit 2 ns-converted

The document provides an overview of cryptography, including symmetric and asymmetric encryption techniques, various ciphers (Caesar, Playfair, Vernam, Vigenere, and Hill), and concepts like steganography, hashing functions, digital signatures, and key escrow. It explains fundamental terms such as plaintext, ciphertext, encryption, and decryption, and outlines the objectives of cryptography like confidentiality and authentication. Additionally, it covers the algorithms and processes for encrypting and decrypting messages using these techniques.

Uploaded by

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

UNIT : 2 CRYPTOGRAPHY

Contents

• Introduction to Encryption Scheme

• Symmetric Encryption algorithm / Cipher-Encryption


and Decryption using:

• Caesar’s cipher, shift cipher, playfair cipher,


Vigenere cipher, one time pad (vernam cipher), hill
cipher (encryption only)

• Transposition techniques: rail fence

• Steganography
Contents

• Hashing function : SHA1

• Asymmetric encryption:
Maintain Confidentiality
Maintain Authentication
Maintain Authentication And Confidentiality

• Digital Signatures, Key escrow


Basic Terms

•Plain Text: Data that can be read and understand without


any special measure.

• Cipher Text: Data that is transformed or converted by


Encryption algorithm.

•Encryption: Algorithm for transforming plain text to


cipher text.

•Decryption: Algorithm for transforming cipher text


toplain text.
Basic Terms

•Key: It is used for encryption and decryption of message.

•Cryptography: It is the science of using mathematics to


encrypt and decrypt data.

•Objectives of Cryptography:

1.Confidentiality
2. Integrity
3. Non repudiation
4. Authentication
SYMMETRIC
ENCRYPTION AND ASYMMETRIC ENCRYPTION

Symmetric Encryption:

Both sender and receiver use single same key for


Encryption and Decryption.

It is also known as Conventional Cryptography/Secret


Key /Private Key.
SYMMETRIC
ENCRYPTION AND ASYMMETRIC ENCRYPTION

Asymmetric Encryption:

It is also known as Public key cryptography.

It uses two keys:

1. Public key known to every one.


2. Private key known to receiver.
ENCRYPTION ALGORITHM

CAESAR CIPHER

It is a type of substitution cipher in which each letter in


the plaintext is 'shifted' a certain number of places down the
alphabet.

For example, with a shift of 1, A would be replaced


by B, B would become C, and so on.

First translate all of characters to numbers, 'a'=0,


'b'=1, 'c'=2, ... , 'z'=25.
For Encryption, C=E(P)=(P+K) mod 26
For Decryption, P=D(C)=(C-k)mod 26
CAESAR CIPHER

Algorithm for Caesar Cipher:

Input:
A String of lower case letters, called Text.
An Integer between 0-25 denoting the required shift.

Procedure:
Traverse the given text one character at a time .
For each character, transform the given character as per the
rule, depending on whether we’re encrypting or decrypting
the text.
Return the new string generated.
CAESAR CIPHER

Example:

Plain Text=HELLO
Key=3

Encryption:

Cipher Text=KHOOR

Decryption:

Plain Text=HELLO
CAESAR CIPHER

Example:

Plain Text= ATTACKATONCE


Key=4
CAESAR CIPHER

Example:

Encryption:

Cipher Text=EXXEGOEXSRGI

Decryption:

Plain Text= ATTACKATONCE


PLAYFAIR CIPHER

First Find Matrix for KEY.

1.Double characters are removed.

2.Arrange in 5*5 matrix.

3.Write down other letters of character set.

4.I/J should be on the same position.


PLAYFAIR CIPHER

Split the message (Plain Text) in pair of characters.


If a pair is a repeated letter, insert filler like 'X’
Example: TEXT: TE XT
HELLO →HE LL O →HE LX LO
Rules:
1) If both letters fall in the same row, replace each with letter
to right (wrapping back to start from end) For example, AR is
encrypted as RM
PLAYFAIR CIPHER

2) If both letters fall in the same column, replace each with


the letter below it (wrapping to top from bottom)
For example, MU is encrypted as CM

3) Otherwise each letter is replaced by the letter in the same


row and in the column of the other letter of the pair For
Example, SH becomes PB and EA becomes IM
PLAYFAIR CIPHER

2) If both letters fall in the same column, replace each with


the letter below it (wrapping to top from bottom)
For example, MU is encrypted as CM

3) Otherwise each letter is replaced by the letter in the same


row and in the column of the other letter of the pair For
Example, SH becomes PB and EA becomes IM
PLAYFAIR CIPHER

EXAMPLE

If key=“keyword” and plaintext=“secret message” then


Encrypt the message using play fair cipher.

If key=“summer” then write play fair matrix(table)


VERNAM CIPHER

It is also known as One Time Pad(OTP).

It is unbreakable encryption technique.

Vernam cipher is a stream cipher where the plain text is


add with a random stream of data of the same length to
generate the encrypted data.
VERNAM CIPHER

•Encryption Algorithm:

•Assign a number to each character of the plain-text and the


key according to alphabetical order.

•Add both the number (Corresponding plain-text character


number and Key character number).

•Subtract the number from 26 if the added number is greater


than 26, if it isn’t then leave it.
VERNAM CIPHER

Example:
Plain-Text: RAMSWARUPK
Key: RANCHOBABA

PT: R A M S W A R U P K
NO: 17 0 12 18 22 0 17 20 15 10

KEY: R A N C H O B A B A
NO: 17 0 13 2 7 14 1 0 1 0

CT-NO: 34 0 25 20 29 14 18 20 16 10
After mod 26
CT-NO: 8 0 25 20 3 14 18 20 16 10
CIPHER-TEXT: I A Z U D O S U Q K
VIGENERE CIPHER

It is a polyalphabetic cipher.

For Vigenere Cipher, use Tabula Recta in which each row


of the table corresponds to a Caesar Cipher. The first row is
a shift of 0; the second is a shift of 1; and the last is a shift of
25.

The Vigenere cipher uses this table together with a


keyword to encipher a message.
VIGENERE CIPHER
VIGENERE CIPHER

To encrypt a message using the Vigenère Cipher you first


need to choose a keyword

for each plaintext letter, find the letter down the left hand
side of the tabula recta. You take the corresponding letter
from the key stream, and find this across the top of the
tabula recta.

Where these two lines cross in the table is the


Cipher text letter you use.
VIGENERE CIPHER

Encrypt the plaintext "a simple example" using the


keyword battista.

First we must generate the keystream, by repeating the


letters of the keyword until it is the same length as the
plaintext.

The keystream b means choose the column with B at the


top, and the plaintext "a" means we choose the row with A at
the left. We get the ciphertext "B".
VIGENERE CIPHER
VIGENERE CIPHER

• For the second plaintext letter "s", we go down to S on the


left, and use the keystream a to go to A along the top. We get
the ciphertext letter "S".
VIGENERE CIPHER

With the plaintext letter "i", we go down to I on the left,


and the keystream letter t means we go to T across the top.
We get the ciphertext letter "B".
VIGENERE CIPHER

Continuing in this way we get the final cipher text


"BSBF XDXEYA FITW".
HILL CIPHER

Encryption

To encrypt a message using the Hill Cipher ,first turn


keyword into a key matrix (either in 2x2 matrix or 3x3
matrix).

Also turn the plaintext into digraphs (or trigraphs) and


each of these into a column vector.

We then perform matrix multiplication modulo the


length of the alphabet (i.e. 26) on each vector
HILL CIPHER

2 x 2 Example

Plaintext : "short example"

Key : hill

The first step is to turn the keyword into a matrix. If the


keyword was longer than the 4 letters needed, we would
only take the first 4 letters, and if it was shorter, we would
fill it up with the alphabet in order.
HILL CIPHER

Now convert this into a key matrix.


A = 0, B = 1, C= 2, D = 3, etc.

Now split the plaintext into digraphs, and write


these as column vectors.

Each letter is replaced by its appropriate number.


HILL CIPHER

Encryption process of the first digraph :


HILL CIPHER

Encryption process of the second digraph :


HILL CIPHER

This gives us a final cipher text of "APADJ TFTWLFJ".


HILL CIPHER

This gives us a final cipher text of "APADJ TFTWLFJ".


TRANSPOSITION TECHNIQUE

Here, Plaintext symbols are rearranged to produce


Ciphertext.

Example, Rail Fence Cipher


RAIL FENCE CIPHER

Rail fence cipher is a type of transposition cipher.

It involves rearranging of letters in plain text to encrypt


the message.
Example,
Plain Text=THIS IS A SECRET MESSAGE
Key(Rail)=3
For Encryption, write message in zigzag(vertically)
RAIL FENCE CIPHER

For Decryption,
Total letter =21
Divided in to 3 groups of letter( bcz no. of rails=3)

Key(Rail)=3,

The message is read vertically:


THIS IS A SECRET MESSAGE
STEGANOGRAPHY

Steganography means hiding a message within another


message or image.

Steganography is an art of hiding a message, image, or


file within another message ,image, or file.

The word steganography combines the Ancient Greek


words steganos meaning "covered or protected", and
graphein meaning "writing".

For example, the hidden message may be in invisible ink


between the visible lines of a private letter.
STEGANOGRAPHY
STEGANOGRAPHY

Digital Stegnography:

We can insert date or we can hide data in the image by


replacing bits of image.

Most common technique are:

1)LSB,
2)DCT and
3)Append type.
LSB: Least Significant Bit

Replace LSB bit with a bit from hidden data.

LSB has smallest effect on the amount of color.

Replacing LSB to hidden data will have small effect on


the picture.
DCT stands for Discrete Cosine Transform

It works by calculating the frequencies of the image then


replace some of them.
Append

Instead of hide the data in the photo by manipulating the


picture, Append algorithm appends the data to the end of
the file as appending.

This algorithm will change the size of the file.


DIGITAL SIGNATURE

When there is not complete trust between sender and


receiver, Digital Signature is needed.

Property of Digital Signature

• It must verify the sender, date and time of signature

• It must authenticate the content at the time of signature

• It must be verifiable by third parties to resolve disputes.


DIGITAL SIGNATURE
DIGITAL SIGNATURE

Digital Signature give two algorithm:

One for sender which involve user’s private key and one
for verifying signature which involve user’s public key.

Digital Signature is an electronic signature that can be


used to authenticate the identity of the sender of a message
and ensure that content of the message that has been sent is
unchanged.
KEY ESCROW

It is a cryptographic key exchange process in which a key


is held in escrow or stored by a third party.

Key escrow provides a backup source for cryptographic


keys.

It is a risky because a third party is involved.

Key Escrow is to serve as a backup if the parties with


access to the cryptographic key lose the data, such as
through some natural diaster or a crack attack.

You might also like