Current implementation of func Sum(data []byte, code uint64, length int) (Multihash, error) doesn't handle error returned from hasher.Write. If there is non-nil error returned it could potentially mean thathasheris not being in valid state to calculate the hash byhasher.Sum()`.
Problem
Current implementation of
func Sum(data []byte, code uint64, length int) (Multihash, error)
doesn't handle error returned fromhasher.Write. If there is non-nil error returned it could potentially mean that
hasheris not being in valid state to calculate the hash by
hasher.Sum()`.https://github.com/multiformats/go-multihash/blob/196bbeb81a568a71ec224866ccc68c1f28a272d8/sum.go#L27