![JAR search and dependency download from the Maven repository](/logo.png)
com.github.levkoposc.SecurityTools Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtools Show documentation
Show all versions of jtools Show documentation
JTools is simple tools for Java
package com.github.levkoposc;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public final class SecurityTools{
public String md5(String st) {
MessageDigest messageDigest;
byte[] digest = new byte[0];
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(st.getBytes());
digest = messageDigest.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
BigInteger bigInt = new BigInteger(1, digest);
StringBuilder md5Hex = new StringBuilder(bigInt.toString(16));
while(md5Hex.length()<32)
md5Hex.insert(0, "0");
return md5Hex.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy