From 7e8afcd2a94a2544469af11eac19eb40b38f1942 Mon Sep 17 00:00:00 2001 From: mountain Date: Mon, 22 Jan 2024 16:51:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BF=A0=ED=8F=B0=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=ED=95=B4=EC=8B=9C=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coupon/helper.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coupon/helper.go b/coupon/helper.go index 768fe7b..1eeab02 100644 --- a/coupon/helper.go +++ b/coupon/helper.go @@ -1,6 +1,7 @@ package coupon import ( + "crypto/md5" "encoding/binary" "encoding/hex" "math/rand" @@ -41,8 +42,12 @@ func DisolveCouponCode(code string) (round string, key string) { } func MakeCouponRoundHash(name string) (hash string, roundNumber uint32) { + m5 := md5.New() + m5.Write([]byte(name)) + hashbt := m5.Sum(nil) + roundbt := make([]byte, 8) - copy(roundbt, []byte(strings.ToLower(name))) + copy(roundbt, hashbt[:8]) roundseed := int64(binary.BigEndian.Uint64(roundbt)) roundhash := make([]byte, 4)