Refactor digest usage a bit.