Cache sha256 results and eliminate per-call print statements.

This doesn't cause a significant speedup except in exceptional
cases.