简体   繁体   English

在 Botan 上使用 Argon2 生成 hash 会导致垃圾数据和 0xC0000005:访问冲突读取位置 0x0000000100000000

[英]Generating hash with Argon2 on Botan results in garbage data and 0xC0000005: Access violation reading location 0x0000000100000000

I'm trying to hash passwords using the C++ cryptography library Botan.我正在尝试使用 hash 密码使用 C++ 密码库 Botan。 I've tried testing out the library using the code below:我尝试使用以下代码测试该库:

#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";
}

but the code either printed garbage data, or gave me a runtime error: Unhandled exception at 0x00007FFEF11825E0 (ucrtbased.dll) in app.exe: 0xC0000005: Access violation reading location 0x0000000100000000.但代码要么打印垃圾数据,要么给我一个运行时错误: Unhandled exception at 0x00007FFEF11825E0 (ucrtbased.dll) in app.exe: 0xC0000005: Access violation reading location 0x0000000100000000.

What should I do?我应该怎么办? Using other hashing methods such as Botan::generate_bcrypt() also resulted in the same error.使用 Botan::generate_bcrypt() 等其他散列方法也会导致相同的错误。

After 4 hours of painful troubleshooting and rebuilding the library with different compilers over and over, I have found out that Botan does not work properly if "solution configuration" is not set to "Release" rather than "Debug" in Visual Studio.经过 4 小时痛苦的故障排除和一遍又一遍地使用不同的编译器重建库后,我发现如果 Visual Studio 中的“解决方案配置”未设置为“发布”而不是“调试”,Botan 无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM