0% found this document useful (0 votes)
6 views25 pages

Week#08 Lecture #01,02

Uploaded by

abaidullahbutt46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views25 pages

Week#08 Lecture #01,02

Uploaded by

abaidullahbutt46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Information Security

Week 8(Lecture#01,02)
Cryptography
• Cryptography is the practice and study of techniques for
secure communication in the presence of third parties.

• It's a field that involves various methods for encrypting


and decrypting data to ensure its confidentiality,
integrity, and authenticity.

• It's a way to keep information safe and secure when it's


being sent or stored.
Cryptography Process
Terminology in Cryptography
The important terms in cryptography are:
 Plaintext
original message

 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

There are two types of cryptography.


 Symmetric Key cryptography
 Asymmetric Key Cryptography
 Hash Function
Symmetric key cryptography
• Symmetric key cryptography uses a single key to encrypt
and decrypt data.

• This means that both the sender and the receiver need
to have the same key to communicate securely.

• Symmetric encryption is fast and efficient, and it is often


used for encrypting large amounts of data.

• However, it is important to note that if the key is


compromised, then the attacker will be able to decrypt
all of the data that was encrypted with that key.
Asymmetric Key cryptography
• Asymmetric Key cryptography uses a pair of keys to encrypt and
decrypt data: a public key and a private key.

• The public key can be shared with anyone, but the private key
must be kept secret.

• To encrypt data with asymmetric encryption, the sender uses the


receiver's public key.

• The encrypted data can then only be decrypted with the


receiver’s private key.

• Asymmetric encryption is slower than symmetric encryption, but


it is more secure because the private key is never shared with
anyone.
Hash Functions:

• A mathematical transformation is used to


"encrypt" information in an irreversible manner,
resulting in a digital fingerprint.

• Primarily used to ensure message integrity.


Requirements
 Two requirements for the secure use of symmetric
encryption:
– A strong encryption algorithm
– A secret key is known only to the sender/receiver

 Mathematically, if “p” is plaintext and “c” is ciphertext


– c=Ek(p)
– p=Ek(c)
Cipher methods
• Cipher methods are techniques or algorithms used in
cryptography for encrypting and decrypting messages.

• Each method employs different approaches to achieve


encryption and decryption.

• These methods can be classified into several categories:

– 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.

 The most basic substitution ciphers are:


– Shift Cipher
– ROT-13
– Caesar Cipher
Algorithms-Shift Cipher
 Shift ciphers are easy to understand and implement, but they are
not very secure since there are only 25 possible keys in the case of
the English alphabet (26 letters).

 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

• The key “k” is a number in the range 0-25


• Encryption is adding “k” onto each letter modulo 26
– c=Ek(p)=(p+k) mod 26
– p=Ek(c)=(c+k) mod 26
Example 1:
• Plaintext: "WORLD“
• Key=5
 Encrypting: Applying the Shift cipher with a shift of 5:
– W -> B
– O -> T
– R -> W
– L -> Q
– D -> I
• So, "WORLD" is encrypted with a Shift cipher and a shift of 5 becomes "BTWQI".

 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.

• According to historical accounts, Julius Caesar used a shift


of 3 positions in the alphabet to encrypt his messages.

• This simple substitution cipher allowed him to


communicate securely during military campaigns and
diplomatic missions.

• The Caesar cipher is one of the earliest known encryption


techniques and serves as a fundamental example in the
study of cryptography.
Caesar Cipher:
 Example 1:
 Encryption:
– Plaintext: "HELLO”
– Key=3
– Ciphertext: KHOOR

• So, "HELLO" is encrypted with a Caesar cipher and a shift of 3 becomes


"KHOOR".

 Decrypting:
• To decrypt "KHOOR" back to the original plaintext:
– Plaintext: “KHOOR”
– Key=3
– Ciphertext: HELLO

• So, "KHOOR" is decrypted with a Caesar cipher and a shift of 3 becomes


"HELLO" again.
Caesar Cipher:
 Example 2:
• Plaintext: "GOOD MORNING"
• Key=3
• Ciphertext:?

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.

• Choose the Shift:


In ROT-13, the shift value is always 13. This means 'A' becomes 'N', 'B' becomes 'O',
and so on.

• 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: ?

You might also like