improve: 优化包引用

This commit is contained in:
Mmx233
2022-10-21 13:59:19 +08:00
parent 9c2ea271a9
commit bb6803e04c
9 changed files with 41 additions and 52 deletions

23
v1/encode.go Normal file
View File

@@ -0,0 +1,23 @@
package BitSrun
import (
"crypto/md5"
"crypto/sha1"
"fmt"
"io"
)
// Md5 编码
func Md5(content string) string {
w := md5.New()
_, _ = io.WriteString(w, content)
return fmt.Sprintf("%x", w.Sum(nil))
}
// Sha1 编码
func Sha1(content string) string {
h := sha1.New()
h.Write([]byte(content))
bs := h.Sum(nil)
return fmt.Sprintf("%x\n", bs)
}