Compare commits

..

2 Commits

Author SHA1 Message Date
6880dd513e add password encode tests 2022-01-05 00:03:17 +08:00
f76ffb4c02 add password encode tests 2022-01-05 00:03:10 +08:00
3 changed files with 45 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
{ {
"java": "15", "java": "1.8",
"builder": { "builder": {
"name": "maven", "name": "maven",
"version": "3.8.4" "version": "3.8.4"

21
pom.xml
View File

@@ -16,7 +16,7 @@
</parent> </parent>
<properties> <properties>
<java.version>15</java.version> <java.version>8</java.version>
</properties> </properties>
<dependencies> <dependencies>
@@ -36,9 +36,26 @@
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-openid</artifactId> <artifactId>spring-security-openid</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
</dependencies> </dependencies>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@@ -0,0 +1,25 @@
package me.hatter.sample.tests;
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.LdapShaPasswordEncoder;
import org.springframework.security.crypto.password.Md4PasswordEncoder;
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
public class TestPasswordEncoder {
public static void main(String[] args) {
Argon2PasswordEncoder argon2PasswordEncoder = new Argon2PasswordEncoder();
System.out.println(argon2PasswordEncoder.encode("hello"));
SCryptPasswordEncoder sCryptPasswordEncoder = new SCryptPasswordEncoder();
System.out.println(sCryptPasswordEncoder.encode("hello"));
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
System.out.println(bCryptPasswordEncoder.encode("hello"));
Pbkdf2PasswordEncoder pbkdf2PasswordEncoder = new Pbkdf2PasswordEncoder();
System.out.println(pbkdf2PasswordEncoder.encode("hello"));
LdapShaPasswordEncoder ldapShaPasswordEncoder = new LdapShaPasswordEncoder();
System.out.println(ldapShaPasswordEncoder.encode("hello"));
Md4PasswordEncoder md4PasswordEncoder = new Md4PasswordEncoder();
System.out.println(md4PasswordEncoder.encode("hello"));
}
}