You are on page 1of 24

Cryptography

What is cryptography
• Cryptography is the process of hiding or coding information so that
only the person a message was intended for can read it. The art of
cryptography has been used to code messages for thousands of years
and continues to be used in bank cards, computer passwords, and
ecommerce.

• The word "cryptography" is derived from the Greek kryptos, meaning


hidden. The prefix "crypt-" means "hidden" or "vault," and the suffix
"-graphy" stands for "writing."
Encryption and Decryption
Encryption is the process by which a readable message is converted to
an unreadable form to prevent unauthorized parties from reading it.

Decryption is the process of converting an encrypted message back to


its original (readable) format. The original message is called the
plaintext message.
Plaintext VS Cipher Text
Plaintext would refer to any message, document, file, and the like
intended or having been encrypted. Plain text is a message or data that
has not been turned into a secret.

Cipher Text or Cryptogram: This is the altered form of plaintext


message so as to be unreadable for anyone except the intended
recipients. In other words, it has been turned into a secret.
Ciphertext is also known as encrypted or encoded information because
it contains a form of the original plaintext that is unreadable by a
human or computer without the proper cipher to decrypt it.
Types of Cryptography

• There are two types of Cryptography


• Symmetric
• Asymmetric
Symmetric Cryptography
In this type of encryption, there is only
one key, and all parties involved use the
same key to encrypt and decrypt
information. By using a single key, the
process is straightforward, as per the
following example: you encrypt an email
with a unique key, send that email to
your friend Tom, and he will use the same
symmetric key to unlock/decrypt the email.
Symmetric Cryptography

A symmetric key is one that may be used to encrypt and decode data.
This implies that in order to decrypt information, the same key that was
used to encrypt it must be utilized. In practice, the keys represent a
shared secret shared by two or more people that may be utilized to
maintain a confidential information link.
Stream Cypher

A stream cipher is an encryption


technique that works byte by byte to
transform plain text into code that's
unreadable to anyone without the
proper key. Stream ciphers are linear,
so the same key both encrypts and
decrypts messages. And while cracking
them can be difficult, hackers have
managed to do it.
Block cipher

A block cipher is a method of


encrypting data in blocks to
produce cipher text using a
cryptographic key and algorithm.
The block cipher processes fixed-
size blocks simultaneously, as
opposed to a stream cipher, which
encrypts data one bit at a time.
Asymmetric Cryptography

Asymmetric cryptography, also


known as public-key cryptography,
is a process that uses a pair of
related keys -- one public key and
one private key -- to encrypt and
decrypt a message and protect it
from unauthorized access or use.
Public And Private Key in Asymetric
• A public key is a cryptographic key that can be used by any person to
encrypt a message so that it can only be decrypted by the intended
recipient with their private key. A private key -- also known as a secret
key -- is shared only with key's initiator.
• When someone wants to send an encrypted message, they can pull
the intended recipient's public key from a public directory and use it
to encrypt the message before sending it. The recipient of the
message can then decrypt the message using their related private key
.
Difference Between Symmetric And Asymmetric
DES
DES
• Data Encryption Standard (DES) is a block cipher with a 56-bit key
length that has played a significant role in data security. Data
encryption standard (DES) has been found vulnerable to very
powerful attacks therefore, the popularity of DES has been found
slightly on the decline. DES is a block cipher and encrypts data in
blocks of size of 64 bits each, which means 64 bits of plain text go as
the input to DES, which produces 64 bits of cipher text. The same
algorithm and key are used for encryption and decryption, with minor
differences. The key length is 56 bits.
Structure of DES

The encryption process is made of


two permutations (P-boxes), which
we call initial and fi nal
permutations, and sixteen Feistel
rounds. Each round uses a different
48-bit round key generated from
the cipher key according to a
predefi ned algorithm described
later in the chapter.
Permutation in DES
Each of these permutations takes a 64-bit
input and permutes them according to a
predefined rule. We have shown only a few
input ports and the corresponding output
ports. These permutations are keyless
straight permutations that are the inverse of
each other. For example, in the initial
permutation, the 58th bit in the input
becomes the first bit in the output. Similarly,
in the final permutation, the first bit in the
input becomes the 58th bit in the output. In
other words, if the rounds between these
two permutations do not exist, the 58th bit
entering the initial permutation is the same
as the 58th bit leaving the fi nal permutation.
DES Function (Rounds or Feistal Cipher)
The heart of DES is the DES
function. The DES function
applies a 48-bit key to the
rightmost 32 bits (RI−1) to
produce a 32-bit output. This
function is made up of four
sections: an expansion D-box,
a whitener (that adds key), a
group of S-boxes, and a
straight D-box
Expansion P-Box in DES
S- Box in DES

The 48-bit data from the second operation


is divided into eight 6-bit chunks, and each
chunk is fed into a box. The result of each
box is a 4-bit chunk; when these are
combined the result is a 32-bit text. The
substitution in each box follows a pre-
determined rule based on a 4-row by 16-
column table. The combination of bits 1
and 6 of the input defi nes one of four
rows; the combination of bits 2 through 5
defi nes one of the sixteen columns
S-box
The input to S-box 1 is 100011. What is
the output?
Solution:
If we write the first and the sixth bits
together, we get 11 in binary, which is
3 in decimal. The remaining bits are
0001 in binary, which is 1 in decimal.
We look for the value in row 3,
column 1, in Table 6.3 (S-box 1). The
result is 12 in decimal, which in
binary is 1100. So the input 100011
yields the output 1100.

You might also like