package hashes import ( "hash" "io" ) func Compute(r io.Reader, h hash.Hash) (res []byte, err error) { _, err = io.Copy(h, r) if err == nil { res = h.Sum(nil) } return }