0% found this document useful (0 votes)
10 views56 pages

Classical Encryption Techniques

The document provides an overview of basic cryptographic terminology and techniques, including symmetric and asymmetric encryption, enciphering, and deciphering processes. It discusses various ciphers such as the Caesar cipher, monoalphabetic and polyalphabetic ciphers, and the Vernam cipher, detailing their mechanisms and security features. Additionally, it covers the concept of brute-force attacks and the importance of key management in encryption schemes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views56 pages

Classical Encryption Techniques

The document provides an overview of basic cryptographic terminology and techniques, including symmetric and asymmetric encryption, enciphering, and deciphering processes. It discusses various ciphers such as the Caesar cipher, monoalphabetic and polyalphabetic ciphers, and the Vernam cipher, detailing their mechanisms and security features. Additionally, it covers the concept of brute-force attacks and the importance of key management in encryption schemes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Basic Terminology

• Plaintext
• The original message • Cryptanalysis
Ciphertext (breaking the code)
• The coded message • Techniques used for deciphering
a message without any
• Enciphering or Encryption knowledge of the enciphering
• Process of converting from details
plaintext to ciphertext
• Cryptology
• Deciphering or Decryption • Areas of cryptography and
• Restoring the plaintext cryptanalysis together
from the ciphertext

• Cryptography
• Study of encryption
Symmetric Encryption
• Also referred to as conventional encryption or
single-key encryption
• Was the only type of encryption in use prior to
the development of public-key encryption in
the 1970s
• Remains by far the most widely used of the
two types of encryption.
• 1. symmetric ciphers
• 2. variety of algorithms
Simplified Model of
Symmetric Encryption
Symmetric Encryption
A symmetric encryption scheme has five ingredients

• Plaintext: This is the original intelligible message or data that


is fed into the algorithm as input.

• Encryption algorithm: The encryption algorithm performs


various substitutions and transformations on the plaintext.

• Secret key: The secret key is also input to the encryption


algorithm. The key is a value independent of the plaintext and
of the algorithm. The algorithm will produce a different output
depending on the specific key being used at the time. The exact
substitutions and transformations performed by the algorithm
depend on the key.
• Ciphertext:

This is the scrambled message produced as output. It


depends on the plaintext and the secret key. For a given
message, two different keys will produce two different
ciphertexts. The ciphertext is an apparently random stream of
data and, as it stands, is unintelligible.

• Decryption algorithm:

This is essentially the encryption algorithm run in reverse. It


takes the ciphertext and the secret key and produces the
original plaintext.
Model of Symmetric
Cryptosystem
Cryptographic Systems
• Characterized along three independent dimensions:
The type of operations
The number of keys The way in which the
used for transforming
used plaintext is processed
plaintext to cipher text
Symmetric, single-key,

Substitution
secret-key,
conventional
Block
encryption
(same key)
cipher -
Asymmetric, two-key,

Transposition
or public-key
encryption (different
Stream
Keys both sender &
receiver)
cipher
Substitution, in which each element in the plaintext (bit,
letter, group of bits or letters) is mapped into another element.

Transposition, in which elements in the plaintext are


rearranged

• A block cipher processes the input one block of elements


at a time, producing an output block for each input block.

• A stream cipher processes the input elements


continuously, producing output one element at a time, as
it goes along
Encryption Scheme Security
• Unconditionally secure (LONG TIME)
• No matter how much time an opponent has, it is
impossible for him or her to decrypt the ciphertext
simply because the required information is not there

• Computationally secure (REQUIRED TIME)


• The cost of breaking the cipher exceeds the value of
the encrypted information
• The time required to break the cipher exceeds
the useful lifetime of the information
Brute-Force Attack
may have a dictionary of all words or
commonly used passwords and cycle
through those words until it gains
access to the account.

A more complex brute-force attack


involves trying every key combination
until the correct password is found.

Due to the number of possible


combinations of letters, numbers, and
symbols, a brute force attack can take
a long time to complete
1. Substitution Technique
• Is one in which the letters of plaintext are
replaced by other letters or by numbers or
symbols

• If the plaintext is viewed as a sequence of bits,


then substitution involves replacing plaintext
bit patterns with ciphertext bit patterns
Caesar Cipher
• Simplest and earliest known use of a substitution
cipher
• Used by Julius Caesar
• Involves replacing each letter of the alphabet with
the letter standing three places further down the
alphabet
• Alphabet is wrapped around so that the letter
following Z is A
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
Caesar Cipher Algorithm
• Can define transformation as:
abcdefghijklmnopqrstuvwxyz
DEFGHIJKLMN OPQR STUVW XYZABC

• Mathematically give each letter a number


abcdefghij k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

• Algorithm can be expressed as: c = E(3, p) = (p + 3) mod (26)

• A shift may be of any amount, so that the general Caesar algorithm is:

C = E(k , p ) = (p + k ) mod 26

• Where k takes on a value in the range 1 to 25;

• the decryption algorithm is simply:

• p = D(k , C ) = (C - k ) mod 26
Brute-Force
Cryptanalysis
of Caesar
Cipher
Sample of Compressed Text
1.1 Monoalphabetic Cipher
• A monoalphabetic cipher uses fixed substitution over the entire
message, whereas a polyalphabetic cipher uses a number of
substitutions at different positions in the message,

• It replaces each letter of a plaintext by another letter or symbol,


depending only on the letter.

• Permutation
• Of a finite set of elements S is an ordered sequence of all the elements of S ,
with each element appearing exactly once

• If the “cipher” line can be any permutation of the 26 alphabetic


characters, then there are 26! or greater than 4 x 1026 possible keys

• This is 10 orders of magnitude greater than the key space for DES
• Approach is referred to as a monoalphabetic substitution cipher
because a single cipher alphabet is used per message
Monoalphabetic Ciphers
• Easy to break because they reflect the frequency
data of the original alphabet
• Countermeasure is to provide multiple substitutes
(homophones) for a single letter
• Digram
• Two-letter combination
• Most common is th

• Trigram
• Three-letter combination
• Most frequent is the
Playfair Cipher
• Best-known multiple-letter encryption cipher
• Treats digrams in the plaintext as single units and
translates these units into ciphertext digrams
• Based on the use of a 5 x 5 matrix of letters
constructed using a keyword
• Invented by British scientist Sir Charles
Wheatstone in 1854
• Used as the standard field system by the British
Army in World War I and the U.S. Army and other
Allied forces during World War II
Playfair Key Matrix
• Fill in letters of keyword (minus duplicates)
from left to right and from top to bottom,
then fill in the remainder of the matrix with the
remaining letters in alphabetic order.

• The letters I and J count as one letter.


Plaintext is encrypted two letters at a time,
Using the keyword MONARCHY:
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypting and Decrypting
method in Playfair
• plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
eg. "balloon" encrypts as "ba lx lo on"
1. if both letters fall in the same row, replace each with
letter to right.(wrapping back to start from end)
eg. “ar" encrypts as "RM"
1. if both letters fall in the same column, replace each with
the letter below it (again wrapping to top from bottom)
eg. “mu" encrypts to "CM"
2. otherwise each letter is replaced by the letter in the
same row and in the column of the other letter of the
pair
eg. “hs" encrypts to "BP", and “ea" to "IM" or "JM"
Hill Cipher
• Developed by the mathematician Lester Hill in
1929
• Strength is that it completely hides single-letter
frequencies
• The use of a larger matrix hides more frequency
information
• A 3 x 3 Hill cipher hides not only single-letter but
also two-letter frequency information

• Strong against a ciphertext-only attack but easily


broken with a known plaintext attack
Example of Hill cipher
• This example will rely on some linear algebra and some number theory.
The key for a hill cipher is a matrix e.g.

• In the above case, we have taken the size to be 3×3, however it can be any
size (as long as it is square).

• Assume we want to encipher the message ATTACK AT DAWN. To encipher


this, we need to break the message into chunks of 3. We now take the first
3 characters from our plaintext, ATT and create a vector that corresponds
to the letters (replace A with 0, B with 1 ... Z with 25 etc.) to get: [0 19
19] (this is ['A' 'T' 'T']).
• To get our ciphertext we perform a matrix multiplication (you
may need to revise matrix multiplication if this doesn't make
sense):

• This process is performed for all 3 letter blocks in the


plaintext. The plaintext may have to be padded with some
extra letters to make sure that there is a whole number of
blocks.

• Now for the tricky part, the decryption. We need to find an


inverse matrix modulo 26 to use as our 'decryption key'. i.e.
we want something that will take 'PFO' back to 'ATT'. If our 3
by 3 key matrix is called K, our decryption key will be the 3 by
3 matrix K-1, which is the inverse of K.

To find K-1 we have to use a bit of maths.


It turns out that K-1 above can be calculated from our key
1.2Polyalphabetic Ciphers
• Polyalphabetic substitution cipher is, also called a
Vigenere Cipher was developed by mathematician
Blaise de Vigenere in the 16th century.
• The Polyalphabetic Cipher was adapted as a twist on
the standard Caesar cipher to reduce the
effectiveness of frequency analysis on the ciphertext.
• All these techniques have the following features in common:

• A set of related monoalphabetic substitution rules is used


• A key determines which particular rule is chosen for a given
transformation
Example Vigenere cipher

• The Vigenère cipher uses a 26×26 table with A to Z as the row


heading and column heading This table is usually referred to as
the Vigenère Table or Vigenère Square.

• The first row of this table has the 26 English letters. Starting with
the second row, each row has the letters shifted to the left one
position in a cyclic way.

• For example, when B is shifted to the first position on the second


row, the letter A moves to the end.
• It consists of the alphabet written out 26 times in different rows, each
alphabet shifted cyclically to the left compared to the previous alphabet,
corresponding to the 26 possible Caesar ciphers.

• For example, suppose that the plaintext to be encrypted is:

• ATTACKATDAWN
Plaintext: ATTACKATDAWN

• the keyword "LEMON" Key: LEMONLEMONLE

• LEMONLEMONLE Ciphertext: LXFOPVEFRNHR


Vernam Cipher
• Vernam cipher is a symmetrical stream cipher.
• Best known and one of the simplest polyalphabetic
substitution ciphers.
• in which the plaintext is combined with a random or
pseudorandom stream of data (the "keystream") of the same
length, to generate the ciphertext, using the Boolean
"exclusive or" (XOR) function.
• The Vernam Cipher is based on the principle that
each plaintext character from a message is 'mixed' with one
character from a key stream.
• The result will be a truly random' ciphertext which bears no
relation to the original plaintext.
Example of Vernam Cipher
• The principle of the Vernam Cipher is perhaps
easier explained by looking at a message stored on
a punched paper tape.

• In the example below, we want to transmit the


word HELLO which is stored on the plain
text tape.

• We also have a pre-recorded key tape, with a


series of random characters; in this case the
sequence AXHJB.
• The contents of the plaintext tape are now
XOR-ed with the contents of the key tape.

• The result (KMIVE) is shown here as


the ciphertext tape:

Mixing of the plaintext and the key


Vernam Cipher Autokey System
• Now let us see what happens if we repeat this
operation on the resulting ciphertext tape
with the letters 'KMIVE'.

• In the illustration below, the ciphertext tape is


on the left.

• It is XOR-ed with a copy of the original


key tape (AXHJB), resulting in the
original plaintext: 'HELLO'.
• This process of applying the XOR-operation
to text and key is often called mixing, and the
cipher machines that use the Vernam principle,
are therefore known as mixers.

Mixing of
the ciphertext and
the key
Mixing of the ciphertext and the key with the
human eye
Vernam Cipher
One-Time Pad
• Improvement to Vernam cipher proposed by
an Army Signal Corp officer, Joseph
Mauborgne
• Use a random key that is as long as the
message so that the key need not be repeated
• Key is used to encrypt and decrypt a single
message and then is discarded
• Each new message requires a new key of the
same length as the new message
• In this example, the technique is to combine the key and the message
using modular addition. The numerical values of corresponding message and
key letters are added together, modulo 26. So, if key material begins with
"XMCKL" and the message is "HELLO", then the coding would be done as
follows:

• H E L L O plaintext

7 (H) 4 (E) 11 (L) 11 (L) 14 ( O) plaintext


+ 23 (X) 12 (M) 2 (C) 10 (K) 11 (L) key
= 30 16 13 21 25 plaintext + key
= 4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z) plaintext + key (mod 26)

E Q N V Z ciphertext
• If a number is larger than 26, then the remainder after subtraction of 26 is taken in
• The ciphertext to be sent to Bob is thus "EQNVZ". Bob uses the
matching key page and the same process, but in reverse, to
obtain the plaintext. Here the key is subtracted from the
ciphertext, again using modular arithmetic:

• E Q N V Z ciphertext

• 4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z) ciphertext

• - 23 (X) 12 (M) 2 (C) 10 (K) 11 (L) key

• = -19 4 11 11 14 ciphertext – key

• = 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) ciphertext – key (mod 26)

• H E L L O → message

• Similar to the above, if a number is negative then 26 is


added to make the number zero or higher.
Difficulties
• The one-time pad offers complete security but, in
practice, has two fundamental difficulties:

• There is the practical problem of making large


quantities of random keys
• Any heavily used system might require millions of
random characters on a regular basis
• Mammoth key distribution problem
• For every message to be sent, a key of equal length
is needed by both sender and receiver

• Because of these difficulties, the one-time pad is


of limited utility
• Useful primarily for low-bandwidth channels requiring
very high security
2.Transposition Techniques

is a very kind of mapping is achieved by performing some


sort of permutation on the plain texts this technique is
called transposition techniques.
• 2.1 Rail Fence Cipher
• Simplest transposition cipher

• Plaintext is written down as a sequence of diagonals and then read off as a


sequence of rows

• To encipher the message “meet me after the toga party” with a rail fence of depth
2, we would write:
mematrhtgpry
etefeteoaat
The Ciphertext is:
MEMATRHTGPRYETEFETEOAAT
2.2Row Column Transposition Cipher

• Is a more complex transposition

• Write the message in a rectangle, row by row, and


read the message off, column by column, but permute
the order of the columns
• The order of the columns then becomes the key to the
algorithm
Key: 4312 5 67
Plaintext: atta c kp
ostpone
dunt i l t
w o a mx y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Again re- transposition (ie) re –encrypted

Key: 4 3 1 2 5 6 7
Plaintext: t t n a a p t
mt s u o a o
d wc o i x k
n l y p e t z
Ciphertext:
NSCYAUOPTTWLTMDNAOIEPAXTTOKZ

The result of this double transposition, designate the


letters in the original plaintext message by the
numbers designating their position.
ROTOR Machines
• The most important application of the principle stages of
encryption was a class of systems known as rotor machines.

• The basic principle of the rotor machine consists of a set of


independently rotating cylinders through which electricity
pulses can flow.

• If we associate each input and output pin with a letter of the


alphabet, then a single cylinder defines a mono alphabetic
substitution.

• For EX: if an operator depress the key for the letter A, an electric
signal is applied to the first pin of the first cylinder and flows
through the internal connection to the twenty-fifth output pin.
• Consider a machine with a single cylinder. After
each input key is depressed. The cylinder rotates
one position, so that the internal connections are
shifted accordingly. Thus, a different mono
alphabetic substitution cipher is defined.

• After 26 letter of plaintext, the cylinder would


back to initial position. Thus we have a poly-
alphabetic substitution algorithm with a period of
26.
Rotor Machines
• This diagram shows a three –cylinder system. The left
half of the figure shows a position in which the input
from the operator to the first pin(plain text letter A) is
routed the three cylinders to appear at the output of
the second pin(ciphertext letter B)
• For every complete rotation of the inner cylinder, the
middle cylinder rotates one pin position, Finally every
complete rotation of the middle cylinder, the outer
cylinder rotates one pin position.
• The result is there are 26*26*26=17,576 different
substitute alphabets used before the systems used.
Rotor Machine
Other • Character marking
Steganography • Selected letters of printed or typewritten
text are over-written in pencil
Techniques • The marks are ordinarily not visible unless
the paper is held at an angle to bright light
• Invisible ink
• A number of substances can be used for
writing but leave no visible trace until heat
or some chemical is applied to the paper
• Pin punctures
• Small pin punctures on selected letters are
ordinarily not visible unless the paper is
held up in front of a light
• Typewriter correction ribbon
• Used between lines typed with a black ribbon, the
results of typing with the correction tape are visible only
under a strong light
Steganography

You might also like