|
|
@ -29,7 +29,6 @@ import java.net.URL; |
|
|
|
import java.net.URLDecoder; |
|
|
|
import java.net.URLDecoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.security.MessageDigest; |
|
|
|
|
|
|
|
import java.text.*; |
|
|
|
import java.text.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
@ -331,25 +330,6 @@ public final class StringUtil { |
|
|
|
return new String(Hex.decodeHex(s.toCharArray()), StandardCharsets.UTF_8); |
|
|
|
return new String(Hex.decodeHex(s.toCharArray()), StandardCharsets.UTF_8); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Calculates the MD5 digest and returns the value as a 32 character hex string. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param s Data to digest. |
|
|
|
|
|
|
|
* @return MD5 digest as a hex string. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static String md5Hex(String s) { |
|
|
|
|
|
|
|
if (s == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
MessageDigest md5 = MessageDigest.getInstance("MD5"); |
|
|
|
|
|
|
|
return new String(Hex.encodeHex(md5.digest(s.getBytes(StandardCharsets.UTF_8)))); |
|
|
|
|
|
|
|
} catch (Exception x) { |
|
|
|
|
|
|
|
throw new RuntimeException(x.getMessage(), x); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the file part of an URL. For instance: |
|
|
|
* Returns the file part of an URL. For instance: |
|
|
|
* <p/> |
|
|
|
* <p/> |
|
|
|