使用如下代码即可

    public static void main(String[] args) {
        String Password="admin123";
        String encryptPassword=SecurityUtils.encryptPassword(Password);
        System.out.println("密码为 == " + encryptPassword);
        String encryptPassword2="$2a$10$8OBnibwIzol6HQn/f6NbWudV41HowuUYtAN3CYi4AiQ4lTgYJ0Jhq";
        System.out.println("encryptPassword2 = " + SecurityUtils.matchesPassword(encryptPassword2, encryptPassword));
//        if (!SecurityUtils.matchesPassword(encryptPassword2, encryptPassword))
//        {
//            System.out.println(" =================== ");;
//        }

    }

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐