I have downloaded https://github.com/alecgn/crypthash-net and moved it to the project's folder.This project is saved in main.cpp.
#include <CryptHash/CryptHash.h>
#include <bcrypt.h>
using namespace bcrypt;
class SecureEncryptor {
public:
static std::string hash_password(const std::string& password) {
Generate a random salt
std::string salt = generate_salt();
// Concatenate salt and password, then hash using bcrypt
std::string salted_password = salt + password;
std::string hashed_password = bcrypt::generateHash(salted_password);
// Store salt and hashed password securely in your database
return salt + hashed_password;
}
static bool verify_password(const std::string& password, const std::string& stored_password) {
// Extract salt from stored_password
std::string salt = stored_password.substr(0, BCRYPT_HASHSIZE);
// Concatenate salt and entered password, then hash using bcrypt
std::string salted_password = salt + password;
std::string hashed_password = bcrypt::generateHash(salted_password);
// Compare the hashed passwords
return stored_password == (salt + hashed_password);
}
private:
static std::string generate_salt() {
// Generate a secure random salt using bcrypt
return bcrypt::generateSalt();
}
};
Please tell me step by step to download the bcypt file and connect it to the project and mysql, Xampp