Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-160

CBC XOR Chain Step

Problem

Perform the CBC chaining XOR: combine a plaintext (or decrypted) block with the previous ciphertext block elementwise using XOR. For the first block the previous value is the initialization vector.

Hint

Decryption applies the same XOR after the block cipher step.

Test cases

case 1
in: [[1,2],[3,4]]
expected: [2,6]
case 2
in: [[0,0,0],[255,255,255]]
expected: [255,255,255]
case 3
in: [[5],[5]]
expected: [0]
case 4
in: [[1,2,3,4],[4,3,2,1]]
expected: [5,1,1,5]
Starter codePython
def cbc_chain_xor(block, prev):
    # Your code here
    pass

4 test cases · run your code against them in the editor