yl-backend/src/test/java/com/guwan/backend/Test1.java

26 lines
650 B
Java
Raw Normal View History

2024-12-06 21:05:14 +08:00
package com.guwan.backend;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.password.PasswordEncoder;
@SpringBootTest
public class Test1 {
@Autowired
2024-12-07 23:43:03 +08:00
private PasswordEncoder passwordEncoder;
2024-12-06 21:05:14 +08:00
@Test
void test1() {
System.out.println(passwordEncoder.encode("11"));
//$2a$10$lo6ix.3XY9orNFDBEMDaJuDojHn8yfADjxxRDjUaxG1d.qkDkecJG
System.out.println(passwordEncoder.matches("11", "$2a$10$lo6ix.3XY9orNFDBEMDaJuDojHn8yfADjxxRDjUaxG1d.qkDkecJG"));
}
}