mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-08 14:36:13 +00:00
perf: replace /dev/urandom | tr with openssl rand to fix CPU spike (#3887)
This commit is contained in:
5
x-ui.sh
5
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() {
|
||||
|
||||
Reference in New Issue
Block a user