add new decrypt encrypt function to member
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"time"
|
||||
@@ -34,3 +37,9 @@ func GetCurrentTime(loc *time.Location) string {
|
||||
func GetCurrentDay(loc *time.Location) string {
|
||||
return fmt.Sprint(time.Now().In(loc).Weekday())
|
||||
}
|
||||
|
||||
func HashField(field string, token []byte) string {
|
||||
h := hmac.New(sha256.New, token)
|
||||
h.Write([]byte(field))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user