Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-159

ECB Pattern Detect

Problem

Return True when any block appears more than once in the list of blocks, which is the classic signature of ECB mode leaking repeated plaintext. Each block is a list of byte values.

Hint

Repeated ciphertext blocks mean repeated plaintext blocks under ECB.

Test cases

case 1
in: [[[1,2],[3,4],[1,2]]]
expected: true
case 2
in: [[[1,2],[3,4],[5,6]]]
expected: false
case 3
in: [[]]
expected: false
case 4
in: [[[7,7],[7,7]]]
expected: true
Starter codePython
def ecb_detect(blocks):
    # Your code here
    pass

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