package com.izouma.awesomeadmin.util;

import org.springframework.util.DigestUtils;

public class MD5Util {

    //md5盐值字符串，用于混淆MD5
    private static final String slat = "8J7wdFyI0qerikiL";


    /**
     * 
     * <p>生成回传验证的MD5。</p>
     * 
     * 根据source生成MD5给前台，前台返回MD5和source，用source从新生成MD5进行验证
     *
     * @param source
     * @return
     */
    public static String getMD5(String source) {

        String base = source + "/" + slat;
        String md5 = DigestUtils.md5DigestAsHex(base.getBytes());

        return md5;
    }
}
