Make digest composable & add tests.