file-server/hasher.go
func (s MD5Hasher) Hash(reader io.Reader) (string, error) {
	hash := md5.New()
	if _, err := io.Copy(hash, reader); err != nil {
		return "", err
	}
	h := hash.Sum(nil)
	if len(h) < s.HashLength {
		return "", nil
	}
	return strings.TrimRight(hex.EncodeToString(h)[:s.HashLength], "="), nil
}
func (s MD5Hasher) Hash(reader io.Reader) (string, error) {
	hash := md5.New()
	if _, err := io.Copy(hash, reader); err != nil {
		return "", err
	}
	h := hash.Sum(nil)
	if len(h) < s.HashLength {
		return "", nil
	}
	return strings.TrimRight(hex.EncodeToString(h)[:s.HashLength], "="), nil
}
// Hash returns a part of a MD5 sum of a file.