Cryptology Assignment 2
Cryptology Assignment 2
3.2 What are the two basic functions used in encryption algorithms?
Two basic functions used in encryption algorithms are substitution and transposition.
Substitution
In this principle, letters or numbers in plain text are replaced by some other letters, symbols, or
numbers. i.e., every element(a group of letters) on the plain text is mapped to some other
element.
So by replacing the characters that represent the original message with some random characters,
the data becomes unreadable.
Which involves replacing the letter with 3 places further down the alphabet to it.
For example:
Transposition:
In this principle, The letters in the plain text are rearranged. The fundamental requirement is that
no information is lost (i.e., that all operations can be reversed).
In this technique, the plain text was written down as a sequence of diagonals and read as rows
For example:
WdehpdalwIlnuIteol
EgsaeblhrIgpnhwo
“wdehpedalwlinuiteolegsaeblhrigpnhwo”
In the above message, we read off the message in rows leaving the jumbled text
3.3 What is the difference between a block cipher and a stream cipher?
A stream cipher is one that encrypts a digital data stream one bit or one byte at a time. A block
cipher is one in which a block of plaintext is treated as a whole and used to produce a ciphertext
block of equal length.
List and briefly define types of cryptanalytic attacks based on what is known to the
Attacker.
Ciphertext only:
In this type of attack, the cryptanalyst/attacker knows the Encryption algorithm as well as
Ciphertext. And in many cases, he might know some plain texts too. However, This type of
attack is said to be the hardest of all, because he has very little know information to crack the
secret key.
Known plaintext:
In this type of attack, the cryptanalyst knows encryption algorithm, cyphertext, as well as One or
more plaintext–ciphertext pairs formed by the private key.
By using this information the attacker may be able to deduce the key based on how the known
plaintext is transformed.
Chosen plaintext:
In this type of attack, the attacker knows the encryption algorithm, and Plaintext message chosen
by the cryptanalyst, together with its corresponding ciphertext generated with the secret key.
If the analyst is able somehow to get the source system to insert into the system a message
chosen by the analyst, then a chosen-plaintext attack is possible.
Chosen ciphertext:
The attacker knows, Encryption algorithm and Ciphertext chosen by the cryptanalyst together
with its associated decrypted plaintext generated with the secret key and analyze this information
to deduce the secret key.
Chosen text:
In this method, the attacker knows, Encryption algorithm,Ciphertext,
Ciphertext chose by cryptanalyst, together with its corresponding decrypted plaintext generated
with the secret key.The attacker use the above information to deduce the key.
Unfortunately there is no encryption algorithm that is unconditionally secure, with the exception
of the one-time pad(OTP)
Even if it met only one of these, it is said to be computationally secure. But, The amount of time
needed to properly cryptanalyze ciphertext is difficult to estimate.
Full Explanation:
Caesar cipher technique works in such a way that all the letters in the original text are replaced
by letters some k places further down in the alphabet.
A b c d e f g h I j k l m n o p q r s t u v w x y z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
C = E(k, p) = (p + k) mod 26
Where C is ciphertext
E is Encryption
P is plaintext.
P = D(k, C) = (C – k) mod 26
By trying all possible values k can take, an attacker can easily deduce the key and plain text
Plaintext: wedge shaped ball whirling up in the wool
So in brief, these three points enable the attacker to use brute force cryptanalysis on the said
algorithm.
3.11 What is the difference between a monoalphabetic cipher and a polyalphabetic cipher?
There are 26! Or 4 * 10^26 possible keys available for the monoalphabetic substitution cipher.
Explanation:
For monoalphabetic substitution cipher, we use a permutation of alphabets.
A permutation is explained as Let’s say S is an ordered sequence of elements, with each element
appearing exactly once.
Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
If, instead of using cipher line and leaving the attacker a good chance of cracking the key(only
25 tries), we can replace the cipher line with one of the permutations of alphabets
Giving one hell of a headache for the attacker to find the key.
But, there is one weak point in this technique, if the cryptanalyst knows the language of
plaintext, he can exploit the frequency of letters to find the key.
Let’s see how the frequency distribution plot developed in fig 3.6 in the first place.
To find the frequency value of the letter, we take the number of occurrences of each letter in the
text and divide it with the occurrences of the most frequently used letter.
Such that value of letter ‘ e ‘ calculated as 12.702/12.072 = 1; (Acc to values of fig 3.5)
Generally, if the relative frequency of a letter’s plot is straight, flat, and horizontal then it is said
to be secure and cryptanalysis of ciphertext is nearly impossible.
But in fig 3.6 You can see the plot of the Playfair cipher plot nowhere near flat. And share much
of the same relative frequency structure as plaintext. Leaving enough data for attackers to work
with. Generally, a few hundred letters of ciphertext are said to be sufficient.
Answer
One-time pad offers complete security, but it has two major problems in practice:
First one is, one time pad requires a random key of length same as the original message.
This is where problem arises. Making large quantities of random keys for any heavily used
system might require million of random characters on daily basis. This presents an enormous
challenge to provide truly random characters
Second one, and even more challenging is, distribution and protection of the private key.
As both sender and receiver requires the same key and protecting the key is equally mammoth
task.
Because of these issues, one time pad has a limited utility and used only for the low bandwidth
channels.
EXPLAIN THE ATTACK OF DOUBLE DES THAT MOTIVATES THE USE OF TRIPLE DES
Double DES is vulnerable to a known attack called the meet-in-the-middle attack. In this attack,
an attacker captures a plaintext-ciphertext pair and tries all possible keys in the first encryption
pass and all possible keys in the second encryption pass to find a match. This significantly
reduces the effective key length of Double DES from 112 bits to 57 bits, making it vulnerable to
brute force attacks.
To mitigate this vulnerability, Triple DES was introduced. Triple DES applies the DES algorithm
three times with three different keys, making it much more secure than Double DES. With Triple
DES, even if an attacker successfully performs a meet-in-the-middle attack on the first two
passes, they would still need to perform another attack on the third pass with a different key,
significantly increasing the complexity of the attack. Triple DES effectively increases the key
length to 168 bits, making it more resistant to brute force attacks and other cryptographic attacks.
The Vigenère cipher is considered unconditionally secure when the key used for encryption is
truly random, is at least as long as the plaintext message, and is never reused. In this scenario, the
key serves as a one-time pad, where each character of the key is used only once to encrypt a
single character of the plaintext.
When these conditions are met, the Vigenère cipher becomes unbreakable because each character
of the ciphertext is produced by combining the corresponding character of the plaintext with a
unique character from the key. Without knowing the exact key used for encryption, an attacker
would have no way to determine the original plaintext.
However, achieving unconditional security with the Vigenère cipher in practice can be
challenging due to the requirements of generating truly random keys that are as long as the
plaintext and ensuring that keys are never reused. If these conditions are not met, the Vigenère
cipher is vulnerable to frequency analysis and other cryptanalysis techniques.
Strength of DES
DES (Data Encryption Standard) is a symmetric encryption algorithm that was widely used for
secure communication and data protection. The strength of DES lies in its key size and the
complexity of its encryption process. Here are some key points that highlight the strength of
DES:
1. Key Size: DES uses a 56-bit key for encryption, which means there are 2^56 possible
keys that can be used to encrypt data. This key size was considered strong when DES was
first introduced in the 1970s, but over time, advances in computing power made it
vulnerable to brute force attacks.
2. Feistel Cipher Structure: DES is based on a Feistel network structure, which involves
multiple rounds of substitution and permutation operations. This complex structure adds
to the security of the algorithm by creating confusion and diffusion in the encryption
process.
4. Avalanche Effect: DES exhibits a strong avalanche effect, meaning that small changes in
the input (plaintext or key) result in significant changes in the output (ciphertext). This
property makes it difficult for attackers to predict the relationship between plaintext,
ciphertext, and keys.
5. Standardization and Scrutiny: DES was developed by IBM and adopted as a federal
standard by the U.S. government. It underwent rigorous scrutiny and testing before being
widely adopted, which contributed to its perceived strength and reliability.
Despite its strengths, DES is no longer considered secure for modern cryptographic applications
due to its small key size and vulnerability to brute force attacks. As a result, it has been replaced
by more secure encryption algorithms such as AES (Advanced Encryption Standard).
Question
A generalization of the Caesar cipher, known as the affine Caesar cipher, has
the following form: For each plaintext letter p, substitute the ciphertext letter
C:
C = E([a, b], p) = (ap + b) mod 26
c. Provide a general statement of which values of a are and are not allowed.
Justify
your statement.
a.
The value of b determines the shift applied to each plaintext letter before
modular arithmetic is performed. Since modular arithmetic wraps around the
alphabet, any value of b will produce a unique ciphertext letter for each
plaintext letter, ensuring a one-to-one mapping.
b.
To determine which values of a are not allowed in the affine Caesar cipher, we
need to find values of a that result in a non-one-to-one mapping. This occurs
when the value of a shares a common factor with the modulus (26 in this case).
The common factor means that some plaintext letters will map to the same
ciphertext letter, making decryption impossible.
In the case of the affine Caesar cipher, the modulus is 26. So, we need to find
values of a that have a common factor with 26. The common factors of 26 are
1, 2, 13, and 26. Therefore, the values of a that are not allowed in the affine
Caesar cipher are 2, 13, and 26.
c.
In general, the values of a that are allowed in the affine Caesar cipher are the
ones that are coprime (have no common factors) with the modulus (26 in this
case).