Files
TwoFactorAuth/tests/Providers/Rng/TestRNGProvider.php
T
Nicolas CARPi d1792f07d1 remove insecure rng providers
and remove the openssl provider. We now rely exclusively on
random_bytes(), as there are no reasons not to. Fix #121
2024-04-15 23:28:45 +02:00

29 lines
492 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Providers\Rng;
use RobThree\Auth\Providers\Rng\IRNGProvider;
class TestRNGProvider implements IRNGProvider
{
public function __construct(private readonly bool $isSecure = false)
{
}
/**
* {@inheritdoc}
*/
public function getRandomBytes(int $bytecount): string
{
$result = '';
for ($i = 0; $i < $bytecount; $i++) {
$result .= chr($i);
}
return $result;
}
}