Supported Versions: PHP 5 >= 5.5.0, PHP 7, PHP 8
Returns information about the given hash
<?php password_get_info(string $hash): array
<?php public function info($hashedValue)
{
return password_get_info($hashedValue);
}
<?php $this->assertTrue($hasher->check('password', $value));
$this->assertFalse($hasher->needsRehash($value));
$this->assertTrue($hasher->needsRehash($value, ['rounds' => 1]));
$this->assertSame('bcrypt', password_get_info($value)['algoName']);
$this->assertGreaterThanOrEqual(12, password_get_info($value)['options']['cost']);
$this->assertTrue($this->hashManager->isHashed($value));
}
<?php $this->assertFalse($hasher->needsRehash($value));
$this->assertTrue($hasher->needsRehash($value, ['rounds' => 1]));
$this->assertSame('bcrypt', password_get_info($value)['algoName']);
$this->assertGreaterThanOrEqual(12, password_get_info($value)['options']['cost']);
$this->assertTrue($this->hashManager->isHashed($value));
}
<?php $this->assertTrue($hasher->check('password', $value));
$this->assertFalse($hasher->needsRehash($value));
$this->assertTrue($hasher->needsRehash($value, ['threads' => 1]));
$this->assertSame('argon2i', password_get_info($value)['algoName']);
$this->assertTrue($this->hashManager->isHashed($value));
}
<?php $this->assertTrue($hasher->check('password', $value));
$this->assertFalse($hasher->needsRehash($value));
$this->assertTrue($hasher->needsRehash($value, ['threads' => 1]));
$this->assertSame('argon2id', password_get_info($value)['algoName']);
$this->assertTrue($this->hashManager->isHashed($value));
}
<?php ]);
$this->assertTrue(password_verify('password', $subject->password));
$this->assertSame('2y', password_get_info($subject->password)['algo']);
$this->assertSame(13, password_get_info($subject->password)['options']['cost']);
$this->assertDatabaseHas('hashed_casts', [
'id' => $subject->id,
<?php $this->assertTrue(password_verify('password', $subject->password));
$this->assertSame('2y', password_get_info($subject->password)['algo']);
$this->assertSame(13, password_get_info($subject->password)['options']['cost']);
$this->assertDatabaseHas('hashed_casts', [
'id' => $subject->id,
'password' => $subject->password,
<?php ]);
$this->assertTrue(password_verify('password', $subject->password));
$this->assertSame('argon2i', password_get_info($subject->password)['algo']);
$this->assertSame(1234, password_get_info($subject->password)['options']['memory_cost']);
$this->assertSame(2, password_get_info($subject->password)['options']['threads']);
$this->assertSame(7, password_get_info($subject->password)['options']['time_cost']);
<?php $this->assertTrue(password_verify('password', $subject->password));
$this->assertSame('argon2i', password_get_info($subject->password)['algo']);
$this->assertSame(1234, password_get_info($subject->password)['options']['memory_cost']);
$this->assertSame(2, password_get_info($subject->password)['options']['threads']);
$this->assertSame(7, password_get_info($subject->password)['options']['time_cost']);
$this->assertDatabaseHas('hashed_casts', [
<?php $this->assertTrue(password_verify('password', $subject->password));
$this->assertSame('argon2i', password_get_info($subject->password)['algo']);
$this->assertSame(1234, password_get_info($subject->password)['options']['memory_cost']);
$this->assertSame(2, password_get_info($subject->password)['options']['threads']);
$this->assertSame(7, password_get_info($subject->password)['options']['time_cost']);
$this->assertDatabaseHas('hashed_casts', [
'id' => $subject->id,
<?php $this->assertSame('argon2i', password_get_info($subject->password)['algo']);
$this->assertSame(1234, password_get_info($subject->password)['options']['memory_cost']);
$this->assertSame(2, password_get_info($subject->password)['options']['threads']);
$this->assertSame(7, password_get_info($subject->password)['options']['time_cost']);
$this->assertDatabaseHas('hashed_casts', [
'id' => $subject->id,
'password' => $subject->password,