

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Notes: In ECB, you’ll be encrypting each block identically, using the same key.
In CBC, you will take the previous block of cipher text and “add” it to the new current block, computing the result mod 26. This will then be encrypted using the Vigenere cipher with the given key.
In CTR, you will encrypt the original counter value as well as the next three values with the same key. Each of these four created values will then be “added” to the current block mod 26 to create the ciphertext.
Solution: First, break message into 4 blocks. (16/4 = 4)
M = MODE | SOFO | PERA | TION. So b1 = MODE = [12 14 3 4], b2 = SOFO = [18 14 5 14], b3 = PERA = [15 4 17 0], b4 = TION = [19 8 14 13]
ECB: Cipher each block with the same key K = FOUR = [5 14 20 17]
Encrypt b1: [12 14 3 4] + [5 14 20 17] = [17 28 23 21] mode 26 = [17 2 23 21] = RCXV
Encrypt b2: [18 14 5 14] + [5 14 20 17] = [23 28 25 31] mode 26 = [23 2 25 5] = XCZF
Encrypt b3: [15 4 17 0] + [5 14 20 17] = [20 18 37 17] mode 26 = [20 18 11 17] = USLR
Encrypt b4: [19 8 14 13] + [5 14 20 17] = [24 22 34 30] mode 26 = [24 22 8 4] = YWIE
So the output in ECB mode is RCXV XCZF USLR YWIE
CBC: For block bi, first do bi XOR Ci-1, then cipher with K = FOUR = [5 14 20 17], C 0 = INIT = [8 13 8 19]
Encrypt b1: b1 XOR C0 = [12 14 3 4] + [8 13 8 19] = [20 27 11 23] mod 26 = [20 1 11 23], then [20 1 11 23] + [5 14 20 17] = [25 15 31 40] mode 26 = [25 15 5 14] = ZPFO, C1 = [25 15 5 14]
Encrypt b2: b2 XOR C1 = [18 14 5 14] + [25 15 5 14] = [43 29 10 28] mod 26 = [17 3 10 2], then [ 3 10 2] + [5 14 20 17] = [22 17 30 19] mode 26 = [22 17 4 19] = WRET, C2 = [22 17 4 19]
Encrypt b3: b3 XOR C2 = [15 4 17 0] + [22 17 4 19] = [37 21 21 19] mod 26 = [11 21 21 19], then [ 21 21 19] + [5 14 20 17] = [16 35 41 36] mode 26 = [16 9 15 10] = QJPK, C3 = [16 9 15 10]
Encrypt b4: b4 XOR C3 = [19 8 14 13] + [16 9 15 10] = [35 17 29 23] mod 26 = [9 17 3 23], then [ 17 3 23] + [5 14 20 17] = [14 31 23 40] mode 26 = [14 5 23 14] = OFXO, C4 = [14 5 23 14]
So the output in CBC mode is ZPFO WRET QJPK OFXO
CTR: The four counters are C1 = FIRA = [5 8 17 0], C2 = FIRB = [5 8 17 1], C3 = FIRC = [5 8 17 2] and C4 = FIRD = [5 8 17 3], For block bi, first cipher Ci into Oi with K = FOUR = [5 14 20 17], then do bi XOR Oi.
Encrypt b1: cipher C1 = [5 8 17 0] + [5 14 20 17] = [10 22 37 17] mod 26 = [10 22 11 17] = O1, then b1 XOR O1 = [12 14 3 4] + [10 22 11 17] = [22 36 14 21] mode 26 = [22 10 14 21] = WKOV
Encrypt b2: cipher C2 = [5 8 17 1] + [5 14 20 17] = [10 22 37 18] mod 26 = [10 22 11 18] = O2, then b2 XOR O2 = [18 14 5 14] + [10 22 11 18] = [28 36 16 32] mode 26 = [2 10 16 6] = CKQG
Encrypt b3: cipher C3 = [5 8 17 2] + [5 14 20 17] = [10 22 37 19] mod 26 = [10 22 11 19] = O3, then b3 XOR O3 = [15 4 17 0] + [10 22 11 19] = [25 26 28 19] mode 26 = [25 0 2 19] = ZACT
Encrypt b4: cipher C4 = [5 8 17 3] + [5 14 20 17] = [10 22 37 20] mod 26 = [10 22 11 20] = O4, then b4 XOR O4 = [19 8 14 13] + [10 22 11 20] = [29 30 25 33] mode 26 = [3 4 25 7] = DEZH
So the output in CTR mode is WKOV CKQG ZACT DEZH
Solution: Calculation based on definition of primitive root.
31 mod 11 = 3 mod 11 = 3,
32 mod 11 = 9 mode 11 = 9,
33 mod 11 = 27 mod 11 = 5,
34 mod 11 = 81 mod 11 = 4,
35 mod 11 = 243 mod 11 = 1,
36 mod 11 = 729 mod 11 = 3 = 3^1 mod 11.
So 3 is not a primitive root of 11 since 3^1 mod 11 and 3^6 mod 11 are not distinctive.