1.winrar
2.github jd-gui
SignNatureTest.java
package com.gatewayrmb;
import java.util.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SignNatureTest{
public static String createSign(Map params, String privateKey) {
StringBuilder sb = new StringBuilder();
//韩
Map sortParams = new TreeMap(params);
for (Map.Entry entry : sortParams.entrySet()) {
String key = entry.getKey();
String value = entry.getValue().trim();
if (StringUtils.isNotEmpty(value))
sb.append("&").append(key).append("=").append(value);
}
System.out.print(sb);
String stringA = sb.toString().replaceFirst("&", "");
String stringSignTemp = stringA + privateKey;
return DigestUtils.md5Hex(stringSignTemp);
}
public static String getTimestamp(){
// int to str
int s=2;
String b=Integer.toString(s);
// String.valueOf(o)
return String.valueOf(System.currentTimeMillis());
}
public static String testTime(){
SimpleDateFormat formats = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String stamp= formats.format(new Date());
System.out.print(stamp);
return String.valueOf(stamp);
}
public static void main(String[] args){
HashMap map=new HashMap<>();
map.put("k1","values1");
map.put("k2","33");
String mykey="salt";
System.out.print("\nMD5string is: "+createSign(map,mykey));
testTime();
// System.out.print("i am replace class");
}
}
//dependency
org.apache.commons
commons-lang3
3.9
org.apache.directory.studio
org.apache.commons.codec
1.3