There are some use cases that aren't met by current hashing functions
Previous thread on golang-dev.
In my specific case, I'm looking for MD5 [de]serialization.
/cc @jlhawn
Seems like we could make the concrete types implement https://golang.org/pkg/encoding/#BinaryMarshaler and https://golang.org/pkg/encoding/#BinaryUnmarshaler at least.
We can't change the signature of e.g. https://golang.org/pkg/crypto/md5/#New but we could document in an Example that you can type-assert that the returned hash.Hash is also an encoding.BinaryUnmarshaler etc.
Any objections to hashes implementing BinaryMarshaler and BinaryUnmarshaler? Will leave this open for a week.
Proposal accepted. CLs welcome for the Go 1.10 cycle for
Change https://golang.org/cl/66710 mentions this issue: crypto, hash: implement BinaryMarshaler, BinaryUnmarshaler in hash implementations
Most helpful comment
Seems like we could make the concrete types implement https://golang.org/pkg/encoding/#BinaryMarshaler and https://golang.org/pkg/encoding/#BinaryUnmarshaler at least.
We can't change the signature of e.g. https://golang.org/pkg/crypto/md5/#New but we could document in an Example that you can type-assert that the returned
hash.Hashis also anencoding.BinaryUnmarshaleretc.