MD5加密工具类

public class MessageUtil
{
    
  
    public static String md5(String msg)
    {
        String ret_msg = "";
        try
        {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] input = msg.getBytes();
            byte[] output = md.digest(input);
            
            ret_msg = Base64.encodeBase64String(output);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return ret_msg;
    }
    
    public static void main(String[] args)
    {
        System.out.println(md5("123456"));

    }
    
}

  

posted @ 2021-05-28 15:52  云村的王子  阅读(83)  评论(2编辑  收藏  举报