Wrap our sha2 interface in Rust which implements the appropriate traits
We should wrap our usage of hash digest functions (and XOFs) in Rust types which implement the appropriate traits, yet still exposes the same API functionality we currently have in C. To keep this task small, I think we should start off with just the sha2 code for now. (Later, it's probably some copy-paste and a bit of refactoring to provide the same interface for other digests, and similar for XOFs.)
This ticket is probably slightly blocked on legacy/trac#24658 (moved), and in turn is blocking legacy/trac#23886 (moved).