21 lines
649 B
C++
21 lines
649 B
C++
#include <iostream>
|
|
#include "../src/bcrypt.hpp"
|
|
|
|
using namespace simple_object_storage;
|
|
|
|
int main() {
|
|
std::string token = "test123";
|
|
std::string hash = BCrypt::hashPassword(token, 10);
|
|
|
|
std::cout << "Token: " << token << std::endl;
|
|
std::cout << "Hash: " << hash << std::endl;
|
|
|
|
bool valid = BCrypt::verifyPassword(token, hash);
|
|
std::cout << "Verification: " << (valid ? "VALID" : "INVALID") << std::endl;
|
|
|
|
// Test with wrong password
|
|
bool invalid = BCrypt::verifyPassword("wrong", hash);
|
|
std::cout << "Wrong password: " << (invalid ? "VALID" : "INVALID") << std::endl;
|
|
|
|
return valid ? 0 : 1;
|
|
} |