MD5用户口令加密

来源:互联网 发布:大数据建设有哪些 编辑:程序博客网 时间:2024/04/29 22:24

 /**
     * md5加密
     * @param str
     * @return the base 64 hashed string or null if MD5 is not available
     */
    public static String hashMD5String(String empid,String str){
        String tmp = null;
        try{
            MessageDigest md = MessageDigest.getInstance("DES");
            md.update(empid.getBytes());
            byte[] byteTmpe = md.digest(str.getBytes());
            BASE64Encoder b64encoder = new BASE64Encoder();
            tmp = b64encoder.encode(byteTmpe);
        }catch(Exception e){
        }
        return tmp;
    }

原创粉丝点击