You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
589 B
23 lines
589 B
1 year ago
|
#include <iostream>
|
||
|
#include <string>
|
||
|
#include <bcrypt.h>
|
||
|
using namespace std;
|
||
|
using namespace bcrypt;
|
||
|
|
||
|
int main() {
|
||
|
// 用户输入的原始密码
|
||
|
string password = "userPassword123";
|
||
|
|
||
|
// 使用cpp-bcrypt生成盐和哈希
|
||
|
// bcrypt::generate_salt(); // 生成一个随机盐
|
||
|
// string salt = bcrypt::get_salt();
|
||
|
|
||
|
// 使用盐和密码生成哈希
|
||
|
// string hashed_password;
|
||
|
// bcrypt::hashpw(password.c_str(), salt.c_str(), hashed_password);
|
||
|
|
||
|
// 打印生成的哈希值
|
||
|
// cout << "Generated bcrypt hash: " << hashed_password << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|