浏览 3239 次
锁定老帖子 主题:一小段java代码转PHP代码,高手进
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2018-10-15
public static String getMac(String paramString1, String paramString2) { byte[] arrayOfByte1 = new byte[32]; arrayOfByte1[0] = 87; arrayOfByte1[1] = -77; arrayOfByte1[2] = 119; arrayOfByte1[3] = 94; arrayOfByte1[4] = -103; arrayOfByte1[5] = -72; arrayOfByte1[6] = -114; arrayOfByte1[7] = -108; arrayOfByte1[8] = 104; arrayOfByte1[9] = -97; arrayOfByte1[10] = -11; arrayOfByte1[11] = -84; arrayOfByte1[12] = 103; arrayOfByte1[13] = -59; arrayOfByte1[14] = -1; arrayOfByte1[15] = -21; arrayOfByte1[16] = 113; arrayOfByte1[17] = -68; arrayOfByte1[18] = -96; arrayOfByte1[19] = -57; arrayOfByte1[20] = -122; arrayOfByte1[21] = 117; arrayOfByte1[22] = 73; arrayOfByte1[24] = -16; arrayOfByte1[25] = -69; arrayOfByte1[26] = -79; arrayOfByte1[27] = -77; arrayOfByte1[28] = 80; arrayOfByte1[29] = -98; arrayOfByte1[30] = -99; arrayOfByte1[31] = 54; Object localObject = ""; try { Mac localMac = Mac.getInstance("HmacSHA256"); byte[] arrayOfByte2 = paramString2.getBytes("ASCII"); localMac.init(new SecretKeySpec(arrayOfByte1, "HMACSHA256")); localObject = toHex(localMac.doFinal(arrayOfByte2)); String str = ((String)localObject).toUpperCase(); localObject = str; return localObject; } catch (Exception localException) { while (true) localException.printStackTrace(); } } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |