Week#08 Lecture #01,02
Week#08 Lecture #01,02
Week 8(Lecture#01,02)
Cryptography
• Cryptography is the practice and study of techniques for
secure communication in the presence of third parties.
Ciphertext
encrypted or encoded message
Encryption
convert from plaintext to ciphertext (encipher)
Decryption
restore the plaintext from ciphertext (decipher)
Key
information used in cipher known only to the sender/receiver
Cipher
a particular algorithm for transforming plaintext into ciphertext
Types of Cryptography
• This means that both the sender and the receiver need
to have the same key to communicate securely.
• The public key can be shared with anyone, but the private key
must be kept secret.
– Substitution Cipher
– Transposition Cipher
– Exclusive OR.
– Vernam Cipher
– Book or Running Key Cipher
– Hash Functions
Substitution Cipher
Substitution ciphers are a type of cipher where each
letter in the plaintext is replaced with another letter
based on a fixed system.
Process:
• Prepare the Message: Write down the message you want to
encrypt.
• Choose a Shift or key: Decide how many positions to move each
letter in the alphabet.
• Encrypt: Shift each letter in the message according to the chosen
shift value.
• Finish: You've got your encrypted message (ciphertext).
• Decrypt (Optional): Reverse the shift to reveal the original message
(plaintext).
Algorithms-Shift Cipher
• Each letter we identify with a number
• A=0
• B=1
• C=2
• …
• Z=25
Decrypting:
• To decrypt "BTWQI" back to the original plaintext:
– B -> W
– T -> O
– W -> R
– Q -> L
– I -> D
• So, "BTWQI" decrypted with a Shift cipher and a shift of 5 becomes "WORLD" again.
Example
Example 2:
– Plaintext: "HELLO“
– Key=6
– Ciphertext: ?
• Example 3:
– Plaintext: KHAN
– Key= 19
– Ciphertext: ?
Caesar Cipher
• The Caesar cipher, named after Julius Caesar, is believed
to have been used by him for confidential communication
with his generals.
Decrypting:
• To decrypt "KHOOR" back to the original plaintext:
– Plaintext: “KHOOR”
– Key=3
– Ciphertext: HELLO
Encryption: ?
Decryption: ?
Caesar Cipher
Example 3:
• Plaintext: "CRYPTOGRAPHY“
• Key=3
• Ciphertext: ?
Encryption: ?
Decryption: ?
ROT-13
Process:
• Prepare the Message:
Write down the message you want to encrypt.
• Encrypt:
Go through each letter in the message and shift it 13 positions down the alphabet. If
you reach the end of the alphabet, wrap around to the beginning.
• Finish:
Once you've shifted every letter in the message, you have your encrypted message
(ciphertext).
• Decrypt:
ROT-13
Example 1:
Plaintext: HELLO
Key: 13
Ciphertext: URYYB
Encryption: ?
Decryption: ?
ROT-13
Example2:
Plaintext: DUCK
Key: 13
Ciphertext:
Encryption: ?
Decryption: ?
ROT-13
Example 3:
Plaintext: "ROT-13 is fun"
Key: 13
Ciphertext:?
Encryption: ?
Decryption: ?