mirror of
https://github.com/allankoechke/Bcrypt.cpp.git
synced 2026-12-02 17:04:10 +00:00
08b7801c905faa6af4bedccf50638c5141921107
Reorganize project for builds using make
Bcrypt.cpp
A C++ wrapper around bcrypt (origin: Open BSD) password hashing
How to use
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
Description
Languages
C++
85.4%
C
13.5%
CMake
1.1%