You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
533 B
Go

3 years ago
/**
* @Author: jager
* @Email: lhj168os@gmail.com
* @File: utils
* @Date: 2021/12/31 4:41
* @package: utils
* @Version: v1.0.0
*
* @Description:
*
*/
package utils
import (
"fmt"
"github.com/jageros/hawox/encrypt"
3 years ago
"math/rand"
3 years ago
"time"
)
func GenSecret(uid string) string {
3 years ago
return encrypt.Sha1(fmt.Sprintf("%s%d%d", uid, time.Now().Unix(), rand.Intn(99999999)+100))
}
func GenSecretMd5(uid string) string {
return encrypt.Md5(fmt.Sprintf("%s%d%d", uid, time.Now().Unix(), rand.Intn(99999999)+100))
3 years ago
}