Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Illuminate/Hashing/ArgonHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public function __construct(array $options = [])
*/
public function make($value, array $options = [])
{
$hash = password_hash($value, $this->algorithm(), [
$hash = @password_hash($value, $this->algorithm(), [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we want the error suppression here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, we do want it, otherwise the code bellow doesn't run always. The idea here is that we wanna have a standard interface to our hasher on both PHP 7 and PHP 8. If it fails, they we should always get a laravel exception out the other end.

'memory_cost' => $this->memory($options),
'time_cost' => $this->time($options),
'threads' => $this->threads($options),
]);

if ($hash === false) {
if (! is_string($hash)) {
throw new RuntimeException('Argon2 hashing not supported.');
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Hashing/HasherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function testBasicArgon2idHashing()
$this->assertSame('argon2id', password_get_info($value)['algoName']);
}

/**
* @depends testBasicBcryptHashing
*/
public function testBasicBcryptVerification()
{
$this->expectException(RuntimeException::class);
Expand All @@ -64,6 +67,9 @@ public function testBasicBcryptVerification()
(new BcryptHasher(['verify' => true]))->check('password', $argonHashed);
}

/**
* @depends testBasicArgon2iHashing
*/
public function testBasicArgon2iVerification()
{
$this->expectException(RuntimeException::class);
Expand All @@ -73,6 +79,9 @@ public function testBasicArgon2iVerification()
(new ArgonHasher(['verify' => true]))->check('password', $bcryptHashed);
}

/**
* @depends testBasicArgon2idHashing
*/
public function testBasicArgon2idVerification()
{
$this->expectException(RuntimeException::class);
Expand Down