1. h := md5.New() h.Write([]byte(str)) return hex.EncodeToString(h.Sum(nil)) 2.md5str:=fmt.Sprintf("%x",md5.Sum([]byte(str))) return md5str