package com.tofly.common.core.util;

import com.tofly.common.core.constant.SecurityConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author Administrator
 * @date 2019/10/10  18:28
 */
@Slf4j
public class PasswordUtil {
    public static String passwordEncode(String password){
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        log.info("用{}加密后的密码为：{}", SecurityConstants.BCRYPT+password,bCryptPasswordEncoder.encode(SecurityConstants.BCRYPT+password));
        return bCryptPasswordEncoder.encode(SecurityConstants.BCRYPT+password);
    }
}
