SHELL
python
hmac.new(hmackey,str,hashlib.sha1).digest().encode('base64').rstrip()
需要Import hmac, hashlib, base64,其中hmackey是验证key,str是需要计算的字符串
SHELL
sstr=`echo -n $strdata | openssl dgst -sha1 -hmac "$hmackey" -binary | base64 `
同样功能的SHELL命令
参考:
http://stackoverflow.com/questions/7285059/hmac-sha1-in-bash
http://blog.youkuaiyun.com/jiang1013nan/article/details/17318133