Finally fixed build output

This commit is contained in:
Laurent
2025-12-10 09:12:12 +01:00
parent cf97429ad9
commit 968f05e37b
27 changed files with 90 additions and 105 deletions

View File

@@ -0,0 +1,32 @@
package httpServer.authorization;
import org.springframework.security.crypto.bcrypt.BCrypt;
import java.util.Scanner;
public class PasswordHasher {
public static String genSalt(){
return BCrypt.gensalt(14);
}
public static String hashPassword(String password, String salt) {
return BCrypt.hashpw(password, salt);
}
public static void main(String[] args) {
System.out.print("Enter password: ");
Scanner in = new Scanner(System.in);
String password = in.nextLine();
String salt = genSalt();
String hashed = hashPassword(password, salt);
System.out.println("Hashed Password: " + hashed);
// Example of verifying a password
/*
boolean matches = BCrypt.checkpw(plainPassword, storedHash);
*/
}
}