Use a high-strength generator by default, when using RandomLibAdapter

This commit is contained in:
Ben Ramsey
2018-08-12 10:01:13 -05:00
parent 0cec25689d
commit 466629a399
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ class RandomLibAdapter implements RandomGeneratorInterface
/**
* Constructs a `RandomLibAdapter` using a `RandomLib\Generator`
*
* By default, if no `Generator` is passed in, this creates a medium-strength
* By default, if no `Generator` is passed in, this creates a high-strength
* generator to use when generating random binary data.
*
* @param Generator $generator An paragonie/random-lib `Generator`
@@ -45,7 +45,7 @@ class RandomLibAdapter implements RandomGeneratorInterface
if ($this->generator === null) {
$factory = new Factory();
$this->generator = $factory->getMediumStrengthGenerator();
$this->generator = $factory->getHighStrengthGenerator();
}
}
+2 -2
View File
@@ -20,7 +20,7 @@ class RandomLibAdapterTest extends TestCase
public function testAdapterWithGeneratorDoesNotCreateGenerator()
{
$factory = Mockery::mock('overload:RandomLib\Factory');
$factory->shouldNotReceive('getMediumStrengthGenerator')
$factory->shouldNotReceive('getHighStrengthGenerator')
->getMock();
$generator = $this->getMockBuilder('RandomLib\Generator')
@@ -36,7 +36,7 @@ class RandomLibAdapterTest extends TestCase
public function testAdapterWithoutGeneratorGreatesGenerator()
{
$factory = Mockery::mock('overload:RandomLib\Factory');
$factory->shouldReceive('getMediumStrengthGenerator')
$factory->shouldReceive('getHighStrengthGenerator')
->once()
->getMock();