package com.huiju.foyo.common;

import org.apache.commons.codec.digest.DigestUtils;

public class Md5Utils {

    public static String encryptionMd5(String str) {
        return DigestUtils.md5Hex(str);
    }

    /**
     * 密码比对
     * @param encrypPass 已加密
     * @param pass 未加密
     * @return
     */
    public static boolean isMd5ThanPass(String encrypPass, String pass ) {
        String encPass = encryptionMd5(pass);
        return encPass.equals(encrypPass);
    }


    public static void main(String[] args) {
        System.out.println(encryptionMd5("123456"));
        System.out.println(isMd5ThanPass("e10adc3949ba59abbe56e057f20f883e", "123456"));
    }
}
