新功能(#102): 新增邀请记录接口并删除旧邀请销售接口
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -3,15 +3,26 @@ package hash
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"strconv"
|
||||
|
||||
"github.com/spaolacci/murmur3"
|
||||
)
|
||||
|
||||
const invitePeerHashSalt = "ppanel_invite_" + "sales_v1"
|
||||
|
||||
// Hash returns the hash value of data.
|
||||
func Hash(data []byte) uint64 {
|
||||
return murmur3.Sum64(data)
|
||||
}
|
||||
|
||||
func InvitePeerHash(userId int64) string {
|
||||
h := fnv.New64a()
|
||||
_, _ = h.Write([]byte(invitePeerHashSalt))
|
||||
_, _ = h.Write([]byte(strconv.FormatInt(userId, 10)))
|
||||
return fmt.Sprintf("%010d", h.Sum64()%10000000000)
|
||||
}
|
||||
|
||||
// Md5 returns the md5 bytes of data.
|
||||
func Md5(data []byte) []byte {
|
||||
digest := md5.New()
|
||||
|
||||
Reference in New Issue
Block a user