diff options
| author | 2024-08-27 16:20:49 +0100 | |
|---|---|---|
| committer | 2024-08-27 16:31:38 +0100 | |
| commit | 3f7a7df7409e177f158bdd677321e4a61eb6a440 (patch) | |
| tree | c0aa2641655d40fb497007f5c705e40a072f87a4 /include | |
| parent | Use GenRandom instead of GenRandomInt to populate Bcrypt entropy. (diff) | |
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.
Diffstat (limited to 'include')
| -rw-r--r-- | include/inspircd.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index e1b166a1b..c7364f7a8 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -290,12 +290,19 @@ public: */ unsigned long GenRandomInt(unsigned long max) const; + /** Generates a human readable random string. + * @param length The length in bytes. + * @return A random string of \p length bytes. + */ + std::string GenRandomStr(size_t length) const; + /** Generates a random string. * @param length The length in bytes. * @param printable Whether to only return printable characters. * @return A random string of \p length bytes. */ - std::string GenRandomStr(size_t length, bool printable = true) const; + [[deprecated("Use GenRandomStr(length) or GenRandom(buf, len) instead")]] + std::string GenRandomStr(size_t length, bool printable) const; /** Retrieves a 64k buffer used to read socket data into. */ inline auto* GetReadBuffer() { return readbuffer; } |
