better digest calculation