def detect_ecb(ctext):
    """
    Returns True if ciphertext is likely to be encrypted under ECB mode, False
    if otherwise.
    """
    # Break into blocks of 16.
    blocks = [bytes(ctext[i:i+16]) for i in range(0, len(ctext), 16)]

    # Find the set of unique blocks.
    unique = set(blocks)

    # If the set of unique blocks is smaller than the number of blocks, then
    # we have repeated blocks - therefore it is encrypted under ECB mode.
    return len(unique) < len(blocks)