phash: move sample function to the sample file