packageutilimport("crypto/md5""encoding/hex""io""strings")// Md5Sum calculates the md5sum of a streamfuncMd5Sum(readerio.Reader)(string,error){varreturnMD5Stringstringhash:=md5.New()if_,err:=io.Copy(hash,reader);err!=nil{returnreturnMD5String,err}hashInBytes:=hash.Sum(nil)[:16]returnMD5String=hex.EncodeToString(hashInBytes)returnreturnMD5String,nil}// Md5Sum calculates the md5sum of a stringfuncMd5SumString(inputstring)(string,error){buffer:=strings.NewReader(input)returnMd5Sum(buffer)}