Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/util/password/PhabricatorBcryptPasswordHasher.php
Show All 32 Lines | final class PhabricatorBcryptPasswordHasher | ||||
protected function getPasswordHash(PhutilOpaqueEnvelope $envelope) { | protected function getPasswordHash(PhutilOpaqueEnvelope $envelope) { | ||||
$raw_input = $envelope->openEnvelope(); | $raw_input = $envelope->openEnvelope(); | ||||
$options = array( | $options = array( | ||||
'cost' => $this->getBcryptCost(), | 'cost' => $this->getBcryptCost(), | ||||
); | ); | ||||
$raw_hash = password_hash($raw_input, CRYPT_BLOWFISH, $options); | $raw_hash = password_hash($raw_input, PASSWORD_BCRYPT, $options); | ||||
return new PhutilOpaqueEnvelope($raw_hash); | return new PhutilOpaqueEnvelope($raw_hash); | ||||
} | } | ||||
protected function verifyPassword( | protected function verifyPassword( | ||||
PhutilOpaqueEnvelope $password, | PhutilOpaqueEnvelope $password, | ||||
PhutilOpaqueEnvelope $hash) { | PhutilOpaqueEnvelope $hash) { | ||||
return password_verify($password->openEnvelope(), $hash->openEnvelope()); | return password_verify($password->openEnvelope(), $hash->openEnvelope()); | ||||
Show All 26 Lines |