A C++ wrapper around bcrypt (origin: Open BSD) password hashing
Here an example how to use this wrapper class
#include "bcrypt.h" #include <iostream> #include <string> using namespace bcrypt; int main() { std::string password = "top_secret"; std::string hash = BCrypt::generateHash(password); std::cout << "Hash: " << hash << std::endl; std::cout << "\"" << password << "\" : " << BCrypt::validatePassword(password,hash) << std::endl; std::cout << "\"wrong\" : " << BCrypt::validatePassword("wrong",hash) << std::endl; return 0; }
output:
Hash: $2b$10$9ngimRxnytdaWoCd4NKPneEb/9dW24/B830XpS8TbExVeGKbukYbG "top_secret" : 1 "wrong" : 0
check online https://bcrypt-generator.com