Perceptual hash algorithm