eleme.openapi.sdk.utils.Md5Util Maven / Gradle / Ivy
package eleme.openapi.sdk.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Md5Util {
static public String Md5(String string) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ignore) {
}
md.update(string.getBytes());
byte byteData[] = md.digest();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
buffer.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
return buffer.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy