first commit

This commit is contained in:
2024-07-23 10:23:43 +08:00
commit 7b4c2521a3
126 changed files with 15931 additions and 0 deletions

28
pkg/md5/md5.go Normal file
View File

@ -0,0 +1,28 @@
package md5
import (
cryptoMD5 "crypto/md5"
"encoding/hex"
)
var _ MD5 = (*md5)(nil)
type MD5 interface {
i()
// Encrypt 加密
Encrypt(encryptStr string) string
}
type md5 struct{}
func New() MD5 {
return &md5{}
}
func (m *md5) i() {}
func (m *md5) Encrypt(encryptStr string) string {
s := cryptoMD5.New()
s.Write([]byte(encryptStr))
return hex.EncodeToString(s.Sum(nil))
}