Files
honoka-chan/router/utils.go
T
2023-05-22 18:04:29 +08:00

18 lines
392 B
Go

package router
import (
"fmt"
"honoka-chan/config"
"honoka-chan/encrypt"
"time"
)
func SignResp(ep, body, key string) (resp string) {
signBody := fmt.Sprintf("%d,\"%s\",0,%s", time.Now().UnixMilli(), config.MasterVersion, body)
sign := encrypt.HMAC_SHA1_Encrypt([]byte(ep+" "+signBody), []byte(key))
// fmt.Println(sign)
resp = fmt.Sprintf("[%s,\"%s\"]", signBody, sign)
return
}