package com.gz.utils;

import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.SecureUtil;

/**
 * 密码utils
 * @author LiuchangLan
 * @date 2021/1/27 10:24
 */
public class PasswordUtils {

    public static String encryption(String password,String salt){
        return SecureUtil.md5(password + salt);
    }

    public static boolean verification(String inputPassword,String salt,String password){
        return encryption(inputPassword,salt).equals(password);
    }


    public static void main(String[] args) {
        String password = "123456";
        String salt = IdUtil.simpleUUID();

        System.out.println("密码:" + encryption(password,salt));
        System.out.println("盐" + salt);

        System.out.println(IdUtil.simpleUUID());
    }
}
