쿠폰 이름 해시 로직 변경
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user