From 3f7a7df7409e177f158bdd677321e4a61eb6a440 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 27 Aug 2024 16:20:49 +0100 Subject: Deprecate the raw overload of GenRandomStr in favour of GenRandom. The raw overload was almost always misused where GenRandom would be better. While we're making changes to this code switch the printable mode to use a static array like Anope does. --- src/modules/extra/m_argon2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp index 30d3de06b..999bd7d82 100644 --- a/src/modules/extra/m_argon2.cpp +++ b/src/modules/extra/m_argon2.cpp @@ -92,7 +92,8 @@ public: std::string GenerateRaw(const std::string& data) override { - const std::string salt = ServerInstance->GenRandomStr(config.saltlen, false); + std::vector salt(config.saltlen); + ServerInstance->GenRandom(salt.data(), salt.size()); size_t encodedLen = argon2_encodedlen( config.iterations, @@ -111,8 +112,8 @@ public: config.threads, data.c_str(), data.length(), - salt.c_str(), - salt.length(), + salt.data(), + salt.size(), raw_data.data(), raw_data.size(), encoded_data.data(), -- cgit v1.3.1-10-gc9f91