分享个爆破BCrypt加密的代码,这个加密还是比较常用的
<!-- 非SpringBoot项目的依赖,SpringBoot项目也能用 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.4.6</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.4.6</version>
</dependency>
修改下面的加密密码和和字典文件运行查看true的项即可
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import java.io.*;
public class DeBCrypt {
public static void main(String[] args) throws IOException {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("/Users/v/data/dict.txt")));
while (true) {
String data = br.readLine();
if (data==null) break;
boolean matches = encoder.matches(data, "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2");
System.out.println("payload : " + data + " matches : " + matches);
}
}
}
payload : admin123 matches : true