From 85140018dde0774e3ab37870f310249eb73d62bc Mon Sep 17 00:00:00 2001 From: maxpozdeev Date: Thu, 8 Sep 2022 11:18:31 +0300 Subject: [PATCH] allow to select chars for randomString() --- src/includes/common.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/includes/common.php b/src/includes/common.php index a24f7b2..cc34e8e 100644 --- a/src/includes/common.php +++ b/src/includes/common.php @@ -177,9 +177,8 @@ function isValidSignature(string $signature, string $id, string $key, string $sa } -function randomString(int $len = 16) : string +function randomString(int $len = 16, string $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string { - $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $a = []; $max = strlen($chars) - 1; for ($i = 0; $i < $len; $i++) {