You are on page 1of 39

CRYPTOGRAPHY

• Cryptography is a method of storing and transmitting data


in a form so that it can not interpreted or understood.
• It is a science of protecting information by encoding it into
an unreadable format.
• How does it work: Cryptography work on algorithm or
cipher, it is a mathematical function used in encryption and
decryption process.
• Algorithm work with combination with key as word, phrase
to encrypt plain text.
• Security of the encrypted data is totally depend upon the
two things:
• Strength of Algorithm and
• Secret key.

Marathwada Mitra Mandal's


Polytechnic,Pune
Cryptography Definitions
• Algorithm: It is a mathematical rule used in Encryption
and Decryption.
• Cryptology: Hidden words
• Plaintext: Data in readable format or text to be
encrypted.
• Cipher text: File created after encryption.
• Encryption: Process of converting plain text into cipher
text.
• Decryption :Process of converting cipher text into plain
text.
• Cryptographers: People who include in cryptography.

Marathwada Mitra Mandal's


Polytechnic,Pune
Substitution Technique
• It is a very basic technique, which make use of
simple letter substitution to generate cipher text.
A. CEASAR CIPHER : A cryptography scheme proposed by Julius
Caesar.
 Caesar cipher is one of the simplest and most widely
known encryption technique.
 It is type of substitution cipher in which each letter in the
plain text is replaced by a letter of fixed number of
positions down the alphabets. For example with a shift of
3, A is replaced by D, and B is replaced by E and so on ….
Plain Text
a b c d e f g h i j k l m
Cipher
Text d e f g h i j k l m n o p

Plain
Text n o p q r s t u v w x y z
Cipher
Text q r s t u v w x y z a b c
Marathwada Mitra Mandal's
Polytechnic,Pune
Modified Version of Cipher text
• Let’s assume that the cipher text alphabets corresponding
to original text is alphabets may not necessary be three
place down but instead can be any place down in order.
• Thus we say that A would not necessary to be replaced by
D only but any alphabet from B-Z. Once replacement
scheme is decided it will be consistent and used for all
other alphabets and convert all other text.
• Each alphabets has 25 possibilities to be replace.
• We write down all possibilities and try to make sense.
• Example We decided: A=D B=p C=a D=x E=s F=q G=t h=x i=a
j=e K=b L=T M=r N=w O=c P=z Q=v R=w S=s T=l U=m V=n
W=y X=f
• Then MM Polytechnic=?
Marathwada Mitra Mandal's
Polytechnic,Pune
POLYALPHABITIC
• On of the main problem with simple
substitution cipher is that it is very vulnerable
for frequently analysis.
• Given large cipher text it can easily broken by
mapping of it’s letters.
• So making cipher more secure cryptographers
interested to develop such technique that are
restrict frequently analysis.
• One of common method is to use more then
one letter to encrypt message .
Marathwada Mitra Mandal's
Polytechnic,Pune
Marathwada Mitra Mandal's
Polytechnic,Pune
• Polyalphabetic cipher involves use of two or more
alphabets. instead of one – to – one relationship
between each letter, there is one to many relationship
between each letter.
• The Vigenere cipher, proposed by de Visenere.
• In vigenere cipher plane text is added with the key
repeated till the end of plane text message to from the
cipher text.
• Vigenere cipher is block substitution with the length of
block equal to length of key. Key length characters are
added to the block repeatedly up to the end of the plane
text.
• There fore symmetric cipher is used in industries.

Marathwada Mitra Mandal's


Polytechnic,Pune
Ex
• Plane text :ATTACKATDAWN
• Key : :LEMONLEMONLE
• Cipher text :LXFOPVEFRNHR

• To decrepit the message going to the row in the table ,


corresponded to the key, finding the position of cipher
text letter in the row.

Marathwada Mitra Mandal's


Polytechnic,Pune
Transposition Technique
• Rail Fence Technique:
• Rail Fence is a technique first used in Greeks.
• This is a transposition technique like a cylinder and a
ribbon, which is wrapped around the cylinder.
• The message to be encrypted was then written on the
coiled ribbon .
• Letters of the original messages would be rearranged
when the ribbon was uncoiled
• Message was easily decrypted when the ribbon was
rewrapped on same cylinder on same diameter.
• In this method diameter of the cylinder is key to encrypt
the message
Marathwada Mitra Mandal's
Polytechnic,Pune
• In rail fence cipher ,technique are essentially
Transposition ciphers and generated by rearrangement of
characters in the plane text.
• Lets consider Plane text ‘ComputeSecurity’ .
• Then plane text is arranged in dual slope Rail Fence,
stright, with three levels.
c u S r
o p t r e u i y
m e c t
• Then cipher text will be ‘cusroptreuiymect’
• Same could be arranged by 4 levels.
C E R
O T R U I
M U S C T
p E Y
Marathwada Mitra Mandal's
Polytechnic,Pune
• Then the cipher text will be ‘cerotruimusctpey’.
• Same could be arranged in Single slope Rail Fence ,whith
four column.
p r u y
m E c t
o t e i
c u s r

• Cipher text will be read as ‘pruymectoteicusr’


These are various rail fence Technique.

Marathwada Mitra Mandal's


Polytechnic,Pune
Route Cipher
• In a route cipher, plane text is first written in a grud of given
dimensions, and read off pattern given in the key.
• For Example : We learn Computer Security

W E N M T S U T

E A C P E E R Y
• Key
L might
R O specify
U R ‘Spiral
C I inwards,
x clockwise, starting from top
right”
• Cipher text will be ‘tyxicruorlewenmtsureepca’
• Router cipher have many more keys then a rail fence.
• However not all keys are equally good
• Badly chosen route will leave excessive chunks of planetext.

Marathwada Mitra Mandal's


Polytechnic,Pune
Columnar Transposition
• In a columnar transposition, he message is written out in
a row of a fixed length and read out again by column by
column. Columns are chooses in some scrambled order.
• Both the width of the rows and the permutation of the
column are usually define by key word for ex. zebras of
length 6 characters long so the length of rows are 6.
• Permutation is defined by the alphabetical order of the
letters in the keyworders.in this case it is 632415.
• In a regular columnar transposition cipher and space are
filled with nulls;
• The messages are “We learn computer security”
• In regular transposition we write this into the grid as :

Marathwada Mitra Mandal's


Polytechnic,Pune
• Provided nulls [atrbymr]
• apeym lorib ecerr emsty rucar wntut
6 3 2 4 1 5
w e l e a r
n c o m p u
t e r s e c
u r i t y a
t r b y m r

• To decrypt it recipient work out on column length by


dividing message length by the key length.
• Then he can write message in columns again, then
reorder columns by reforming the key word.

Marathwada Mitra Mandal's


Polytechnic,Pune
Steganography
• Steganography is the art and science of writing
hidden message in such a way that no one apart
from sender and intended receiver suspect the
existence of the message.
• Stegnography works by replacing bits of useless or
unused data in a regular computer file with bits of
different , invisible information, this hidden
information can be plane text cipher text or even
image .
• Steganography is used when encryption is not
permitted
• Special software are used for steganography.
Marathwada Mitra Mandal's
Polytechnic,Pune
• Steganography is a Greek word stegano means ‘covered
writing’ and graphy means ‘To write’ .
• In digital steganography, electronic communication may
include steganographic coding inside image file , program
or Protocol.
• Media files are ideal for steganography transmission
because of their large size.
• Steganagrophy embedded a secret message in a cover
message. This process is parameterized by a stego-key .
• To decrypt it stego-key is important.
Cover Media +hidden Data +Stego_Key =Stegno Media

Marathwada Mitra Mandal's


Polytechnic,Pune
• Applications of Steganography.
• Steganography is used by some modern printers. Include
HP and Xerox branded color leaser printers.
• The yellow tiny dots added to each page .
• This dots are encoded print serial number ,date and time
• Steganography is used in Digital Watermarking. Where a
message is hidden in a image so that source can be
traced .

Marathwada Mitra Mandal's


Polytechnic,Pune
Hashing
• Hash function are mathematical algorithm that generate
message summery or digest to confirm the identity of a
specific message and to confirm identity of a specific
message and to confirm that there have not been any
change to the content.
• Hash function is not used to encrypt message but to
confirm identity, integrity of a specific message .

Marathwada Mitra Mandal's


Polytechnic,Pune
• Hash Algorithm : are publically known function that create
hash value, also known as message digest, by converting
variable length message into a single fixed length value .
• The Message Digest : is a digest of authors message that is to
be compared with the receivers locally calculated digest of
the same message. If both hashes are identical after
transmission , the message has arrived without modification.
• Hash function are considered one way operation in that
message will always provided the same hash value itself it can
not be determine content of the message.
• Hashing function do not required the use of keys, but a
message authentication code (MAC) which is key dependent.
• There are two most common hash functions are used MD5
and SHA (Secure Hash Algorithm)

Marathwada Mitra Mandal's


Polytechnic,Pune
Idea of message Digest
• Suppose we have number 4000, now we divide it by 4 answer
is 1000. now if we change 4000 or 4 we can not get 1000.
• Another example we assume that we want to calculate
message digest of a number 7391753. than we multiply each
digit in the number with the next digit and descarding the first
digits of the multiplication operation, if the digit is two digit
number.
7*3=21 = 1
1*9=09 = 9
9*1=09 = 9
9*7= 63= 3
3*5 =15= 5
5*3 =15= 5

Marathwada Mitra Mandal's


Polytechnic,Pune
Secure Hash Function
• Hashing is the transformation of characters into a usually
shorter fixed length value or key that represent the
original string.
• Hashing is used to index and retrieve items in a database
because it is faster to find the item using the shorter
hashed key then to find it using the original value.
• It is also used in many encryption algorithm.
• The hashing algorithm is called the hash function
probably the term is derived from the idea that resulting
value can be through of as “mixed up” version of the
representation value.
• In addition to faster data retrieval , hashing is
also used to encrypt and decrypt digital signature.
Marathwada Mitra Mandal's
Polytechnic,Pune
• The digital signature is transformed with the hash function
and then both the hashed value [known as message
Digest]and the signature are send in separate transmission
to the receiver .
• Using the same hash function as the sender , the receiver
derives a message digest from the signature and compress
it with the message-digest it also received.
• Types of hash function.
– Division remainder method
– Folding Method.
– Radix transformation method
– Digit rearrangement method

Marathwada Mitra Mandal's


Polytechnic,Pune
MD-5
• In cryptography , MD-5 [Message-Digest algorithm] is a
widely used cryptographic hash function with a 128 bit
hash value and is also commonly used to check the
integrity of files. An MD-5 hash is typically expressed as a
32 bit digit hexadecimal number.
• MD5 processes a variable-length message into a
fixed-length output of 128 bits.
• The input message is broken up into chunks of 512-
bit blocks (sixteen 32-bit words).
• the message is padded so that its length is divisible
by 512.

Marathwada Mitra Mandal's


Polytechnic,Pune
• The padding works as follows:
• first a single bit, 1, is appended to the end of the
message.
• This is followed by as many zeros as are required to bring
the length of the message up to 64 bits fewer than a
multiple of 512.
• The remaining bits are filled up with 64 bits representing
the length of ,the original message, modulo 264.
• The main MD5 algorithm operates on a 128-bit state,
divided into four 32-bit words, denoted A, B, C, and D
• These are initialized to certain fixed constants.
• The main algorithm then uses each 512-bit message
block in turn to modify the state.
Marathwada Mitra Mandal's
Polytechnic,Pune
• The processing of a message block consists of four similar
stages, termed rounds; each round is composed of 16
similar operations based on a non-linear
function F, modular addition, and left rotation.

Marathwada Mitra Mandal's


Polytechnic,Pune
SHA (Secure Hash Algorithm)
• One of the algorithm used in public key encryption is
secure hashing Algorithm 1 (SHA 1) which is used to
compute hash value for calculating a 160 bit hash code
base on the plan text message.
• The hash code is then encrypted with DSS or RSA and
appended to the original message.
• The receiver use the sender’s public key to decrypt and
recover the hash code. Using the same encryption
algorithm , receiver then generate a new hash code for
same message.
• If the comparison of two hash code are identical then the
message and the sender are authentic.
Marathwada Mitra Mandal's
Polytechnic,Pune
• Hash Algorithm :
• SHA-1 : is a original 160 bit hash function. Resembling
earlier MD-5 algorithm.
• SHA-2: is a family of two similar hash functions , with
different block size known as SHA-256 and SHA-512.

Marathwada Mitra Mandal's


Polytechnic,Pune
Symmetric and Asymmetric key
cryptography
• Symmetric means Same Key
• Asymmetric Different Key
• Symmetric encryption may also be referred to as shared
key or shared secret encryption. In symmetric encryption,
a single key is used both to encrypt and decrypt traffic.

• In symmetric key cryptography both parties use same kay


secret key for encryption and decryption.
Marathwada Mitra Mandal's
Polytechnic,Pune
• Merits: Much faster then asymmetric key .
• Hard to break if using large key size.
• Demerits:
• Key distribution : It required a secure mechanism to
deliver key properly.
• Scalability: Each pair of user need a unique pair of keys,
so number of keys grow exponentially if there are
number of pairs.
• Limited Security : It ca provided confidentiality but not
authenticity.

Marathwada Mitra Mandal's


Polytechnic,Pune
• Following are the examples of symmetric key cryptography
algothrims.
 Data Encryption Standard (DES)
 Trip DES
 Blowfish. Etc…
Asymmetric key cryptography
• In public key systems each entity has different keys. Or
asymmetric keys.
• Two different keys are mathematically related.
• If a message is encrypted by one key , other key is required to
decrypt it.
• In a public key system a pare of keys is made up of one public
key and one private key.
• Public key can be known by every one and private key can be
known by only owner.

Marathwada Mitra Mandal's


Polytechnic,Pune
• Public keys and private key are mathematically related, but
can not be derived from each other
• This means that if an intruder get a copy of B’s public key
.It does not mean he can now use some mathematical
magic and find out B’s private Kay. If B is encrypted a
message and with the private key receiver must have a
copy of B’s public key to decrypt it.
• The receiver can decrypt B message and decided to reply
back to B in an encrypted form .
• All she need to do is encrypt the reply with B’s public key
and then B can decrypt message with his private key.
• Merits : Better key distribution then symmetric key system.
• Can Provide confidentiality, authentication and non-
repudiation

Marathwada Mitra Mandal's


Polytechnic,Pune
• Demerits : Work much slower then symmetric system.
• Examples : RSA, Elliptic Curve Cryptosystem, Diffie-Hellmen
Digital Signature Standerd(DSS) .

Marathwada Mitra Mandal's


Polytechnic,Pune
• Comparison between Symmetric and Asymmetric Key

Categories

Key used for encryption and Same One Key for Encryption and
Decryption Anther for decryption
Key Process Ke=Kd Ke =! Kd

Speed Encryption Fast Slow

Size of resulting Text Usually Same or less then More then original Size
original
Key Exchange A big Problem No Problem At all

No of keys Required as Equal about square of Same as the number of


compare t number of Participants participants
participants
Uses Mainly for Encryption / For digital Signature
Decryption
Efficient on LongMarathwada
MessageMitra Mandal's Short message
Polytechnic,Pune
Data Encryption Standard
The Data Encryption Standard is generally used in the
ECB,CBC, or the CFB mode.
• DES is a block cipher . It encrypts data in blocks of size 64
bits each. That is,64 bits of plain text goes as the input to
DES ,which produces 64 bits of cipher text.
• DES is based on the two fundamental attributes of
cryptography: substitution and transposition
• Step I: Initial Permutation(IP):it happens only once.it
replaces the first bit of the original plain text block with
the 58th bit of the original plain text block, the second
bit with the 50th bit of original plain text block and so on.
The resulting 64-bits permuted text block is divided into
two half blocks. Each half block consists of 32 bits. The
left block called as LPT and right block called as RPT.16
rounds are performed on these two blocks.
Marathwada Mitra Mandal's
Polytechnic,Pune
Marathwada Mitra Mandal's
Polytechnic,Pune
• Step 1 : key transformation: the initial key is transformed
into a 56-bit key by discarding every 8th bit of initial key .
• Thus, for each round, a 56 bit key is available. From this 56-bit
key, a different 48-bit sub key is generated during each round
using a process called as key transformation
• Step 2: Expansion Permutation: During Expansion
permutation the RPT is expanded from 32 bits to 48 bits.
• The 32-bit RPT is divided into 8 blocks, with each block
consisting of 4- bits. Each 4-bits block of the previous step is
then expanded to a corresponding 6-bit block. Per 4-bit block,
2 more bits are added.
• Step 3: S-box substitution: it accepts the 48-bits input from
the XOR operation involving the compressed key and
expanded RPT and produces 32-bit output using the
substitution techniques.

Marathwada Mitra Mandal's


Polytechnic,Pune
• Step 4:P-box permutation: The output of S-box consists of 32
bits. These 32 bits are permuted using a P-box.
• Step 5: XOR and swap: The LPT of the initial 64-bit plain text
block is XOR ed with the output produced by P-box
permutation. The result of this XOR operation becomes the
new RPT. The old right half (RPT) becomes the new left half, in
the process of swapping.Marathwada Mitra Mandal's
Polytechnic,Pune
• Final permutation: At the end of 16 rounds, the Final
Permutation is performed only once.
Digital Signature

Marathwada Mitra Mandal's


Polytechnic,Pune
Thank You !!

Marathwada Mitra Mandal's


Polytechnic,Pune

You might also like