- var_dump: documentation ( source)
- hash_hmac: documentation ( source)
- str_repeat: documentation ( source)
- base64_encode: documentation ( source)
<?php
$key = "algjhsdiouahwergoiuawhgiouaehnrgzdfgb23523";
$hash_function = "sha256";
$i = 0;
$found = [];
while (count($found) < 2) {
$pw = base64_encode(str_repeat($i, 5));
$hash = hash_hmac($hash_function, $pw, $key);
if ($hash[0] === "\0") {
$found[] = $pw;
}
$i++;
}
var_dump($i, $found);