'sha1'是HMAC-SHA1算法 。//再调用base64_encode方法加密,base64_encode 使用 MIME base64 对数据进行编码 。
$sig = base64_encode(hash_hmac('sha1', $param_uri, $secretKey));?> java:1、用hashmap存储元素,键值对方式 。Map hashMap = new HashMap(){ { put("appid", "123"); put("apikey", "456"); put("secretKey", "789"); put("timestamp","当前UNIX 时间戳,秒数,java中获取"); } };2、java中可以通过Timestamp获得UNIX 时间戳 。
3、然后对hashmap进行升序排序 。4、然后写一个方法遍历hashmap,拼接成字符串格式为apikey=456&appid=123&secretkey=789×tamp=1389379498 然后对该字符串进行encoded编码,输出格式为apikey=456&appid=123&secretkey=789*tamp=13893794985、通过java中HMAC-SHA1算法加密该字符串,$secretKey为安全密钥 。
6、再通过base64_encode加密第5步产生的字符串 。这是最终sig结果 。
文章插图
- 路中心黄色虚线属于哪一类标线 路中心黄色虚线属于哪一类型标线
- 行政管理属于公共管理类 行政管理和公共管理是一类吗
- 鱼类养殖 鱼类养殖技术
- 灯的种类 灯的种类及功能介绍
- 会计分类科目 会计分类科目怎么背
- 非诚勿扰|《非诚勿扰》已经火了12年,那些女嘉宾分为三种类型
- 复读生高考报名号 复读生高考报名考生类别怎么填
- 金属加工方法 金属加工方法主要包括哪两大类
- 手机充电接口类型 手机充电接口类型有哪些
- 氢氧化钙和二氧化碳反应化学方程式是哪种反应类型