test: Add 8 and update 14 files
This commit is contained in:
21
testing/test_bcrypt.cpp
Normal file
21
testing/test_bcrypt.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user