Commit bbe25bea authored by 张永's avatar 张永

1

parent 0167d5e7
......@@ -17,6 +17,28 @@ import java.util.TreeMap;
public class MD5Util {
private final static Logger logger = LoggerFactory.getLogger(MD5Util.class);
public static String createSign_allowNull(String characterEncoding,SortedMap<Object,Object> parameters){
StringBuffer sb = new StringBuffer();
Set<?> es = parameters.entrySet();//所有参与传参的参数按照accsii排序(升序)
Iterator<?> it = es.iterator();
while(it.hasNext()) {
Entry<?, ?> entry = (Entry<?, ?>)it.next();
String k = (String)entry.getKey();
Object v = entry.getValue();
if( !"sign".equals(k) ) {
sb.append(k + "=" + v + "&");
}
}
sb.deleteCharAt(sb.length()-1);
System.out.println("签名的字符串:"+sb.toString());
logger.info("签名的字符串: {}",sb.toString());
String sign = MD5Encode(sb.toString(), characterEncoding).toUpperCase();
return sign;
}
/**
* 签名算法sign
* @param characterEncoding
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment