Cryptography
By
Noor Ahmad
Assistant Professor
Definition
•Cryptography is associated with the process of converting
ordinary plain text into unintelligible text and vice-versa.
•It is a method of storing and transmitting data in a particular
form so that only those for whom it is intended can read and
process it.
• Cryptography not only protects data from theft or alteration,
but can also be used for user authentication.
Figure 1 Cryptography components
Figure 2 Categories of cryptography
Figure 3 Symmetric-key cryptography
Note
In symmetric-key cryptography, the
same key is used by the sender
(for encryption)
and the receiver (for decryption).
The key is shared.
Figure 4 Asymmetric-key cryptography
Figure 5 Keys used in cryptography
Figure 6 Comparison between two categories of cryptography
SYMMETRIC-
SYMMETRIC-KEY CRYPTOGRAPHY
Symmetric-key cryptography started thousands of years
Symmetric-
ago when people needed to exchange secrets (for
example, in a war)
war).. We still mainly use symmetric
symmetric--key
cryptography in our network security
security..
Figure 7 Traditional ciphers
Note
A substitution cipher replaces one
symbol with another.
Example 1
The following shows a plaintext and its corresponding
ciphertext. Is the cipher monoalphabetic?
Solution
The cipher is probably monoalphabetic because both
occurrences of L’s are encrypted as O’s.
Example 2
The following shows a plaintext and its corresponding
ciphertext. Is the cipher monoalphabetic?
Solution
The cipher is not monoalphabetic because each
occurrence of L is encrypted by a different character.
The first L is encrypted as N; the second as Z.
Note
The shift cipher is sometimes referred to
as the Caesar cipher.
Example 3
Use the shift cipher with key = 15 to encrypt the message
“HELLO.”
Solution
We encrypt one character at a time. Each
character is shifted 15 characters down. Letter H
is encrypted to W. Letter E is encrypted to T. The
first L is encrypted to A. The second L is also
encrypted to A. And O is encrypted to D. The
cipher text is WTAAD.
Example 4
Use the shift cipher with key = 15 to decrypt the message
“WTAAD.”
Solution
We decrypt one character at a time. Each character is
shifted 15 characters up. Letter W is decrypted to H.
Letter T is decrypted to E. The first A is decrypted to L.
The second A is decrypted to L. And, finally, D is
decrypted to O. The plaintext is HELLO.
Note
A transposition cipher reorders
(permutes) symbols in a block of
symbols.
Figure 8 Transposition cipher
Figure 9 XOR cipher
Figure 10 Rotation cipher
Figure 13 DES (Data Encryption Standard)
Figure 14 One round in DES ciphers
Figure 15 DES function
Figure 16 Triple DES
Table 1 AES (Advanced Encryption Standard) configuration
Note
AES (Advanced Encryption Standard)
has three different configurations with
respect to the number of rounds and key
size.
Figure 17 AES
ASYMMETRIC-
ASYMMETRIC-KEY CRYPTOGRAPHY
An asymmetric
asymmetric--key (or public
public--key) cipher uses two
keys:: one private and one public
keys public.. We will discuss two
algorithms:: RSA and Diffie
algorithms Diffie--Hellman
Hellman..
Figure 24 RSA
Note
In RSA, e and n are announced to the
public; d and F are kept secret.
Example 7
Bob chooses 7 and 11 as p and q and calculates
n = 7 · 11 = 77. The value of F = (7 − 1) (11 − 1) or 60.
Now he chooses two keys, e and d. If he chooses e to be
13, then d is 37. Now imagine Alice sends the plaintext 5
to Bob. She uses the public key 13 to encrypt 5.
Example 7 (continued)
Bob receives the ciphertext 26 and uses the private key 37
to decipher the ciphertext:
The plaintext 5 sent by Alice is received as plaintext 5 by
Bob.
Note
The symmetric (shared) key in the
Diffie-Hellman protocol is
K = gxy mod p.