使用如下代码即可

    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

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐