encode.go 284 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
package encode

import (
	"crypto/hmac"
	"crypto/sha512"
	"encoding/hex"
)

func CalcDevHexedSign(modelId, devID, date string, hmacKey string) string {
	mac := hmac.New(sha512.New, []byte(hmacKey))
	mac.Write([]byte(modelId + devID + date))
	return hex.EncodeToString(mac.Sum(nil))
}