Imc Shift-Cipher
Imc Shift-Cipher
Michele Ciampi
Lecture 01 Part 3
1 / 17
Shift Cipher
2 / 17
The Shift Cipher
helloworldz
ccccccccccc
jgnnqyqtnfb
3 / 17
Modular arithmetic
4 / 17
The Shift Cipher, formally
5 / 17
Is the Shift Cipher secure?
Brute-force Attack
▶ No – only 26 possible keys!
▶ Given a ciphertext, try decrypting with every possible key
▶ Only one possibility will “make sense”
▶ Example of a brute-force or exhaustive-search attack
6 / 17
Brute-force Attack on Shift Cipher
Example
▶ Ciphertext uryybjbeyq
▶ Try every possible key and decrypt:
▶ message under key 1 is: tqxxaiadxp
▶ message under key 2 is: spwwzhzcwo
▶ ...
▶ message under key i is: helloworld
▶ ...
7 / 17
Byte-wise Shift Cipher
8 / 17
Hexadecimal (base 16) Notation
9 / 17
Hexadecimal (base 16) Notation
0x10
▶ 0x10 = 16*1 + 0 = 16
▶ 0x10 = 0001 0000
0xAF
▶ 0xAF = 16*A + F = 16*10 + 15 = 175
▶ 0xAF = 1010 1111
10 / 17
ASCII
11 / 17
ASCII table
https://hubpages.com/technology/What-Are-ASCII-Codes
12 / 17
Useful observations
13 / 17
Byte-wise Shift Cipher, Formally
▶ M = strings of bytes
▶ Gen: choose uniform k ∈ K = {0x00 . . . 0xFF} i.e. there
are 256 possible keys
▶ Enck (m1 . . . mt ): output c1 . . . ct , where
ci = mi ⊕ k
mi = ci ⊕ k
14 / 17
Is this scheme secure?
15 / 17
Sufficient key space principle
16 / 17
End
17 / 17