0% found this document useful (0 votes)
14 views11 pages

ciphers-converted

The document discusses symmetric-key cryptography, where both sender and receiver use a shared secret key for encryption and decryption. It covers various classical encryption techniques, including substitution methods like the Caesar and Playfair ciphers, as well as block and stream ciphers in modern cryptography. Additionally, it highlights the importance of key management and the principles behind block ciphers, including padding and the Feistel cipher structure.

Uploaded by

Prithvi Madivada
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views11 pages

ciphers-converted

The document discusses symmetric-key cryptography, where both sender and receiver use a shared secret key for encryption and decryption. It covers various classical encryption techniques, including substitution methods like the Caesar and Playfair ciphers, as well as block and stream ciphers in modern cryptography. Additionally, it highlights the importance of key management and the principles behind block ciphers, including padding and the Feistel cipher structure.

Uploaded by

Prithvi Madivada
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

+


UNIT-2
SYMMETRIC-KEY CRYPTOGRAPHY
In this technique,
● Both sender and receiver uses a common key to encrypt and decrypt the message.
● This secret key is known only to the sender and to the receiver.
● It is also called as secret key cryptography.

W orking-

The message exchange using symmetric key cryptography involves the following steps-

● Before starting the communication, sender and receiver shares the secret key.
● This secret key is shared through some external means.
● At sender side, sender encrypts the message using his copy of the key.
● The cipher text is then sent to the receiver over the communication channel.
● At receiver side, receiver decrypts the cipher text using his copy of the key.
● After decryption, the message converts back into readable format.

Classical Encryption Techniques:


All encryption techniques are based on 2 methods, which can be used separately or together:
1- Substitution
2- Transposition
1- Substitution Encryption Techniques:
Substitution is an encryption technique where elements in the plaintext are replaced or
mapped with another elements. There are many types of the substitution techniques such as
(monoalphabetic cipher and polyalphabetic cipher).

A – Monoalphabetic Cipher
Let’s look at an example of monoalphabetic cipher called Caesar cipher.
Caesar Cipher:
Is the simplest and the oldest known encryption techniques where elements in the plaintext
are shifted a fixed number of spaces. For example, they’re moved 3 places:
Example:

Plaintext : WELCOME TO CRYPTOGRAPHY


Ciphertext : ZHOFRPH WR FUBSWRJUDSKB

The ciphertext is produced by adding 3 positions for every letter.


As we can see here, the encryption algorithm for each plaintext P to produce a ciphertext C,
where C = E(3,P) = (P+3)mod26.
So, generally the encryption algorithm for Caesar cipher is C= E(K,P) = (P+K)mod26
The decryption algorithm for Caeser cipher is: P= D(K,C) = (C-K)mod26
Note: K takes a value from 1 to 25.
The shift cipher is sometimes referred to as the Caesar cipher.
Example 1:
By Using casear cipher with key = 15 to encrypt the message“hello”.

Solution:

We apply the encryption algorithm to the plaintext, character by character. The result is
“WTAAD”. Note that the cipher is monoalphabetic because two instances of the same
plaintext character (ls) are encrypted as the same character (A).

Playfair Cipher:

Not even the large number of keys in a monoalphabetic cipher provides security. One
approach to improving security is to encrypt multiple letters at a time.The Playfair Cipher is
the best known such cipher.

The Playfair Cipher operates on pairs of letters (bigrams).

● The key is a 5x5 square (I and J are treated as the same letter).

A key word, ‘tutorials’ In a key table, the first characters (going left to right) in the table is
the phrase, excluding the duplicate letters. The rest of the table will be filled with the
remaining letters of the alphabet, in natural order. The key table works out to be −
Playfair Cipher: Encryption

Rules:

● First, a plaintext message is split into pairs of two letters (digraphs). If there is an odd
number of letters, a Z is added to the last letter. Let us say we want to encrypt the
message “hide money”. It will be written as −
HI DE MO NE YZ
● The rules of encryption are −
o If both the letters are in the same column, take the letter below each one
(going back to the top if at the bottom)

T U O R I

A L S B C

D E F G H ‘H’ and ‘I’ are in same column, hence take letter below them
to replace. HI → QC

K M N P Q

V W X Y Z

● If both letters are in the same row, take the letter to the right of each one (going back
to the left if at the farthest right)

T U O R I
‘D’ and ‘E’ are in same row, hence take letter to the right of
them to replace. DE → EF
A L S B C
D E F G H

K M N P Q

V W X Y Z

● If neither of the preceding two rules are true, form a rectangle with the two letters
and take the letters on the horizontal opposite corner of the rectangle.

Using these rules, the result of the encryption of ‘hide money’ with the key of ‘tutorials’
would be −
QC EF NU MF ZV
Decrypting the Playfair cipher is as simple as doing the same process in reverse. Receiver
has the same key and can create the same key table, and then decrypt any messages made
using that key.
S trength :

of playfair cipher Playfair cipher is a great advance over simple mono alphabetic ciphers. Since
there are 26 letters, 26x26 = 676 diagrams are possible, so identification of individual diagram is
more difficult.

HILL CIPHER:
Description
The Hill cipher is an example of a block cipher. A block cipher is a cipher in which groups of
letters are enciphered together in equal length blocks. The Hill cipher was developed by
Lester Hill and introduced in an article published in 1929[1].
Encipher
In order to encrypt a message using the Hill cipher, the sender and receiver must first agree
upon a key matrix A of size n x n. Amust be invertible mod 26. The plaintext will then be
enciphered in blocks of size n. In the following example A is a 2 x 2 matrix and the message
will be enciphered in blocks of 2 characters.
Formula: C= KP MOD 26 (K MEANS KEY,P MEANS PLAIN TEXT
Key Matrix: A =
Message: MISSISSIPPI

The first block MI corresponds to the matrix . The sender will then

calculate: A = (mod 26)


The first two letters of the ciphertext correspond to 2,8 and are therefore CI. This step is
repeated for the entire plaintext. If there are not enough letters to form blocks of 2, pad the
message with some letter, say Z.
The message: MI SS IS SI PP IK
will be enciphered as:
CI KK GE UW ER OY
Notice that the repeated digraphs IS, SS and repeated letters S and P in the plaintext are
masked using the Hill cipher.
Polyalphabetic substitution cipher:

Vigenère
Cipher
Description
The Vigenère cipher is an example of a polyalphabetic substitution cipher. A polyalphabetic
substitution cipher is similar to a monoalphabetic substitution except that the cipher alphabet
is changed periodically while enciphering the message. This makes the cipher less vulnerable
to cryptanalysis using letter frequencies.
Encipher: In order to encipher a message using the Vigenère autokey method, the sender
and receiver must first agree on a priming key. The priming key is a single letter that will be
added to the beginning of the message to form the key. The sender will encrypt the message
by writing the plaintext on one line and writing the key on the line beneath it. The sender will
use the plaintext and key letters to select a row and a column in the Vigenère square. The
selected row is the row in which the plaintext letter is in the first column and the selected
column is the column in which the key letter is in the first row. A ciphertext letter will be the
letter that appears in the Vigenère square at the position corresponds to the selected row and
column.
FORMULA: C= (P+K) MOD 26
P=(C-K) MOD 26
Priming key: L

plaintext: T O B E O R N O T T O B E

key: L T O B E O R N O T T O B
ciphertext: E H P F S F E B H M H P F

Strength of Vigenere cipher:


There are multiple cipher text letters for each plaintext letter.
Letter frequency information is obscured

One Time Pad(vernam cipher) :(OTP) is the only potentially unbreakable encryption
method. Plain text encrypted using an OTP cannot be retrieved without the encrypting key.
However, there are several key conditions that must be met by the user of a one time pad
cipher, or the cipher can be compromised.

● The key must be random and generated by a non-deterministic, non-repeatable process.


Any key generated by an algorithm will not work
● The key must never be reused. Use of the same key to encrypt different messages, no
matter how trivially small, compromises the cipher.
● The key must not fall in the hands of the enemy. This may seem obvious, but it points to
the weakness of system in that you must be able to transmit large amounts of data to the
reader of the pad.

Encryption:
A typical one time pad system works like this: Generate a long fresh new random key. XOR
the plaintext with the key to create the ciphertext.
Decryption:
To decrypt the ciphertext, XOR it with the original key. The system as presented is thus a
symmetric and reciprocal cipher. Other functions (e.g., addition modulo n) could be used to
combine the key and the plaintext to yield the ciphertext, although the resulting system may
not be a reciprocal cipher.

E xample:
T ransposition Cipher:
Description
The idea behind a transposition cipher is to create a permutation (rearrangement) of the
letters of the plaintext that will make the ciphertext appear to be well-encrypted.
Transposition ciphers are not highly secure because they do not change the letters in the
plaintext or even cover up frequencies, but they can be built upon to make more secure
methods of encryption. One example of transposition cipher is the rail fence cipher.
Example
The rail fence cipher is a very simple columnar transposition that takes a string and splits
the letters into two groups by way of a zigzag pattern, as shown below:
Encipher
plaintext = WHEN DRINKING WATER, REMEMBER ITS SOURCE.
compressed plaintext = WHENDRINKINGWATERREMEMBERITSSOURCE

zig: W E D I K N W T R E E B R T S U C

zag: H N R N I G A E R M M E I S OR E

zig=WEDIKNWTREEBRTSUC
zag=HNRNIGAERMM/8EISO
RE
ciphertext=zig+zag
ciphertext=WEDIKNWTREEBRTSUCHNRNIGAERMMEISORE

Decipher
To decipher, simply cut the ciphertext in half and create a new string with alternating letters
from both substrings.
substring_1=WEDIKNWTREEBRTSUC
substring_2=HNRNIGAERMMEISORE
newstring = W + H + E + N + D + R + … + U + R + C + E"
Modern Symmetric Key Encryption:
Digital data is represented in strings of binary digits (bits) unlike alphabets. Modern
cryptosystems need to process this binary strings to convert in to another binary string.
Based on how these binary strings are processed, a symmetric encryption schemes can be
classified in to −
Block Ciphers
In this scheme, the plain binary text is processed in blocks (groups) of bits at a time; i.e. a
block of plaintext bits is selected, a series of operations is performed on this block to
generate a block of ciphertext bits. The number of bits in a block is fixed. For example, the
schemes DES and AES have block sizes of 64 and 128, respectively.
Stream Ciphers
In this scheme, the plaintext is processed one bit at a time i.e. one bit of plaintext is taken,
and a series of operations is performed on it to generate one bit of ciphertext. Technically,
stream ciphers are block ciphers with a block size of one bit.

Block cipher:

Block Size:
However any size of block is satisfactory, resulting aspects are borne in mind while selecting
a size of a block.
● Avoid very small block size − Say a block size is m bits. Then the likely plaintext bits
combinations are then 2m. If the attacker learns the plain text blocks consistent to some
before sent ciphertext blocks, then the attacker can launch a type of ‘dictionary attack’ by
building up a dictionary of plaintext/ciphertext pairs sent using that encryption key. A
larger block size makes attack harder as the dictionary needs to be larger.
● Do not have very large block size − With very large block size, the cipher becomes
inefficient to operate. Such plaintexts will need to be padded before being encrypted.
● Multiples of 8 bit − A preferred block size is a multiple of 8 as it is easy for
implementation as most computer processor handle data in multiple of 8 bits.
Padding in Block Cipher:
Block ciphers method blocks of fixed sizes (say 64 bits). The length of plaintexts is typically
not a many of the block size. For instance, a 150-bit plaintext delivers two blocks of 64 bits
each with third block of balance 22 bits. The latter block of bits wants to be padded up with
dismissed information so that the length of the final block equal to block size of the scheme.
In our instance, the remaining 22 bits need to have additional 42 redundant bits added to offer
a complete block. The procedure of adding bits to the last block is referred to as padding.
Too much padding makes the system inefficient. Also, padding may render the system
insecure at times, if the padding is done with same bits always.

Block Cipher Schemes:


There is a massive number of block ciphers systems that are in use. Several of them are
openly known. Most general and noticeable block ciphers are listed below.
● Digital Encryption Standard (DES) − The popular block cipher of the 1990s. It is now
measured as a ‘broken’ block cipher, due mainly to its small key size.
● Triple DES − It is a variant scheme based on repeated DES applications. It is still a
esteemed block ciphers but incompetent compared to the new faster block ciphers
available.
● Advanced Encryption Standard (AES) − It is a relatively new block cipher based on the
encryption algorithm Rijndael that won the AES design competition.
● IDEA − It is a sufficiently strong block cipher with a block size of 64 and a key size of
128 bits. A number of applications use IDEA encryption, including early versions of Pretty
Good Privacy (PGP) protocol. The use of IDEA scheme has a restricted adoption due to
patent issues.
● Twofish − This scheme of block cipher uses block size of 128 bits and a key of variable
length. It was one of the AES finalists. It is based on the earlier block cipher Blowfish with
a block size of 64 bits.
● Serpent − A block cipher with a block size of 128 bits and key lengths of 128, 192, or 256
bits, which was also an AES competition finalist. It is a slower but has more secure design
than other block cipher.

Block cipher principles:

• most symmetric block ciphers are based on a Feistel Cipher Structure


• needed since must be able to decrypt ciphertext to recover messages efficiently
• block ciphers look like an extremely large substitution
• would need table of 264 entries for a 64-bit block
• instead create from smaller building blocks
• using idea of a product cipher in 1949 Claude Shannon introduced idea of substitution
permutation (S-P) networks called modern substitution-transposition product cipher these form
the basis of modern block ciphers.

Feistel cipher structure:


● The input to the encryption algorithm are a plaintext block of length 2w bits and a key
K. the plaintext block is divided into two halves L0 and R0.
● The two halves of the data pass through „n‟ rounds of processing and then combine to
produce the ciphertext block.
● Each round „i‟ has inputs Li-1 and Ri-1, derived from the previous round, as well as the
subkey Ki , derived from the overall key K. in general, the subkeys Ki are different from K
and from each other.

All rounds have the same structure. A substitution is performed on the left half of the data
(as similar to S-DES). This is done by applying a round function F to the right half of the data
and then taking the XOR of the output of that function and the left half of the data. The
round function has the same general structure for each round but is parameterized by the
round subkey ki . Following this substitution, a permutation is performed that consists of
the interchange of the two halves of the data. This structure is a particular form of the
substitution-permutation network.

The exact realization of a Feistel network depends on the choice of the following
parameters and design features: Block size - Increasing size improves security, but slows
cipher

· Key size - Increasing size improves security, makes exhaustive key searching harder,
but may slow cipher
Number of rounds - Increasing number improves security, but slows cipher
· Subkey generation - Greater complexity can make analysis harder, but slows cipher
· Round function - Greater complexity can make analysis harder, but slows cipher

· Fast software en/decryption· & ease of analysis - are more recent concerns for practical
use and testing.

The process of decryption is essentially the same as the encryption process. The rule is as
follows: use the cipher text as input to the algorithm, but use the subkey ki in reverse
order. i.e., kn in the first round, kn-1 in second round and so on. For clarity, we use the
notation LEi and REi for data traveling through the decryption algorithm. The diagram
below indicates that, at each round, the intermediate value of the decryption process is
same (equal) to the corresponding value of the encryption process with two halves of the
value swapped.

i.e., REi || LEi (or) equivalently RD16-i || LD16-i

After the last iteration of the encryption process, the two halves of the output are
swapped, so that the cipher text is RE16 || LE16. The output of that round is the cipher
text. Now take the cipher text and use it as input to the same algorithm. The input to the
first round is RE16 || LE16, which is equal to the 32-bit swap of the output of the sixteenth
round of the encryption process.

Now we will see how the output of the first round of the decryption process is equal to a
32-bit swap of the input to the sixteenth round of the encryption process.
First consider the encryption process,
Feistel encryption and decryption

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy