Uploaded by aditi jain

Classical Cryptosystem -2

advertisement
Learning Goals
1. Introduce the fundamental ideas behind cryptographic systems
2. Explain and use the shift and affine cipher and how to analyze them
3. Explain and use the Vigenere cipher, the one time pad and permutation ciphers
4. Explain and use hill ciphers
5. Set up methodologies for attacking these systems
Summary
A shift cipher, such as the Caesar cipher, is a simple form of encryption where each letter in
the plaintext is shifted a fixed number of places down the alphabet. In the Caesar cipher, this
shift is commonly 3 places to the right. The basic principles of a shift cipher are as follows:
1. Alphabet Mapping:
○ Letters of the English alphabet are assigned numbers from 0 to 25:
2. Arithmetic Modulo 26:
○ The arithmetic used in this cipher is modulo 26, allowing the wraparound effect,
so the alphabet cycles continuously.
○ This means x→x+3 in Caesar cipher shifts, and if the result is greater than 25, it
wraps around using modulo operation.
3. Encryption and Decryption:
○ Encryption Formula:
c=E(p)=(p+3)mod 26
■ Here, c is the ciphertext, and p is the plaintext.
○ Decryption Formula:
p=D(c)=(c−3)mod 26
○ This reverses the encryption, transforming ciphertext back to plaintext.
4. Properties of the Shift Cipher:
○ Mono-Alphabetic Cipher: Each letter in the plaintext maps to one unique letter
in the ciphertext.
○ Vulnerability to Frequency Analysis:
■ The shift cipher is susceptible to frequency analysis attacks because it
maintains the frequency of letters.
■ By analyzing letter frequencies in the ciphertext, one can deduce which
letters have been shifted, potentially revealing the key.
5. Frequency Analysis:
○ In English, letters like 'E', 'T', 'R', 'N', and 'I' are most common, while 'Z', 'J', 'K',
'Q', 'X' are rare.
○ Analyzing patterns such as common single letters or groups like "th" and "the"
can reveal the encryption key.
6. Applications:
○ While the shift cipher is historically significant, its simplicity makes it weak for
modern cryptography.
○ It is primarily used for educational purposes or as a component of more complex
encryption methods.
Understanding the Affine Cipher
The affine cipher uses the formula for encryption:
c=E(p)=(ap+b)mod 26
Where:
●
●
●
c is the ciphertext number.
p is the plaintext number.
a and b are constants that form the key.
For decryption, the formula is:
−1
p=D(c)=𝑎 (c−b)mod 26
Where:
●
−1
𝑎
is the modular inverse of a.
Steps Recap
1. Determine the Modular Inverse of aa:
−1
○
Found using 9×𝑎 ≡1 (mod 26)
○
In this example,𝑎 =3
−1
Apply the Decryption Formula for each letter:
○
p=3(c−2)mod 26
Map numbers back to letters for plaintext.
The affine cipher generalizes the Caesar cipher by using a linear transformation on each letter
of the plaintext. The encryption function is given by:
c=(ax+b)mod 26
where:
●
●
●
x is the numeric value of the plaintext letter,
a and b are keys,
c is the numeric value of the ciphertext letter.
Key Constraints
1. Choosing a:
○ The coefficient aa must be coprime with 26 for the decryption function to have a
unique solution. This means gcd(a,26)=1.
○ The values of aa that meet this criterion are: [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23,
25].
2. Choosing bb:
○ The value b can be any integer from 0 to 25.
Breaking the Affine Cipher
1. Brute Force:
○ You can attempt all 312 possible combinations of a and b to decipher the
ciphertext and see which one produces a readable plaintext.
○ This exhaustive approach is feasible but may be inefficient.
2. Known Plaintext Attack:
○ If you have some known plaintext and the corresponding ciphertext, you can
solve for the keys a and b.
○ For example,Vigenère Cipher
Historical Background:
●
●
Often attributed to Blaise Vigenère, the Vigenère cipher was actually developed by
Giovan Battista Bellaso in 1553.
It was considered unbreakable until Charles Babbage broke it in the 19th century.
Mechanism:
●
●
The Vigenère cipher is a polyalphabetic substitution cipher that uses a keyword to
encrypt and decrypt messages.
The keyword determines the shift for each letter of the plaintext, making it more complex
than a simple Caesar cipher.
Encryption Formula:
●
●
Let pipi​be the ii-th plaintext letter, kj​be the j-th key letter, and cici​be the ii-th ciphertext
letter.
Encryption is done using:ci=(pi+kj)mod 26
Example Calculation:
●
Plaintext: W (22) and Key: D (3)
●
●
c=(22+3)mod 26=25, which corresponds to Z.
The key repeats in cycles, allowing encryption across the entire plaintext.
Decryption Formula:
●
The decryption process uses:pi=(ci−kj)mod 26
Key Features:
●
●
Non-Repeating Pattern: Repeated occurrences of letters are encrypted differently,
defeating frequency analysis.
Infinite Key Variations: The number of possible keywords makes a brute force attack
impractical.
Beaufort Cipher
Mechanism:
●
●
●
An elegant variant of the Vigenère cipher.
Uses the same formula for both encryption and decryption:
ci=(kj−pi)mod 26
This makes it a reciprocal cipher.
One-Time Pad
Concept:
●
●
●
An extension of the Vigenère cipher where the keyword is as long as the plaintext and
completely random.
Unbreakable: If used correctly (with a truly random key never reused), it provides
perfect secrecy.
Challenges: Key distribution and management are major obstacles since the key must
be as long as the message and shared securely.
Permutation Cipher
Mechanism:
●
●
Unlike substitution ciphers, permutation ciphers rearrange the order of the letters in the
plaintext.
Security: Preserves letter frequencies, making it vulnerable to frequency analysis
Hill Cipher
The Hill cipher is a block cipher that uses linear algebra for encryption. It encrypts groups of
letters by multiplying them with an invertible key matrix and taking the result modulo 26.
Decryption requires the inverse of this key matrix.
One-Time Pad - Key Randomness
In a one-time pad, the key's randomness is vital. The key must be truly random, at least as long
as the message, and used only once. This ensures perfect security, as any non-random or
reused key compromises the cipher's unbreakability.
1.2 Reflecting on the content
● What is the most important thing you learned in this module?
The most important thing learned in this module is the application and analysis of
classical encryption techniques, such as the shift and affine ciphers, Vigenère
cipher, and the one-time pad. Understanding these methods reveals fundamental
principles of cryptography and data security.
● How is this useful?
This knowledge is crucial for grasping how different encryption systems function,
their strengths, and their vulnerabilities. It provides foundational skills for securing
data and understanding modern cryptographic systems.
● How does this relate to what you already know?
This module builds on basic algebra and modular arithmetic concepts, applying
them to real-world encryption techniques. It relates to foundational knowledge in
mathematics and computer science, particularly in understanding how data can
be securely encoded and decoded.
● Why do you think your course team wants you to learn the content of this
module?
The course team likely wants you to learn these concepts to provide a strong
base in cryptography. Understanding classical ciphers helps in appreciating the
evolution of encryption methods and their relevance in securing digital
communications today.
Download