public class EncryptionUtil {
public String md5Encryption(String clear) throws NoSuchAlgorithmException, UnsupportedEncodingException{
MessageDigest digest = MessageDigest.getInstance("MD5");
Base64.Encoder encoder = Base64.getEncoder();
String encodeToString = encoder.encodeToString(digest.digest(clear.getBytes("utf-8")));
return encodeToString;
}
}
调用md5Encryption("******")方法即可