1.winrar
2.github jd-gui
http://java-decompiler.github.io/
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<String, String> params, String privateKey) {
StringBuilder sb = new StringBuilder();
//韩
Map<String, String> sortParams = new TreeMap<String, String>(params);
for (Map.Entry<String, String> 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<String, String> 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
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.directory.studio/org.apache.commons.codec -->
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.codec</artifactId>
<version>1.3</version>
</dependency>