diff --git a/modules/random/random.php b/modules/random/random.php index 00a5f40..49867dc 100644 --- a/modules/random/random.php +++ b/modules/random/random.php @@ -2,7 +2,7 @@ $len = $_GET['length'] ?? 32; -$contains = isset($_GET['contains']) ? explode(',', $_GET['contains']) : ['digit', 'upper', 'lower', 'special']; +$contains = isset($_GET['contains']) ? explode(',', $_GET['contains']) : ['hex', 'digit', 'upper', 'lower', 'special']; header('Content-Type: text/plain'); diff --git a/modules/random/random_help.php b/modules/random/random_help.php index 4923311..a2870d3 100644 --- a/modules/random/random_help.php +++ b/modules/random/random_help.php @@ -13,6 +13,10 @@ return [ [ 'name' => 'Change length', 'path' => '/?length=20' + ], + [ + 'name' => 'Only hex', + 'path' => '/?length=16&contains=hex' ] ], 'append' => function () { diff --git a/utils.php b/utils.php index ed66647..15a690f 100644 --- a/utils.php +++ b/utils.php @@ -5,7 +5,8 @@ function generateRandomString($length = 10, $contains = ['upper', 'lower', 'digi 'digit' => '0123456789', 'lower' => 'abcdefghijklmnopqrstuvwxyz', 'upper' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - 'special' => '!#$%&()*+,-.:;<=>?@[]' + 'special' => '!#$%&()*+,-.:;<=>?@[]', + 'hex' => '0123456789abcdef' ]; $characters = ''; foreach ($contains as $c) {