Documente Academic
Documente Profesional
Documente Cultură
Practical Exercise
Classical to Modern Cryptography mode of exercises
Classical Cryptography
Shift Cipher
The Shift (or Caesar) Cipher is another monoalphabetic substitution cipher. Although more secure than
the Atbash Cipher, it is still an easy cipher to break, especially by today's standards. Originally, it was
used by Julius Caesar for sending encrypted messages to his troops, as recorded by Suetonius:
If he had anything confidential to say, he wrote it in cipher, that is, by so changing the order of the letters
of the alphabet that not a word could be made out. If anyone wishes to decipher these, and get at their
meaning, he must substitute the fourth letter of the alphabet, namely D, for A, and so with the others.
(Suetonius, the Twelve Caesars)
-
Exercise 1
Key:
Exercise 2
Key:
-2
Affine Cipher
The Affine Cipher is another example of a Monoalphabetic Substituiton cipher. It is slightly different to
the other examples encountered here, since the encryption process is substantially mathematical. The
whole process relies on working modulo m (the length of the alphabet used). By performing a calculation
on the plaintext letters, we encipher the plaintext.
-
Exercise 3
A simple message
Key:
a = 7, b = 13
Page 1 of 7
Exercise 4
Key:
a = 15, b = 3
Vigenre Cipher
Vigenre Cipher was actually first described by Giovan Battista Bellaso in his 1553 book La cifra del.
Sig. Giovan Battista Bellaso. However, in the 19th Century, it was misattributed to Blaise de Vigenre,
who had presented a similar cipher (the Autokey Cipher) in 1586.
At the time, and for many centuries since its invention, the Vigenre Cipher was renowned for being a
very secure cipher, and for a very long time it was believed to be unbreakable. It was this thought that
earned it the nickname "le chiffre indchiffrable" (French for "the unbreakable cipher"). Although this is
not true (it was fully broken by Friedrich Kasiski in 1863), it is still a very secure cipher in terms of paper
and pen methods, and is usable as a field cipher.
-
Exercise 5
Key:
vigenere
Exercise 6
KLTMJDQSXFXYHLWLTMEZMNTPYJ
Key:
alberti
Page 2 of 7
Enigma
-
Exercise 7
Key:
Enigma Cipher
The Enigma cipher was a field cipher used by the Germans during World War II. The Enigma is one of
the better known historical encryption machines, and it actually refers to a range of similar cipher
machines. The first Enigma machine was invented by a German engineer named Arthur Scherbius at the
end of the first world war. It was used commercially from the early 1920s on, and was also adopted by the
military and governmental services of a number of nations most famously by Nazi Germany before
and during World War II. A variety of different models of Enigma were produced, but the German
military model, the Wehrmacht Enigma.
The Algorithm
This section will talk about the Enigma I aka Wehrmacht Enigma, other variants are similar in operation.
The 'key' for the enigma consists of several elements:
1. The rotors and their order
2. The rotor start positions
3. The ringstellung, or ring settings
4. Steckerverbindungen, or plug board settings
Page 3 of 7
Modern Cryptography
1) Stream Cipher One-time pad encoder/decoder and key generator
The one-time pad (OTP) encryption technique is the only proven unbreakable encryption system.
Even infinite computational power and time cannot break this system.
Implementation of the one-time pad system
This tool allows you to enter a message in any language, e.g.: English, Chinese, Russian etc.
All texts are considered UTF-8 encoded.
UTF-8 is a multibyte encoding that can represent any Unicode character in 1 to 4 bytes.
The message Operation start at 10:00 consists of 24 ASCII characters, thus total 24 bytes.
Each character in the message will be converted into a hexadecimal value, for example:
4f7065726174696f6e2073746172742061742031303a3030
To encrypt the message you need a randomly generated number called a one-time pad, for
example:
a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9
XOR the message and one-time pad to create the cipher :
message:
4f7065726174696f6e2073746172742061742031303a3030
one-time pad: a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9
------------------------------------------------ xor
cipher:
ec4afd195eff787295db6e5a0e7b4054eece4ecd3793ca89
To decrypt the cipher, XOR the cipher and the same one-time pad:
cipher:
ec4afd195eff787295db6e5a0e7b4054eece4ecd3793ca89
one-time pad: a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9
------------------------------------------------ xor
message:
4f7065726174696f6e2073746172742061742031303a3030
Convert the message hexadecimal value to UTF-8 and you get:
Operation start at 10:00
How to use the one-time pad system
1. Bob and Alice wants to exchange multiple messages secretly using the one-time pad
system.
2. Bob generates a list of one-time pads, each one-time pad contains a prefix reference
number.
3. Bob stores the list on two USB flash drives.
Page 4 of 7
4. Bob and Alice meet each other in a restaurant and Bob hand over one of the USB flash
drives.
5. At home Bob creates a message and encrypts it with a one-time pad from the list.
The encrypted message (cipher), also contains a prefix referring to the one-time pad used.
6. After encryption Bob deletes the used one-time pad from his list.
7. Bob sends the cipher to Alice using his email.
8. Alice receives the cipher. She looks at the cipher prefixed number and knows which onetime pad she must use to decrypt the cipher.
9. Alice decrypts the cipher using the one-time pad from her list.
10. After Alice has decrypted the message, she deletes the used one-time pad from her list.
The one-time pad system cannot be cracked if the following rules are applied correctly:
Exercise 8
Exercise 9
Plaintext:
A simple message
http://www.mobilefish.com/services/one_time_pad/one_time_pad.php#one_time_pad_output
Page 5 of 7
Exercise 10
Use the Symmetric Block Cipher Algorithms above to encrypt the following messages
1. Plaintext:
Key:
Mode:
Input:
2. Plaintext:
A simple message
Key:
Mode:
Input:
Page 6 of 7
The MD5 (Message Digest) algorithm produces a 128-bit (16-byte) hash value, typically
expressed in text format as a 32 digit hexadecimal number.
2. SHA1
SHA1 (Secure Hash Algorithm) algorithm produces a 160-bit (20-byte) hash value,
typically expressed in text format as a 40 digit hexadecimal number.
3. SHA224
SHA224 (Secure Hash Algorithm) algorithm produces a 224-bit (28-byte) hash value,
typically expressed in text format as a 56 digit hexadecimal number.
4. SHA256
SHA256 (Secure Hash Algorithm) algorithm produces a 256-bit (32-byte) hash value,
typically expressed in text format as a 64 digit hexadecimal number.
5. SHA384
SHA384 (Secure Hash Algorithm) algorithm produces a 384-bit (48-byte) hash value,
typically expressed in text format as a 96 digit hexadecimal number.
6. SHA512
SHA512 (Secure Hash Algorithm) algorithm produces a 512-bit (64-byte) hash value,
typically expressed in text format as a 128 digit hexadecimal number.
7. RIPEMD160
RIPEMD160 (RACE Integrity Primitives Evaluation Message Digest) algorithm
produces a 160-bit (20-byte) hash value, typically expressed in text format as a 40 digit
hexadecimal number.
The file you upload and the calculated hash will never be sent to the server. All calculations are
performed directly in the browser using Javascript.
http://www.mobilefish.com/services/file_checksum_calculator/file_checksum_calculator.php
Page 7 of 7