From e8d387e520f321b32d17fa39e3835151b9735820 Mon Sep 17 00:00:00 2001 From: neru Date: Sat, 11 Apr 2026 12:12:54 -0300 Subject: [PATCH] feat: add randomizeString --- src/unlocker/utils.cpp | 10 ++++++++++ src/unlocker/utils.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/unlocker/utils.cpp b/src/unlocker/utils.cpp index 71c53c6..4ab8a31 100644 --- a/src/unlocker/utils.cpp +++ b/src/unlocker/utils.cpp @@ -12,3 +12,13 @@ std::string utils::getExePath() if (pos != std::string::npos) return path.substr(0, pos + 1); return ""; } + +std::string utils::randomizeString(size_t length) +{ + const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + std::string result; + result.resize(length); + for (size_t i = 0; i < length; ++i) + result[i] = charset[rand() % (sizeof(charset) - 1)]; + return result; +} \ No newline at end of file diff --git a/src/unlocker/utils.h b/src/unlocker/utils.h index e71e638..4c821a9 100644 --- a/src/unlocker/utils.h +++ b/src/unlocker/utils.h @@ -5,4 +5,5 @@ namespace utils { std::string getExePath(); + std::string randomizeString(size_t length); } \ No newline at end of file