feat: 增加BCrypt加密

This commit is contained in:
dream
2022-01-20 10:26:02 +08:00
parent e34200efb4
commit 8767bd00d5
2 changed files with 555 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package cn.dev33.satoken.secure;
import org.junit.Assert;
import org.junit.Test;
/**
* @author dream.
* @className BCryptTest
* @description TODO 类描述
* @date 2022/1/20
**/
public class BCryptTest {
@Test
public void checkpwTest() {
final String hashed = BCrypt.hashpw("12345");
System.out.println(hashed);
Assert.assertTrue(BCrypt.checkpw("12345", hashed));
Assert.assertFalse(BCrypt.checkpw("123456", hashed));
}
}