Assert valid hash digest encoding.

Assert that the hash digest encoding to the legacy `crypto.Hash.digest`
method is one of the valid digest encoding types.

Closes #46.