You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
654 B
21 lines
654 B
package {{ package.Common }}.unit;
|
|
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
public class Md5HashUtil {
|
|
|
|
public static String getMD5Hash(byte[] input) {
|
|
try {
|
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
byte[] digest = md.digest(input);
|
|
StringBuilder sb = new StringBuilder();
|
|
for (byte b : digest) {
|
|
sb.append(String.format("%02x", b));
|
|
}
|
|
return sb.toString();
|
|
} catch (NoSuchAlgorithmException e) {
|
|
throw new RuntimeException("Could not find MD5 algorithm", e);
|
|
}
|
|
}
|
|
}
|
|
|