Cryptography Notes
Cryptography Notes
1 SUBSTITUTION TECHNIQUES
A 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 cipher text bit
patterns.
(i)Caesar cipher (or) shift cipher
The earliest known use of a substitution cipher and the simplest was by Julius
Caesar. The Caesar cipher involves replacing each letter of the alphabet with the
letter standing 3 places further down the alphabet.
e.g., Plain text : pay more mone Cipher text: SDB PRUH PRQHB
Note that the alphabet is wrapped around, so that letter following „z‟ is „a‟. For
each plaintext letter p, substitute the cipher text letter c such that C =
E(p) = (p+3) mod 26
A shift may be any amount, so that general Caesar algorithm is C = E (p) = (p+k)
mod 26
Where k takes on a value in the range 1 to 25. The decryption algorithm is simply
P = D(C) = (C-k) mod 26
(ii)Playfair cipher
The best known multiple letter encryption cipher is the playfair, which treats
digrams in the plaintext as single units and translates these units into cipher
text digrams. The playfair algorithm is based on the use of 5x5 matrix of
letters constructed using a keyword. Let the keyword be „monarchy‟. The
matrix is constructed by filling in the letters of the keyword (minus
duplicates) from left to right and from top to bottom, and then filling in the
remainder of the matrix with the remaining letters in alphabetical order.
The letter „i‟ and „j‟ count as one letter. Plaintext is encrypted two letters at a time
according to the following rules:
1. Repeating plaintext letters that would fall in the same pair are separated with
a filler letter such as „x‟.
2. Plaintext letters that fall in the same row of the matrix are each replaced by
the letter to the right, with the first element of the row following the last.
3. Plaintext letters that fall in the same column are replaced by the letter
beneath, with the top element of the column following the last.
4. Otherwise, each plaintext letter is replaced by the letter that lies in its own
row and the column occupied by the other plaintext letter.
2. Since there are 26 letters, 26x26 = 676 diagrams are possible, so identification
of individual digram is more difficult.
(iii)Polyalphabetic ciphers
Another way to improve on the simple monoalphabetic technique is to use
different monoalphabetic substitutions as one proceeds through the plaintext
message. The general name for this approach is polyalphabetic cipher. All
the techniques have the following features in common.
(iv)Vigenere cipher
In this scheme, the set of related monoalphabetic substitution rules
consisting of 26 caesar ciphers with shifts of 0 through 25. Each cipher is
denoted by a key letter. e.g.,
Caesar cipher with a shift of 3 is denoted by the key value 'd‟ (since a=0, b=1, c=2
and so on). To aid in understanding the scheme, a matrix known as vigenere
tableau is constructed.
Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher
to its left. A normal alphabet for the plaintext runs across the top. The process of
encryption is simple: Given a key letter X and a plaintext letter y, the cipher text is
at the intersection of the row labeled x and the column labeled y; in this case, the
ciphertext is V.
To encrypt a message, a key is needed that is as long as the message. Usually, the
key is a repeating keyword.
Once a key is used, it is discarded and never used again. The system can be
expressed as follows:
Thus the cipher text is generated by performing the bitwise XOR of the plaintext
and the key. Decryption uses the same key. Because of the properties of XOR,
decryption simply involves the same bitwise operation:
Advantage:
Disadvantages
2 TRANSPOSITION TECHNIQUES
All the techniques examined so far involve the substitution of a cipher text
symbol for a plaintext symbol. A very different kind of mapping is achieved
by performing some sort of permutation on the plaintext letters. This
technique is referred to as a transposition cipher.
Rail fence is simplest of such cipher, in which the plaintext is written down as a
sequence of diagonals and then read off as a sequence of rows.
Plaintext = meet at the school house
To encipher this message with a rail fence of depth 2, we write the message as
follows:
m e a t e c o l o s
e t t h s H o h ue
The encrypted message is
MEATECOLOSETTHSHOHUE
Row Transposition Ciphers-A more complex scheme is to 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 columns then becomes the key of the
algorithm.
CT = ESOTCUEEHMHLAHSTOETO
A pure transposition cipher is easily recognized because it has the same letter
frequencies as the original plaintext. The transposition cipher can be made
significantly more secure by performing more than one stage of transposition. The
result is more complex permutation that is not easily reconstructed.
What Is Steganography?
Steganography is a means of concealing secret information within (or even on top of) an
otherwise mundane, non-secret document or other media to avoid detection. It comes from the
Greek words steganos, which means “covered” or “hidden,” and graph, which means “to write.”
Hence, “hidden writing.”
You can use steganography to hide text, video, images, or even audio data. It’s a helpful bit of
knowledge, limited only by the type of medium and the author’s imagination.
Since the computer description of an image contains multiple bits, images are
frequently used as a cover source in digital steganography.
The various terms used to describe image steganography include:
Message - Real data that you can mask within pictures. The message may be in
the form of standard text or an image.
Once hidden information is decoded, You can recover the original message from the
Failure the data can be used by anyone ciphertext if you can access the decryption key
In this article, we will discuss the characteristics of block ciphers and stream
ciphers and how they differ from one another.
With the help of the shared secret key, a block cipher encrypts and decrypts its
input one block rather than one bit at a time. Since the block's size is fixed,
padding is not necessary. It is a symmetric algorithm. During encryption, it
converts text input into cyphertext using the shared key. It uses the same key
during decryption to change the cyphertext back to the original plaintext. The
length of the output and input are identical.
It is a popular block cipher which encrypts data in blocks of 128 bits using 128,
192, and 256-bit symmetric keys. The underlying block cipher uses
substitution-permutation and transportation techniques to produce ciphertext
by shuffling and replacing input data in a sequence of linked
calculations. AES is a widely encryption standard since cryptanalysis efforts
against its algorithms have been ineffective.
3. Twofish
Block ciphers are also used by other encryption schemes such as 3DES,
Serpent, and Blowfish.
Since a mistake in the translation of one bit often does not affect the entire
plaintext block, stream cipher encryption algorithms are less likely to cause
system-wide errors to spread. Additionally, stream encryption is linear and
continuous, making it easier and quicker to deploy. However, stream ciphers
do not have diffusion because each digit of the plaintext is mapped to one
ciphertext output. Furthermore, they don't check for validity, which leaves
them open to insertions. If hackers defeat the encryption algorithm, they are
able to add to or change the encrypted message without being noticed.
Stream ciphers are typically used to encrypt data in an application where the
volume of plain text cannot be predicted and in low latency use-cases.
In other words, a stream cipher is a type of encryption that uses plain text
numbers and a stream of pseudorandom cipher digits. Each binary digit
receives one bit at a time of this pseudorandom encryption digit stream. This
encryption technique uses an infinite number of pseudorandom cipher digits
for each key.
State cipher is another name for a stream cipher. The term "state cipher" refers
to a system where the encryption of each number is dependent on the
cipher's current state.
The previous ciphertext block's fixed size (N-bits) and symmetric key are used
to generate the keystream block via a self-synchronizing stream cipher, also
known as ciphertext autokey. Asynchronous stream cipher can recognize
active attacks by altering the ciphertext, which changes the information in the
subsequent keystream. Due to the fact that a single-digit error can only affect
a maximum of N bits, these ciphers also have restricted error propagation.
Example of Stream Ciphers
The following are examples of stream ciphers:
2. Salsa20
An additive binary stream cipher called SEAL is designed for systems with 32-
bit CPUs and enough RAM. The encryption standard depends on a
pseudorandom family that maps a 32-bit string to any length string using a
length-increasing function and a 160-bit key.
PANAMA, Scream, Rabbit, HC-256, and Grain are a few other examples of
stream ciphers.
Implementatio Feistel Cipher is the most popular Vernam Cipher is the main
n block cipher implementation. implementation of Stream
Cipher.
Implementatio Feistel Cipher is the most popular Vernam Cipher is the main
n block cipher implementation. implementation of Stream
Cipher.
Confusion and Block Cipher uses both confusion Stream cipher relies on
Diffusion and diffusion. confusion only.
o Stream ciphers are faster than block ciphers and work well for both
small and large chunks of data.
o Unlike block ciphers, which need a significant amount of memory
because they operate on large chinks of data, stream ciphers only
operate on bits at a time.
o Stream cipher bytes are encrypted separately from other data chunks,
whereas block cipher encrypts an entire block at once.
o In general, Stream ciphers operate best in situations where the amount
of data is either continuous or unknown, such as network streams,
whereas block cipher function better when the amount of duration of
the data is known, such as in files, data fields, or response protocols.