提交 a663ffb4 编写于 作者: lzc828's avatar lzc828

修改随机数

上级 6dd1eb4c
......@@ -52,7 +52,7 @@ namespace One\Swoole {
$str = $arr[0] . base_convert($arr[1], 10, 16);
$len = 32;
while (strlen($str) <= $len) {
$str .= bin2hex(base_convert(mt_rand(10000, 99999), 10, 16));
$str .= bin2hex(openssl_random_pseudo_bytes(4));
}
$str = substr($str, 0, $len);
$str = str_replace(['+', '/', '='], '', base64_encode(hex2bin($str)));
......
......@@ -57,7 +57,7 @@ namespace One\Swoole {
$str = $arr[0] . base_convert($arr[1], 10, 16);
$len = 32;
while (strlen($str) <= $len) {
$str .= bin2hex(base_convert(mt_rand(10000, 99999), 10, 16));
$str .= bin2hex(openssl_random_pseudo_bytes(4));
}
$str = substr($str, 0, $len);
$str = str_replace(['+', '/', '='], '', base64_encode(hex2bin($str)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册