Chapter 3 Cryptography
Chapter 3 Cryptography
Plain text
Plain text signifies a message that can be understood by the sender, the recipient and also by
anyone else who gets an access to the message.
Cipher text
When a plain text message is codified using any suitable scheme, the resulting message is
called as cipher text.
Cryptography
Cryptography is an ancient art and science of writing in secret message. In areas like data and
telecommunication, cryptography is most important when communicating over any untrusted
medium. It includes any network, internet.
Cryptography, not only protect data from alteration, but it can also be used for authentication
of users.
Applications of Cryptography
1. Data Hiding: The original use of cryptography is to hide something that has been
written.
2. Digitally Code: Cryptography can also be applied to software, graphics or voice that
is, it can be applied to anything that can be digitally coded.
4. Message Authentication: One cannot entirely prevent someone from tampering with
the network and changing the message, but if this happens it can certainly be detected.
This process of checking the integrity of the transmitted message is often called message
authentication. The most recent and useful development in the uses of cryptography is
the Digital Signature
5. Mobile banking, ATM , Credit cards
The process of encoding plain text into cipher text message is known as Encryption.
Decryption:
The process of transforming cipher text message into plain text or original text is known as
Decryption.
At the time of communication , the sender computer transforms a plain text message into
cipher text message with the help of encryption.
Then the encrypted cipher text message is sent to the receiver over a network i.e. internet.
The computer at receivers end then takes this encrypted message, and perform the reverse
of encryption means the decryption process to get original plaintext message.
For encryption a plaintext message , the sender performs encryption with the help of
different encryption algorithms.
For decrypting a received encrypted message, the recipient performs the decryption with
the help of decryption algorithms.
Substitution and Transposition Techniques:
In substitution technique, letters of plaintext can be replaced by another letters or
numbers or symbols.
CAESAR’S CIPHER :
Mono-alphabetic Cipher
PolyGram Substitution Cipher Technique replaces one block of plain text with a block of
cipher text.
Example:
Transportation technique does not replace alphabets from plaintext with other whereas, it
performs some permutation on alphabets of plaintext.
1. Write the plain text message row by row in a rectangle of a predefined size (keyword
size)
2. Read the message column by column, however, it need not be in the order of columns, it
can be any random order.
Keyword: ZEBRAS
Consider a rectangle with six column and. Therefore, when the message is written in the
rectangle row by row it will look as follow
C O M E H O
M E T O M O
R R O W
Now, decide the order of columns as some random order, say, 4, 6, 1, 2, 5, 3 Then read
the text in the order of these columns.
The cipher text obtained from it would be :EOW OO CMR OER HM MTO
While Decryption phase the cipher is written back in same rectangle with same size and
all ciphers are placed as per the key.
Double Columnar Transposition technique
Algorithm Steps:-
1. Write the plain text message row by row in a rectangle of a predefined size
(keyword size)
2. Read the message column by column, however, it need not be in the order of
columns, it can be any random order.
C O M E H O
M E T O M O
R R O W
Now, decide the order of columns as some random order, say, 4, 6, 1, 2, 5, 3 Then
read the text in the order of these columns.
The cipher text obtained from it would be :EOW OO CMR OER HM MTO
Column 1 Column 2 Column 3 Column 4 Column 5 Column 6
E O W O O C
M R O E R H
M M T O
Alternative is first encrypt the message and then hide using Steganography.
Advantage is that it can be employed by parties who have something to loss should the
fact of their secret communication be discovered.
Encryption flags are important or secret or may identify the sender as someone with
something to hide.
Terminology used in steganography:
Redundant Bits: Bits or data in cover-medium that can be modified without compromising
that medium’s integrity.
Symmetric and Asymmetric Cryptography:
Cryptographic algorithms are nothing but the sequences of processes or rules, which are
used to encode and decode message in a cryptographic system.
Asymmetric Algorithm.
Introduction to Symmetric Encryption:
In symmetric algorithm, the same key is used for encryption and decryption. Hence this is
also known as single key or secret key or shared key algorithm The key has to be kept
secret, sender and receiver uses the same key to read encrypted data. The key is only
known to sender and receiver and no one else.
Encryption algorithms are divided into two types:
Block Cipher:
Block Cipher technique involves encryption of one block of text at a time. Decryption also
takes one block of encrypted text at a time.
The blocks used in block ciphers generally contain 64 bits or more.
Advantages: Random Access, Potentially High Security.
Disadvantages: Larger Block Size needed, Patterns retained throughout messages.
Stream Cipher:
Stream Cipher technique involves the encryption of one plain text byte at a time. The
decryption also happens one byte at a time .
Advantages: Can work on smaller Block series, Little memory/processing/Buffering Needed.
Disadvantages: Random Access Difficult, Hard to use large keys, sender and receiver must
be synchronized, inserted bits can lead to errors.
Data Encryption Standard (DES):
The DES is the classic among the symmetric block cipher algorithms. DES was developed
in the 1970s as a US-government standard for protecting non-classified information and
was published as a Federal Information Processing Standard.
DES encrypts 64 bit clear text blocks under the control of 56 bit keys. Each key is extended
by a parity byte to give a 64 bit working key.
Each round performs the steps of substitution and transportation techniques for scrambling
of the characters.
Steps:
64 bit plaintext is handed over to an Initial Permutation (IP) function.
Initial Permutation is performed on plaintext.
IP produces two halves of permuted block. Left Plaintext (LPT) and Right Plaintext (RPT).
Each LPT and RPT goes through 16 rounds of encryption process each with its own key.
In the end LPT and RPT are re-joined and Final Permutation (FP) is performed on the
combined block.
The result is 64 bit Cipher text.
Initial Permutation (IP) happens only once. IP replaces the first bit of original Plaintext block
with 58 th bit of original plaintext block, second bit with the 50 th bit and so on.
Complete transposition table is used by IP and should read from left to right.
After IP is done, the resulting 64 bit text block is divided into two half block , each with 32
bit (LPT and RPT).
Now 16 rounds are performed on these blocks.
Each 16 Rounds are consists of following broad level steps.
Key Transformation:
During each round, a separate 48 bit sub-key is generated from 56 bit key using key
transformation process.
This is possible by dividing 56 key into 2 half of 28 bits. Now, these 28 bits are
circularly shifted left by one or two positions depending upon round.
During this phase, the Right plaintext (RPT) is expanded from 32 bits to 48 bits.
Then the 32 bit RPT is divided into 8 different blocks and each block consisting of 4 bits.
Next, each 4 bit block of previous step is expanded to a corresponding 6 bit block i.e. per 4
bit block, 2 more bits.
This process results into expansion as well as permutation of the input bits. While creating
the output.
48 bit key is XOR with 48 bit RPT and resulting output is given to next step.
S- Box Substitution:
This process accepts the 48 bit input from the XOR operation involving the compressed
key and expanded RPT and produces a 32- bit output using substitute technique.
The substitution is performed by 8 substitution boxes, and it has 6 bit input and 4 bit
output.
The output of each S box is combined to form 32 bit block and given to next stage.
P- Box Permutation:
For example- 16 in the block indicates that the bit at position 16 of the original input
moves to a bit at position 1 in output.
XOR and swap :
Left half portion of the initial 64 bit text block is XORed with the output produced by
P- Box permutation.
• One key used for encryption and another, different key for decryption.
Authentication
Integrity