Package com.lanyuan.util

Source Code of com.lanyuan.util.Md5Tool

package com.lanyuan.util;

import java.security.MessageDigest;

import sun.misc.BASE64Encoder;

public class Md5Tool {
 
  public static String getMd5(String password){
    String str = "";
    if(password !=null && !password.equals("")){
      try {
        MessageDigest md = MessageDigest.getInstance("MD5");
        BASE64Encoder base = new BASE64Encoder();
        //加密后的字符串
        str = base.encode(md.digest(password.getBytes("utf-8")));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return str;
  }

}
TOP

Related Classes of com.lanyuan.util.Md5Tool

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.