跳到主要内容

hmac_sha1

简介

用于hmac_sha1效验码生成及效验报文

组件接口

hmac_sha1.gs

函数原型函数作用
string create_secret_key(int length = 32)生成密钥
bool check_msg(string key, string msg, buffer valid_code)效验报文
buffer generate_hmac_sha1(string key, string msg)生成HMACSHA1效验码

样例


import pkg.hmac_sha1;

string secret_key = hmac_sha1.create_secret_key();
buffer valid_code = hmac_sha1.generate_hmac_sha1(secret_key, "test msg");

hmac_sha1.check_msg(secret_key, "test msg", valid_code);