Reputation: 1
I'm using bcrypt
library and getting these errors:
Error LNK2019 unresolved external symbol bcrypt_gensalt referenced in function "public: static class std::basic_string,class std::allocator > cdecl BCrypt::generateHash(class std::basic_string,class std::allocator > const &,int)" (?generateHash@BCrypt@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV23@H@Z)
Error LNK2019 unresolved external symbol bcrypt_hashpw referenced in function "public: static class std::basic_string,class std::allocator > cdecl BCrypt::generateHash(class std::basic_string,class std::allocator > const &,int)" (?generateHash@BCrypt@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV23@H@Z)
Here's my test code:
#include <iostream>
#include "bcrypt/BCrypt.hpp"
BCrypt bcrypt;
using namespace std;
int main() {
string password = "test";
string hash = bcrypt.generateHash(password);
cout << bcrypt.validatePassword(password, hash) << endl;
cout << bcrypt.validatePassword("test1", hash) << endl;
}
Upvotes: 0
Views: 567
Reputation: 1
I used this code
#include <iostream>
#include "bcrypt/BCrypt.hpp"
BCrypt bcrypt;
using namespace std;
int main() {
string password = "test";
string hash = bcrypt.generateHash(password);
cout << bcrypt.validatePassword(password, hash) << endl;
cout << bcrypt.validatePassword("test1", hash) << endl;
}
Upvotes: 0