Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunheng Liu <121078488+Kookiejarz@users.noreply.github.com>2026-04-01 14:59:48 +0300
committerGitHub <noreply@github.com>2026-04-01 14:59:48 +0300
commit169b216d7eba1641f46dd8ab4b64dfb8f0a5cc2f (patch)
tree6c9a7558c2fb24453d1d5eadec2f3a6c1b96dffa /x-ui.sh
parent7e6d80efa5de0990fc701d75230a9505289f9de0 (diff)
perf: replace /dev/urandom | tr with openssl rand to fix CPU spike (#3887)
Diffstat (limited to 'x-ui.sh')
-rw-r--r--x-ui.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/x-ui.sh b/x-ui.sh
index e9e2d831..e26dcce2 100644
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -243,8 +243,9 @@ reset_user() {
gen_random_string() {
local length="$1"
- local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$length" | head -n 1)
- echo "$random_string"
+ openssl rand -base64 $(( length * 2 )) \
+ | tr -dc 'a-zA-Z0-9' \
+ | head -c "$length"
}
reset_webbasepath() {