Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
<?php function gen_password($seed, $username, $password_resets, $m = 2147483648, $count = 10) { $results = []; $x = $seed; $a = crc32($username) % $m; for ($i = 0; $i < $count; $i++) { $x = ($a * $x + $password_resets) % $m; $results[] = $x; } return $results; } print(gen_password(0, "test", 0))

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function gen_password($seed, $username, $password_resets) { $result = 0; $x = $seed; $a = crc32($username) % PHP_INT_MAX; for ($i = 0; $i <= $password_resets; $i++) { $x = ($a * $x) % PHP_INT_MAX; $result = $x; } print($result); print(' '); $password = ''; do { $charCode = ($result % 94) + 33; $result = intdiv($result, 94); $password .= chr($charCode); } while ($result !== 0); return $password; } $pw = gen_password(3, "admin", 0); print(strlen($pw)); print(' '); print($pw);
Copy Clear