Cipher Methods: A02:-Nikhil Chhabria A10: - Kabir Kanjani A11: - Yash Khatri A12: - Shubham Koshti A49: - Siraj Shaikh

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Cipher Methods

A02 :- Nikhil Chhabria


A10 :- Kabir Kanjani
A11 :- Yash Khatri
A12 :- Shubham Koshti
A49 :- Siraj Shaikh
What is Cipher ?

● Cipher is a method to implement encryption and decryption of messages


travelling in a network. It’s used to increase the confidentiality of the
messages.
● Cipher also refers to the encrypted text, cryptography system or encryption
key for the original text.
● Encrypted text is also known as ciphertext. Plaintext is the original,
unencrypted text.
● Ciphertext is not understandable until it has been converted into plain text
using a key.
● A cipher algorithm works in combination with a key a word, number, or phrase
to encrypt the plaintext.
● Earlier cipher algorithms were performed manually and were entirely
different from modern algorithms which are generally executed by a machine.
Cipher Methods
● There are two methods of encrypting plaintext first bit stream method
and second block cipher method
● In the bit stream method, each bit in the plaintext is transformed into a
cipher bit one bit at a time.
● In the block cipher method, the message is divided into blocks .
● for example, sets of 8-, 16-, 32-, or 64-bit blocks, and then each block of
plaintext bits is transformed into an encrypted block of cipher bits using
an algorithm and a key.
● Bit stream methods commonly use algorithm functions like the exclusive
OR operation (XOR),whereas block methods can use substitution,
transposition, XOR, or some combination of these operations, as
described in the following sections.
Substitution Cipher

● A substitution cipher is a type of encryption where characters or units of text


are replaced by others in order to encrypt a text sequence.
● To use a substitution cipher, you substitute one value for another, for example
a letter in the alphabet with the letter three values to the right.
● Or you can substitute one bit for another bit that is four places to its left. A
three-character substitution to the right results in the following
transformation of the standard English alphabet:

Initial alphabet yields : ABCDEFGHIJKLMNOPQRSTUVWXYZ

Encryption alphabet : DEFGHIJKLMNOPQRSTUVWXYZABC

● Within this substitution scheme, the plaintext MOM would be encrypted into
the ciphertext PRP.
Substitution Cipher

● This is a simple enough method by itself but very powerful if combined with other
operations.
● This type of substitution is based on a monoalphabetic substitution, because it only uses
one alphabet.
● More advanced substitution ciphers use two or more alphabets, and are referred to as
polyalphabetic substitutions .
● Example

Plaintext : ABCDEFGHIJKLMNOPQRSTUVWXYZ

Substitution cipher 1 : DEFGHIJKLMNOPQRSTUVWXYZABC

Substitution cipher 2 : GHIJKLMNOPQRSTUVWXYZABCDEF

Substitution cipher 3 : JKLMNOPQRSTUVWXYZABCDEFGHI

Substitution cipher 4 : MNOPQRSTUVWXYZABCDEFGHIJKL


Substitution Cipher

● The first row here is the plaintext, and the next four rows are four sets of
substitution ciphers,which taken together constitute a single
polyalphabetic substitution cipher .
● To encode the word TEXT with this cipher, you substitute a letter from
the second row for the first letter in TEXT.
● a letter from the third row for the second letter, and so on—a process
that yields the ciphertext WKG.
● Complexities like these make this type encryption substantially more
difficult to decipher when one doesn’t have the algorithm and the key
and unknown about which is the method used for encryption.
Substitution Cipher

● An advanced type of substitution cipher that uses a simple polyalphabetic


code is the Vigenère cipher.
● The cipher is implemented using the Vigenère square (or table), which is made
up of twenty-six distinct cipher alphabets.
● In the header row, the alphabet is written in its normal order.
● n each subsequent row, the alphabet is shifted one letter to the right until a
26*26 block of letters is formed.
● You could perform an encryption by simply starting in the first row and
finding a substitute for the first letter of plaintext, and then moving down the
rows for each subsequent letter of plaintext.
● With this method, the word SECURITY in plain text becomes TGFYWOAG in
ciphertext.
Vigenère square
Substitution Cipher

● A much more sophisticated way to use the Vigenère square is to use a keyword to
represent the shift. To accomplish this, you begin by writing a keyword above the
plaintext message.
● For example, suppose the plaintext message was ‘’SACK GAUL SPARE NO ONE” and the
keyword was ITALY. We thus end up with the following:

ITALYITALYITALYITA

SACKGAULSPARENOONE

● To perform the substitution, start with the first combination of keyword and message
letters IS. Use the keyword letter to locate the column, and the message letter to find the
row, and then look for the letter at their intersection.
● Thus, for column “I” and row “S” you will find the ciphertext letter “A”
● So encrypted ciphertext will be ATCVEINLDNIKEYMWGE .
Transposition Cipher

● Like the substitution operation, the transposition cipher is simple to understand, but it
can, if properly used, produce ciphertext that is difficult to decipher.
● In contrast to the substitution cipher, however, the transposition cipher or permutation
cipher simply rearranges the values within a block to create the ciphertext.
● This can be done at the bit level or at thebyte (character) level .
● Example

Key pattern :1->4, 2->8, 3->1, 4->5, 5->7, 6->2, 7->6, 8->3
Transposition Cipher

● The rail fence cipher is an easy to apply transposition cipher that jumbles up the order of the
letters of a message in a quick convenient way. It also has the security of a key to make it a
little bit harder to break.
● The Rail Fence cipher works by writing your message on alternate lines across the page, and
then reading off each line in turn. For example, the plaintext "defend the east wall" is written as
shown below, with all spaces removed.
● Depth / Rail Key : 2

The simplest Rail Fence Cipher, where each letter is written in a zigzag pattern across the page.

● The ciphertext is then read off by writing the top row first, followed by the bottom row, to get
"DFNTEATALEEDHESWL".
Transposition Cipher
● In addition to being credited with inventing a substitution cipher, Julius Caesar was
associated with an early version of the transposition cipher. Which is called columner
Transposition Cipher
● In the Caesar block cipher, the recipient of the coded message knows to fit the text to a
prime number square
● For example, if you are the recipient of the Caesar cipher write the letters of the message
into the square, filling the slots from left to right, top to bottom.
● Then you read the message from the opposite direction—that is, from top to bottom, left
to right.

● Reading from top to bottom, left to right reveals the ciphertext


“ALNISESTITPIMROOPASN”
Exclusive OR

● The exclusive OR operation (XOR)is a function of Boolean algebra in which two bits are
compared, and if the two bits are identical, the result is a binary 0.
● If the two bits are not the same, the result is a binary 1.
● XOR encryption is a very simple symmetric cipher that is used in many applications where
security is not a defined requirement
Exclusive OR

Example

● plaintext is the word “CAT”.


● Binary Representation of plaintext is “01000011 01000001 01010100”.
● In order to encrypt the plaintext, a key value should be selected.
● In this case, the bit pattern forthe letter“V”(01010110) is used, and is repeated for each
character to be encrypted , written left to right.
Exclusive OR

● The above Table “Cipher” contains the bit stream that will be transmitted
when this cipher is received, it can be decrypted using the key value“V.”
● XOR encryption method is very simple to implement and equally simple to
break.
● The XOR encryption method should not be used by itself when an
organization is transmitting or storing sensitive data.
Vernam Cipher

● It is developed by AT & T and known as one-time pad.


● It uses set of characters only one time for each encryption process.
● To perform the Vernam cipher encryption operation, the pad values are added
to numeric values that represent the plaintext that needs to be encrypted.
● Each character of the plaintext is turned into a number and a pad value for
that position is added to it.
● The resulting sum for that character is then converted back to a ciphertext
letter for transmission .
● If the sum of the two values exceeds 26, then 26 is subtracted from the total.
Vernam Cipher

Example

Plaintext :- “ SACK GAUL SPARE NO ONE ”


Book or Running Key Cipher

● One encryption method made popular by spy movies involves using the text
in a book as the key to decrypt a message.
● The ciphertext consists of a list of codes representing the page number, line
number, and word number of the plaintext word.
● The algorithm is the mechanical process of looking up the references from the
ciphertext and converting each reference to a word by using the ciphertext
value and the key.
● Example : from a copy of a particular popular novel, one may send the
message: 259,19,8; 22,3,8;375,7,4; 394,17,2.
● The recipient of a running key cipher must first know which book is used in
this case, suppose it is the science fiction novelAFireUpontheDeep, the 1992
TOR edition.
Book or Running Key Cipher

● To decrypt the ciphertext, the receiver acquires the book and turns to
page 259, finds line 19, and selects the eighth word in that line (which
is“sack”).
● Then the receiver turns to page 22, line 3, and selects the eighth word
again, and so forth.
● In this example, the resulting message is“SACK ISLAND SHARP PATH” .
● If dictionaries are used, the message consists of only the page number
and the number of the word on the page.
Hash Function

● Hash functions are extremely useful and appear in almost all information
security applications.
● Hash functions are mathematical algorithms that generate a message
summary or digest to confirm the identity of a specific message and to
confirm that there have not been any changes to the content.
● While they do not create a ciphertext, hash functions confirm message
identity and integrity, both of which are critical functions in e-commerce.
● Hash algorithms are public functions that create a hash value, also
known as a message digest .
● The message digest is a fingerprint of the author’s message that is
compared with the recipient’s locally calculated hash of the same
message .
Hash Function

● If both hashes are identical after transmission, the message has arrived without
modification.
● Hash functions are considered one-way operations in that the same message always
provides the same hash value .

Message authentication code (MAC)

● It is a key dependent
● hash functions are one-way, they are used in password verification systems to confirm
the identity of the user.
● In such system hash value is calculated based on originally issued password and this
message digest is stored for later comparison .
● When the user logs on for the next session, the system calculates a hash value based on
the user’s password input, and this value is compared against the stored value to confirm
identity
Hash Function

Secure Hash Standard

● It is a standard issued by the National Institute of Standards and


Technology (NIST).
● Standard document FIPS 180-1 specifies SHA-1 (Secure Hash Algorithm
1) as a secure algorithm for computing a condensed representation of a
message or data file.
● SHA-1 produces a 160-bit message digest, which can be used as an input
to a digital signature algorithm.
● SHA-1 is based on principles modeled after MD4 (which is part of
theMDx family of hash algorithms created by Ronald Rivest).
Hash Function

● A recent attack method called rainbow cracking has generated concern about
the strength of the processes used for password hashing .
● In general, if attackers gain access to a file of hashed passwords, they can use
a combination of brute force and dictionary attacks to reveal user passwords.
● Passwords that are poorly constructed can be easily cracked.
● Well-constructed passwords take a long time to crack even using the fastest
computers .
● by using a rainbow table a database of precomputed hashes from sequentially
calculated passwords
● the rainbow cracker simply looks up the hashed password and reads out the
text version, no brute force required.
● This type of attack is more properly classified as atime–memory tradeoff
attack.
Hash Function

● You can also use an approach called password hash salting.


● Salting is the process of providing a non-secret,random piece of data to
the hashing function when the hash is first calculated.
● The use of the salt value creates a different hash and when a large set of
salt values are used, rainbow cracking fails since the time-memory
tradeoff is no longer in the attacker’s favor.
● The salt value is not kept a secret: it is stored along with the account
identifier so that the hash value can be recreated during authentication.
Thank You

You might also like