Here you can find the source of md5Encryption(String str)
public static String md5Encryption(String str)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.util.Base64; import java.util.Base64.Encoder; public class Main { /**/*from w w w. j ava2s .co m*/ * encrypt string with MD5 * @param str: the string needs to be encrypted * @return String: encrypted string * @throws */ public static String md5Encryption(String str) { byte[] newStr = null; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); Encoder base = Base64.getEncoder(); newStr = base.encode(md5.digest(str.getBytes("UTF-8"))); } catch (Exception e) { e.printStackTrace(); } return newStr.toString(); } }