improve Hash digest routine