Implement digest functions.