From a3ccc4d90de02d40b3eaeb41cb499d81680a13b1 Mon Sep 17 00:00:00 2001 From: Josh McSavaney Date: Tue, 8 Apr 2025 19:00:35 -0400 Subject: [PATCH] Use the correct form of sha1.Sum sha1.New().Sum(x) appends a hash of nothing to x. See https://go.dev/play/p/h6pGFHEzbfA --- helper/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper/helper.go b/helper/helper.go index 6dc18ff..6af24f8 100644 --- a/helper/helper.go +++ b/helper/helper.go @@ -223,7 +223,7 @@ func DelSlice(slice []interface{}, index int) []interface{} { //@param str string 需要加密的字符串 //@return string 加密后的字符串 func MySha1(str string) string { - return fmt.Sprintf("%x", sha1.New().Sum([]byte(str))) + return fmt.Sprintf("%x", sha1.Sum([]byte(str))) } //设置缓存