Change digest function to Digest class.