package com.yxproject.start.utils;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class encryptUtil {
    private static final String ALGORITHM_NAME = "MD5";
    private static final Integer HASH_ITERATIONS = 1024;

    /**
     * Md5加盐加密
     * 加盐加密的策略非常多,根据实际业务来
     */
    public static String entryptPassword(String password,String salt) {
//        String salt = UUID.randomUUID().toString();
        Object md5Password = new SimpleHash(ALGORITHM_NAME, password, ByteSource.Util.bytes(salt), HASH_ITERATIONS);
       return md5Password.toString();
    }

}
