Files
izyim/app/Classes/common.php
T
Omair Saleh 2aa9ddedde large commit
2019-06-03 16:24:20 +08:00

17 lines
302 B
PHP

<?php
namespace App\Classes;
final class common
{
/**
* @param int $length
* @return string
* @throws \Exception
*/
public static function generateRandomHash(int $length = 10): string {
return substr(bin2hex(random_bytes(ceil($length / 2))), 0, $length);
}
}