mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 02:19:04 +08:00
v2.0
This commit is contained in:
24
server/utility/encrypt/encrypt.go
Normal file
24
server/utility/encrypt/encrypt.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Package encrypt
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package encrypt
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
)
|
||||
|
||||
// Md5ToString 生成md5
|
||||
func Md5ToString(str string) string {
|
||||
return fmt.Sprintf("%x", md5.Sum([]byte(str)))
|
||||
}
|
||||
|
||||
func Hash32(b []byte) uint32 {
|
||||
h := fnv.New32a()
|
||||
h.Write(b)
|
||||
return h.Sum32()
|
||||
}
|
Reference in New Issue
Block a user