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

Week#09 Lecture#01,02

Uploaded by

rukhmanoor715
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 views24 pages

Week#09 Lecture#01,02

Uploaded by

rukhmanoor715
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/ 24

Week#09

Lecture#01,02
Transposition Cipher

• Transposition ciphers involve rearranging the


order of the letters in the plaintext to create the
ciphertext.

• This is done according to a predetermined


system or key.

• Examples of transposition ciphers include:


– Rail-fence cipher
– Columnar transposition
Rail-fence cipher
• The Rail Fence cipher, also known as the Zigzag cipher, is
a transposition cipher that rearranges the plaintext
letters by writing them in a zigzag pattern across a
certain number of "rails".

• The ciphertext is then obtained by reading off the letters


in a linear fashion.
Example 1:
• Plaintext: "HELLO WORLD“
• k=3
 Encryption:
H O L
E L W R D
L O

• Reading off the letters row by row, the ciphertext is


"HOLELWRDLO".
 Decryption:

HH O O R L

EE L L W O R L D

LL W O D

• Reading off the plaintext row by row, the original message is "HELLO
WORLD".
Columnar transposition
• Problems with the rail fence cipher:
• The first and last letters of the plaintext do not move
• The key is a number that divides the total message
length

• In a single columnar transposition cipher, the key is a


word or phrase whose letters, in alphabetic order,
indicate the order of the columns as they are read
Example 3:
• Plaintext: TRANSPOSITIONCIPHER
• Key is “SECRET”, so re-write as rows of 6-letter blocks:
• SECRET C EERST
• 521436 123456
• TRANSP ARSNTP
• OSI T IO I SI TOO
• NC I P H E I C HPNE
• R R
• Ciphertext: ?
Vigenere cipher
• The Vigènere cipher is a polyalphabetic substitution cipher
• A secret word or phrase, representing the key, is agreed by the
sender and receiver

• Each letter of the key is used to encrypt a plaintext letter ;


each key letter represents the “shift” amount (i.e., A=0, B=1, …,
Z=25).

• After the final key letter is used to encrypt a plaintext letter,


the first key letter is used (again) to encrypt the next plaintext
letter, and the cipher continues like this; this type of cipher is
called a repeated key.

• It uses a Vigenere table or Vigenere square for encryption and


decryption of the text.
Example 1:
Exclusive OR (XOR):
• In cryptography, XOR (exclusive OR) is often used as a
basic operation for combining plaintext and a key to
generate ciphertext.

• XOR compares two input bits and generates one output


bit.
• The symbol ⊕ is used for exclusive OR operation.

• The logic is simple.


– If the bits are the same, the result is 0.
– If the bits are different, the result is 1.
Exclusive OR
Example 2:

• Plaintext: 1100 1010


• Key: 1010 1100

– (Encryption: ⊕=𝐶 )

• Ciphertext: 0110 0110

– (Decryption: 𝐶⊕ 𝐾=𝑃)

• Decrypted Text: 1100 1010


Example 3:

• Plaintext: 1011 0011


• Key: 1101 0101

– (Encryption: ⊕=𝐶 )

• Ciphertext: 0110 0110

– (Decryption: 𝐶⊕ 𝐾=𝑃)

• Decrypted Text: 1011 0011


Vernam Cipher:
• The Vernam cipher, also known as the one-time pad, is a
type of symmetric encryption where each character in
the plaintext is combined with a character from a secret
key using the XOR operation.

• Plain Text: HELLO BOB


• Key: USIFJ EVK
Encryption: Decryption:
Book or Running Key Cipher:
• In a book cipher or running key cipher, where a very long
key, typically taken from a book, poem, or other text, is
used for encryption and decryption

• The key is as long as or longer than the plaintext, making


it more secure.

• Each letter in the plaintext is replaced by a corresponding


letter from the key text.
Book or Running Key Cipher:
• Example
• Step 1: Define the Plaintext and Key Source
• Plaintext: "HELLO"
• Key: "THE QUICK BROWN FOX JUMPS OVER THE LAZY
DOG"
• For this example, let's assume the key starts from the
beginning of the book text.

• Step 2: Extract the Key


• Extract a key from the book that matches the length of
the plaintext.
• Key (from book): "THEQU"
Book or Running Key Cipher:
• Step 3: Encrypt the Plaintext
• To encrypt, shift each letter of the plaintext by the
corresponding letter in the key. The shift is determined
by the position of the letter in the alphabet (A=0, B=1, ...,
Z=25).

– H (7) + T (19) = A (26 % 26 = 0)


– E (4) + H (7) = L (11)
– L (11) + E (4) = P (15)
– L (11) + Q (16) = B (27 % 26 = 1)
– O (14) + U (20) = I (34 % 26 = 8)
– So, the ciphertext is "ALPBI".
Book or Running Key Cipher:
• Step 4: Decrypt the Ciphertext
• To decrypt, reverse the process by shifting each letter of
the ciphertext back by the corresponding letter in the
key.
• A (0) - T (19) = H (-19 % 26 = 7)
• L (11) - H (7) = E (4)
• P (15) - E (4) = L (11)
• B (1) - Q (16) = L (1 - 16 = -15 % 26 = 11)
• I (8) - U (20) = O (8 - 20 = -12 % 26 = 14)
• So, the decrypted text is "HELLO".
Book or Running Key Cipher:
• Summary
• Plaintext: HELLO
• Key (from book): THEQU
• Ciphertext: ALPBI

• In a real-world application, the key would be a long,


continuous string of text taken from a book, ensuring
that it is at least as long as the plaintext. The Book or
Running Key Cipher provides enhanced security by using
a long, non-repeating key, making it much harder to
break compared to simpler ciphers.
Hash Functions:
• Hash functions are mathematical algorithms that take an
input (or "message") and produce a fixed-size string of
bytes, typically a hexadecimal number.

• They are commonly used in cryptography for various


purposes, including data integrity verification, digital
signatures, and password hashing.

• Hash functions are designed to be fast to compute and


irreversible, meaning it's computationally infeasible to
reverse the process and recover the original input from
the hash value.

You might also like