Professional Documents
Culture Documents
Module 1 PDF
Module 1 PDF
Crypto Basics
The basic terminology of crypto includes the following:
• Cryptology — the art and science of making and breaking "secret codes."
• Cryptography — the making of "secret codes."
• Cryptanalysis — the breaking of "secret codes."
• Crypto — a synonym for any or all of the above and more.
A cipher or cryptosystem is used to encrypt data. The original unencrypted data is known as
plaintext, and the result of encryption is ciphertext. Decrypting the ciphertext to recover the
original plaintext.
A key is used to configure a cryptosystem for encryption and decryption.
In a symmetric cipher, the same key is used to encrypt and to decrypt, as illustrated by the black box
cryptosystem in below Figure.
In public key crypto, the encryption key is known as the public key, whereas the decryption key,
which must remain secret, is the private key.
[ Kerckhoffs's principle goes as follows: A cryptographic system should be secure even if everything
about the system, except the key, is public knowledge].
Classic Crypto:
Four classic ciphers:
Simple Substitution Cipher.
Double Transposition Cipher
The convention that the plaintext is lowercase,and the ciphertext is uppercase. Using the key 3,
encrypt the plaintext message:
fourscoreandsevenyearsago
IRXUVFRUHDAGVHYHABHDUVDIR
To decrypt this simple substitution, look up the ciphertext letter in the ciphertext row and replace it
with the corresponding letter in the plaintext row, or shift each ciphertext letter backward by three.
The simple substitution with a shift of three is known as the Caesar's cipher.
If we limit the simple substitution to shifts of the alphabet, then the possible keys are
n ϵ {0,1,2,..., 25}.
Attacker can suspect that received text was encrypted with a simple substitution cipher using a
shift by n. Then he can try each of the 26 possible keys, decrypt the message, this Brute force
approach is known as Exhaustive key search.
It's necessary that the number of possible keys be too large for the attacker to simply try them
all in any reasonable amount of time.
Keyspace: Suppose attacker has a fast computer that's able to test 240 keys each second. Then a
keyspace of size 256 can be exhausted in 216 seconds, or about 18 hours, whereas a keyspace of size 264
would take more than half a year for an exhaustive key search, and a keyspace of size 2 128 would
require more than nine quintillion years.
A simple substitution cipher can employ any permutation of the alphabet as a key, which
implies that there are 26! = 288 possible keys.
With attacker's superfast computer that tests 240 keys per second, trying all possible keys for
the simple substitution would take more than 8900 millennia.
Attacker would expect to find the correct key half that time, or just 4450 millennia. Since 288
keys is far more than attacker can try in any reasonable amount of time. The keyspace is big
enough so that an exhaustive key search is infeasible.
Suppose attacker intercepts the following ciphertext, which he suspects was produced by a simple
substitution cipher, where the key could be any permutation of the alphabet:
Assuming the plaintext is English, attacker can make use of the English letter frequency counts in
Figure 2.2 together with the frequency counts for the ciphertext in (2.2), which appear in Figure 2.3.
"F" is the most common letter in the encrypted message and, according to Figure 2.2, "E" is the
most common letter in the English language.
Attacker therefore conclude that it's likely that "F" has been substituted for "E." Continuing in
this manner, attacker can try likely substitutions until he recognizes words, at which point he
can be confident in her guesses.
Conclusion: Above discussed attack on the simple substitution shows that a large keyspace is not
sufficient to ensure security.
Transpose (or permute) the rows according to (1,2,3) —> (3,2,1) and then transpose the
columns according to (1,2,3,4) —> (4,2,1,3), we obtain
The key consists of the size of the matrix and the row and column permutations.
Attackatdawn: If anyone who knows the key can put the ciphertext into the appropriate sized
matrix and undo the permutations to recover the plaintext.
For example, to decrypt the ciphertext is first put into a 3 x 4 array. Then the columns are
numbered as (4,2,1,3) and rearranged to (1,2,3,4), and the rows are numbered (3,2,1) and
rearranged into (1,2,3), and we have recovered the plaintext.
Conclusion: The double transposition appears to thwart an attack that relies on the statistical
information contained in the plaintext, since the plaintext statistics are disbursed throughout the
ciphertext.
The one-time pad key consists of a randomly selected string of bits that is the same length as
the message.
The key is then XORed with the plaintext to yield the ciphertext.
Decryption is accomplished by XOR-ing the same key with the ciphertext.
Example:
Consider that Alice has the key :
which is of the proper length to encrypt her message above. Then to encrypt, Alice computes the
ciphertext as:
srlhssthsr.
Bob, receives Alice's message, he decrypts it using the same shared key and thereby recovers the
plaintext:
1) Suppose that Alice has an enemy, Charlie, within her spy organization. Charlie claims that the
actual key used to encrypt Alice's message is
Bob decrypts the ciphertext using the key given to him by Charlie and obtains killhitler
which is a wrong message.
2) Suppose that Alice is captured by her enemies, who have also intercepted the ciphertext. The
captors ask Alice is to provide the key for this super-secret message. Alice claims that she is
actually a double agent and to prove it she provides the "key".
When Alice's captors "decrypt" the ciphertext using this "key," they find it as helikesike and
Alice's captors will release her.
Advantage: If the key is chosen at random, and used only once, then an attacker who sees the
ciphertext provides no meaningful information at all about the plaintext.
and the key has disappeared from the problem. In this case, the ciphertext does yield some
information about the underlying plaintext.
Scenario 2: Another way is considering an exhaustive key search. If the pad is only used once, then
the attacker has no way to know whether the guessed key is correct or not. But if two messages are in
depth, for the correct key, both putative plaintexts must make sense.
Let's consider an example of one-time pad encryptions that are in depth. Using the same bit encoding
as in Table. Suppose
and both are encrypted with the same key K = 110 011 101 111. Then
If the attacker knows that the messages are in depth, immediately he sees that the second and
fourth letters of P1 and P2 are the same, since the corresponding ciphertext letters are identical.
Now attacker can guess a putative message P1 and check her results using P2.
Suppose that attacker (who only has C1 and C2) suspects that P1 = k i l l = 011010100100.
Then he can find the corresponding putative key:
Since this K does not yield a sensible decryption for P2, attacker can safely assume that his
guess for P1 was incorrect.
Eventually attacker guesses P1 = like he will obtain the correct key K and decrypt to find P2=
kite, thereby confirming the correctness of the key therefore, the correctness of both
decryptions.
Project VENONA:
Codebook Cipher:
A classic codebook cipher is a dictionary-like book containing (plaintext) words and their
corresponding (ciphertext) codewords.
To encrypt a given word, the cipher clerk would simply look up the word in the codebook and
replace it with the corresponding codeword.
Decryption, using the inverse codebook, was equally straightforward.
Example: Below table contains a famous codebook used by Germany during World War I(used to
encrypt the famous Zimmermann telegram.)
This codebook was used for encryption, while the corresponding inverse codebook, arranged with the
5-digit codewords in numerical order, was used for decryption. A codebook is a form of a substitution
cipher.
The German Foreign Minister, Arthur Zimmermann, sent an encrypted telegram to the German
ambassador in Mexico City.
The ciphertext message, which appears in below figure was intercepted by the British. At the
time, the British and French were at war with Germany, but the U.S. was neutral.
Additive Book:
Ciphers were subject to statistical attack, so codebooks needed to be periodically replaced
with new codebooks. Since this was an expensive and risky process, techniques were
developed to extend the life of a codebook. To accomplish this, a additive book was used.
The codewords are all 5- digit numbers. Then the corresponding additive book would consist
of a long list of randomly generated 5-digit numbers.
In the Pacific theatre, the so-called Purple cipher was used for high level Japanese government
communication. This cipher was broken by American cryptanalysts before the attack on Pearl
Harbor, but the intelligence gained (code named MAGIC) provided no clear indication of the
impending attack.
The Japanese Imperial Navy used a cipher known as JN-25, which was also broken by the
Americans, an inferior American force was able to halt the advance of the Japanese in the
Pacific for the first time.
In Europe, the German Enigma cipher (code named ULTRA) was a major source of
intelligence for the Allies during the war.
The Enigma was initially broken by Polish cryptanalysts. After the fall of Poland, these
cryptanalysts escaped to France.
The Polish cryptanalysts eventually made their way to England, where they provided their
knowledge to British cryptanalysts.
A British team that included the computing pioneer, Alan Turing, developed improved attacks
on the Enigma.
An Enigma Cipher
A Taxonomy of Cryptography
Three broad categories of ciphers: symmetric ciphers, public key cryptosystems, and hash functions.
A Taxonomy of Cryptanalysis
The goal of cryptanalysis is to recover the plaintext, the key, or both.
Ciphertext only attack: If attacker only knows the algorithms and the ciphertext, then he
must conduct a ciphertext only attack
Known plaintext attack: Attacker might know some of the plaintext and observe the
corresponding ciphertext. These matched plaintext-ciphertext pairs might provide information
about the key.