'Perform ECB mode with the given function'

def ecb(self, data, block_func):

    if ((len(data) % self.block_size) != 0):
        raise ValueError, 'Plaintext    length    must    be    multiple    of    16'
    block_size = self.block_size
    data = array('B', data)
    for offset in xrange(0, len(data), block_size):
        block = data[offset:(offset + block_size)]
        block_func(block)
        data[offset:(offset + block_size)] = block
    return data.tostring()
