]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_bcrypt.cpp
Convert the ISO 8859-2 nationalchars files to codepage configs.
[user/henk/code/inspircd.git] / src / modules / m_bcrypt.cpp
index 59ee1556cd085c5f6d50d11b4bfbacc53c33c235..9f02dd74c4595d03548a023ae8f11ee340b7b8f4 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
+ *   Copyright (C) 2017-2018, 2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2014 Daniel Vassdal <shutter@canternet.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -55,15 +56,9 @@ class BCryptProvider : public HashProvider
                return Generate(data, Salt());
        }
 
-       bool Compare(const std::string& input, const std::string& hash) CXX11_OVERRIDE
+       bool Compare(const std::string& input, const std::string& hash)  CXX11_OVERRIDE
        {
-               std::string ret = Generate(input, hash);
-               if (ret.empty())
-                       return false;
-
-               if (ret == hash)
-                       return true;
-               return false;
+               return InspIRCd::TimingSafeCompare(Generate(input, hash), hash);
        }
 
        std::string ToPrintable(const std::string& raw) CXX11_OVERRIDE
@@ -95,7 +90,7 @@ class ModuleBCrypt : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Implements bcrypt hashing", VF_VENDOR);
+               return Version("Allows other modules to generate bcrypt hashes.", VF_VENDOR);
        }
 };