0

C++ 暗号化ライブラリ Botan を使用してパスワードをハッシュしようとしています。以下のコードを使用してライブラリをテストしてみました。

#include <iostream>
#include <string>
#include <botan/argon2.h>
#include <botan/system_rng.h>

int main() {
    Botan::System_RNG rng;
    std::string password = "cool_password";

    std::string generated_hash = Botan::argon2_generate_pwhash(password.c_str(), 
    password.length(), rng, 1, 4000, 1); // crash occurs here

    std::cout << generated_hash << "\n";
}

しかし、コードはガベージ データを出力するか、実行時エラーを発生させました。 Unhandled exception at 0x00007FFEF11825E0 (ucrtbased.dll) in app.exe: 0xC0000005: Access violation reading location 0x0000000100000000.

私は何をすべきか?Botan::generate_bcrypt() などの他のハッシュ方法を使用しても、同じエラーが発生しました。

4

1 に答える 1