X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Finspircd.h;h=b16df9d71dae41964b4ed5b3722a1708a35a1a0c;hb=63601e946e77f11835cf9cbb87c55fe41e0b12bb;hp=584a330bada2d16300bdb10a06c49614d0fb7b2e;hpb=1cf85908164d97dfa385c75b9f817905a8a75e78;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/inspircd.h b/include/inspircd.h index 584a330ba..b16df9d71 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -669,6 +669,15 @@ class CoreExport InspIRCd */ static std::string TimeString(time_t curtime, const char* format = NULL, bool utc = false); + /** Compare two strings in a timing-safe way. If the lengths of the strings differ, the function + * returns false immediately (leaking information about the length), otherwise it compares each + * character and only returns after all characters have been compared. + * @param one First string + * @param two Second string + * @return True if the strings match, false if they don't + */ + static bool TimingSafeCompare(const std::string& one, const std::string& two); + /** Begin execution of the server. * NOTE: this function NEVER returns. Internally, * it will repeatedly loop.