Week 1
Week 1
Week 1
Data Integrity: Verifying that data has not been altered or tampered with during storage or
transmission.
Digital Signatures: Providing a way to verify the authenticity and integrity of a digital
message or document.
The Caesar Cipher, also known as the shift cipher, is one of the simplest and oldest
encryption techniques. It is a type of substitution cipher where each letter in the plaintext is
shifted a certain number of places down or up the alphabet. This method is named after
Julius Caesar, who is reputed to have used it to communicate with his generals.
The Caesar Cipher operates based on a simple mathematical expression that involves
shifting each letter in the plaintext by a fixed number of positions in the alphabet. Let's
denote:
C ≡ (P + k) mod 26
In this expression, mod26 is used to ensure that the result wraps around the alphabet. For
example, if the shift is 3 and the letter is Y (25 in the alphabet), the calculation would be:
C ≡ (25 + 3) mod 26 ≡ 2
This expresses that you shift back by the same amount. For example, if the ciphertext is B
and the shift is 3:
P ≡ (2 − 3) mod 26 ≡ 25
So, B in ciphertext would be decrypted to Y in plaintext.
/////////\
A transposition cipher is a type of encryption where the positions of the characters in the
plaintext are rearranged according to a certain system or key. Unlike substitution ciphers,
which replace characters with other characters, transposition ciphers shuffle the order of
characters without changing their identity.
One common type of transposition cipher is the columnar transposition cipher. Here's a brief
explanation along with a mathematical expression:
2. Mathematical Expression:
Let P be the plaintext, C be the ciphertext, K be the key, and n be the
number of columns. If P is written in rows of n columns, the encryption
can be expressed as:
Cij = Pkj
Here, i represents the row number, j represents the column number, and k is the key. The
ciphertext is obtained by reading the columns in the order specified by the key.
Decryption:
Pki = Cij
Here, i represents the row number, j represents the column number, and k is the key. The
original plaintext is obtained by reading the columns in the order specified by the key.
Columnar transposition ciphers provide a way to obfuscate the order of characters in a
message. However, they are vulnerable to attacks, and their security is relatively low
compared to modern encryption methods.
Affine Cipher
The Affine Cipher is a type of monoalphabetic substitution cipher, where each letter in the
plaintext is mapped to its numeric equivalent, encrypted using a simple mathematical
function, and then converted back to a letter in the ciphertext.
The affine cipher requires two keys: a and b.
a must be chosen such that it is co prime with the size of the alphabet
b is an integer that represents the shift.
Encryption function e(x,k)=(a*x+b) mod 26
Decryption function d(c,k)=((c.b) a−1) mod 26
Encryption: Given the key table, the digraphs are substituted based on the rules.
Example: Encrypting "HELLO"
H -> (H, E) -> EY
E -> (E, L) -> OL
L -> (L, L) -> LT
L -> (L, O) -> OL
O -> (O, H) -> HO
The encrypted message is "EYOLLOLTHO."