On the security of a class of diffusion mechanisms for image encryption