bacol89 / libbcrypt

A c++ wrapper around bcrypt password hashing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libbcrypt

A c++ wrapper around bcrypt password hashing

How to build this

This is a CMake based project:

git clone https://github.com/trusch/libbcrypt
cd libbcrypt
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig

How to use this

Here an example how to use this wrapper class (you can find a slightly edited example in src/ subdirectory)

#include "bcrypt/BCrypt.hpp"
#include <iostream>

int main(){
	std::string password = "test";
	std::string hash = bcrypt.generateHash(password);

	std::cout << BCrypt::validatePassword(password,hash) << std::endl;
	std::cout << BCrypt::validatePassword("test1",hash) << std::endl;

	return 0;
}

build this with something like this:

g++ --std=c++11 -lbcrypt main.cpp

About

A c++ wrapper around bcrypt password hashing

License:MIT License


Languages

Language:C 86.0%Language:Assembly 5.5%Language:C++ 4.7%Language:CMake 3.7%