# Cryptography, ECB and CBCWatch

#1
I am looking at past exam papers for revision and have come across something that I have no idea what to do. Any help would be appreciated.

Encrypt the plaintext 100100100100 using ECB mode and CBC mode. Use the permutation cipher with block length 3 and key
The initialisation vector is 000.

0
7 years ago
#2
Your plaintext is made up of 12 bits, which can be split up into 4 blocks of 3 bits (that happen to be identical in this case). You need to apply the key, which is a permutation of three items, to each of these blocks. Actually you only need to do it once since the blocks are identical and hence they will produce the same result under the same permutation.

CBC is basically the same thing except you need to XOR the first block with the initialisation vector before applying the permutation. Then for each subsequent block you need to XOR it with the previously encrypted block before applying the key.
1
#3
Hmm ok. The thing is, I don;t even know how to apply the key. I am just looking and my brain screams at me to just hibernate!!
0
7 years ago
#4
Ah OK. The key is a permutation, written in two-row notation, which takes three items and rearranges them in some way. More precisely, it takes each item in the top row and maps it to the corresponding item in the bottom row. So looking at the first column of k, it takes the first item (1) and puts it in the second position (2). Similarly for the other two columns. You can think of each block of 3-bits as a sequence of three items, where 1 is the first item, 0 is the second and 0 is the third in order to apply the permutation to it.
0
#5
Does that mean then that, technically, ECB is easy and I am a moron? And that the ciphertext for the ECB mode would be 001001001001??
0
7 years ago
#6
It's easy if you know permutations, but if you've never seen them before then it could be tricky, although the key doesn't necessarily have to be a permutation.

Anyway your answer is wrong. Remember that k moves the first bit to the second bit as the first column is
0
#7
(Original post by Dragon)
It's easy if you know permutations, but if you've never seen them before then it could be tricky, although the key doesn't necessarily have to be a permutation.

Anyway your answer is wrong. Remember that k moves the first bit to the second bit as the first column is
I am an idiot!!! I actually meant 010010010010
0
7 years ago
#8
Yep. CBC should be straightforward too now you understand the key.
0
#9
I am not quite sure what XOR means though? Can't believe I was so stupid with the ECB though
0
#10
Hmm I wonder. 2 seconds
0
7 years ago
#11
XOR (Exclusive OR) is a logical operator that takes two bits. It outputs 0 if the two bits are equal and 1 otherwise.
0
#12
Would the answer for this one be 100 000 100 000? I applied 000 to block 1 and, as 1 and 0 are different i got 1, 0 and 0 are the same giving zero, 0 and 0 are the same giving 0 so first block being 100. Then the next block would go to 000 as 1 and 1 give 0, 0 and 0 give 0 and 0 and 0 give 0. Then the same again!
0
7 years ago
#13
You've got the right idea, but you need to also apply the key after XORing. The Wikipedia entry probably explains it better than I could.

http://en.wikipedia.org/wiki/Block_c...ning_.28CBC.29
0
#14
Ahhh ok. Soooo maybe it'd be 010 011 111 101 ??? That was without writing workings down so may have messed up a little?
0
7 years ago
#15
Yeah that's what I got too.
0
#16
Lovely. Many thanks for your help
0
X

new posts
Latest
My Feed

### Oops, nobody has postedin the last few hours.

Why not re-start the conversation?

see more

### See more of what you like onThe Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

### University open days

• Cranfield University
Cranfield Forensic MSc Programme Open Day Postgraduate
Thu, 25 Apr '19
• University of the Arts London
Open day: MA Footwear and MA Fashion Artefact Postgraduate
Thu, 25 Apr '19
• Cardiff Metropolitan University
Sat, 27 Apr '19

### Poll

Join the discussion

#### Have you registered to vote?

Yes! (315)
37.77%
No - but I will (64)
7.67%
No - I don't want to (62)
7.43%
No - I can't vote (<18, not in UK, etc) (393)
47.12%