@
sujin190 #6 我的小例子 写错了
```php
<?php
$sudAppId = '1719669845797171201';
$sudTimestamp = '1698912908000';
$sudNonce = 'lFM9MKckbGYiZAQG';
$body = '{"platform":2}';
$signContent = $sudAppId . '\n' . $sudTimestamp . '\n'
. $sudNonce . '\n' . $body .'\n';
$appSecret = 'test';
$sign = hash_hmac('sha1', $signContent, $appSecret,false);
echo $sign;
```
这种也不行 , 试了下 sign 出来 和 java node golang 的 不一致
```golang
package main
import (
"crypto/hmac"
"crypto/sha1"
"fmt"
)
func main() {
// 应用 ID
var appId = "1719669845797171201"
// 应用 secret
var appSecret = "test"
// 请求时间戳(发送请求的时间戳)
var timestamp = "1698912908000"
// 随机字符串 (自定义随机字符串)
var nonce = "lFM9MKckbGYiZAQG"
// 请求 body (请求 body , 需保证发送方与接收方的数据一致,建议在拦截器里做对应认证)
var body = "{\"platform\":2}"
// 签名串
signContent := fmt.Sprintf("%s\n%s\n%s\n%s\n", appId, timestamp, nonce, body)
// 签名值
mac := hmac.New(sha1.New, []byte(appSecret))
mac.Write([]byte(signContent))
signature := mac.Sum(nil)
//t.Logf("signature:%x", signature)
test, _ := fmt.Printf("signature:%x", signature)
fmt.Println(test)
}
```
golang 的可以