chuchu123123 2017-12-04 04:06 采纳率: 0%
浏览 751

请问这个hashCode是咋算的啊? 怎么拼接也不对哦。

posttoken=af434dd07bca9f18488cb91cdc3acb3f&message=%25E5%2586%2599%25E7%259A%2584%25E4%25B8%258D%25E9%2594%2599&uid=1523682&method=reply&action=post&tid=2376784&type=terminal&ismob=1&attachment=

public void onClick(View paramView)
{
if (this.this$0.imm.isActive()) {
this.this$0.imm.hideSoftInputFromWindow(this.this$0.getCurrentFocus().getWindowToken(), 0);
}
PostActivityXin.access$102(this.this$0, Long.valueOf(System.currentTimeMillis() / 1000L));
if (Bimp.bmp.size() == 0)
{
paramView = this.this$0.message.getText().toString().trim();
if (paramView.isEmpty())
{
this.this$0.showDialog(2);
return;
}
this.this$0.fasong.setEnabled(false);
try
{
PostActivityXin.access$1100(this.this$0).put("posttoken", MD5HashUtil.hashCode(this.this$0.uid + "appTerminalPOSTReply" + "1" + paramView));
LogUtil.i("Tag", this.this$0.uid + "appTerminalPOSTReply" + "1" + paramView);
LogUtil.i("Tag", MD5HashUtil.hashCode(this.this$0.uid + "appTerminalPOSTReply" + "1" + para

下面是MD5HashUtil
public class MD5HashUtil
{
private static final String SECRET = "yuwyxiK6SR1CQueMNwFl4WEERJr4B3aQ";
private static final char[] hexChars = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70 };
private static MD5HashUtil md5 = null;
private MessageDigest md = null;

private MD5HashUtil()
throws NoSuchAlgorithmException
{}

private byte[] calculateHash(byte[] paramArrayOfByte)
{
this.md.update(paramArrayOfByte, 0, paramArrayOfByte.length);
return this.md.digest();
}

public static MD5HashUtil getInstance()
throws NoSuchAlgorithmException
{
if (md5 == null) {
md5 = new MD5HashUtil();
}
return md5;
}

public static String getParams(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.3());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (i == paramList.size() - 1) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue());
}
for (;;)
{
i += 1;
break;
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue() + "&");
}
}
Log.i("Tag", localStringBuffer.toString());
return localStringBuffer.toString();
}

public static String getSecretMD5(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.1());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (i == paramList.size() - 1) {
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue());
}
}
for (;;)
{
i += 1;
break;
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue() + "&");
}
}
}
Log.i("Tag", localStringBuffer.toString());
try
{
paramList = hashCode(hashCode(localStringBuffer.toString().trim() + "yuwyxiK6SR1CQueMNwFl4WEERJr4B3aQ"));
return paramList;
}
catch (NoSuchAlgorithmException paramList)
{
paramList.printStackTrace();
}
return null;
}

public static String getSingleSecretMD5(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.2());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + ((SortEntity)paramList.get(i)).getValue());
}
for (;;)
{
i += 1;
break;
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey());
}
}
Log.i("Tag", localStringBuffer.toString());
try
{
paramList = hashCode(localStringBuffer.toString().trim() + "871e32eb3f5c9852122c492ed39e148e");
return paramList;
}
catch (NoSuchAlgorithmException paramList)
{
paramList.printStackTrace();
}
return null;
}

public static String hashCode(String paramString)
throws NoSuchAlgorithmException
{
return getInstance().hashData(paramString.getBytes());
}

public static String hashCode(byte[] paramArrayOfByte)
throws NoSuchAlgorithmException
{
return getInstance().hashData(paramArrayOfByte);
}

public String hashData(byte[] paramArrayOfByte)
{
return hexStringFromBytes(calculateHash(paramArrayOfByte)).toLowerCase();
}

public String hexStringFromBytes(byte[] paramArrayOfByte)
{
String str = "";
int i = 0;
while (i < paramArrayOfByte.length)
{
int j = (paramArrayOfByte[i] & 0xFF) / 16;
int k = paramArrayOfByte[i];
str = str + hexChars[j] + hexChars[((k & 0xFF) % 16)];
i += 1;
}
return str;
}
}

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-12-04 04:26
    关注

    先md5再转换成16进制字符串

    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿