generate_hmac_sha1
- 根据报文信息以及密钥key生成hmac_sha1效验码
声明
buffer generate_hmac_sha1(string key, string msg)
参数
参数名 | 描述 |
---|---|
key | 由create_secret_key生成的密钥key |
msg | 需要生成效验码的字符串报文 |
返回值
返回长度为20,类型为buffer的效验码
使用方式
import pkg.hmac_sha1;
string key = hmac_sha1.create_secret_key(16);
string comm_msg = "this is the msg information";
buffer valid_code = hmac_sha1.generate_hmac_sha1(key, msg); //valid_code为长度为20的buffer效验码