[ Index ] |
PHP Cross Reference of Phabricator |
[Source view] [Print] [Project Stats]
Provides a mechanism for hashing passwords, like "iterated md5", "bcrypt", "scrypt", etc. Hashers define suitability and strength, and the system automatically chooses the strongest available hasher and can prompt users to upgrade as soon as a stronger hasher is available.
File Size: | 431 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
verifyPassword(PhutilOpaqueEnvelope $password,PhutilOpaqueEnvelope $hash) X-Ref |
Verify that a password matches a hash. The default implementation checks for equality; if a hasher embeds salt in hashes it should override this method and perform a salt-aware comparison. param: PhutilOpaqueEnvelope Password to compare. param: PhutilOpaqueEnvelope Bare password hash. return: bool True if the passwords match. |
canUpgradeInternalHash(PhutilOpaqueEnvelope $hash) X-Ref |
Check if an existing hash created by this algorithm is upgradeable. The default implementation returns `false`. However, hash algorithms which have (for example) an internal cost function may be able to upgrade an existing hash to a stronger one with a higher cost. param: PhutilOpaqueEnvelope Bare hash. return: bool True if the hash can be upgraded without |
getPasswordHashForStorage(PhutilOpaqueEnvelope $envelope) X-Ref |
Get the hash of a password for storage. param: PhutilOpaqueEnvelope Password text. return: PhutilOpaqueEnvelope Hashed text. |
parseHashFromStorage(PhutilOpaqueEnvelope $hash) X-Ref |
Parse a storage hash into its components, like the hash type and hash data. return: map Dictionary of information about the hash. |
getAllHashers() X-Ref |
Get all available password hashers. This may include hashers which can not actually be used (for example, a required extension is missing). return: list<PhabicatorPasswordHasher> Hasher objects. |
getAllUsableHashers() X-Ref |
Get all usable password hashers. This may include hashers which are not desirable or advisable. return: list<PhabicatorPasswordHasher> Hasher objects. |
getBestHasher() X-Ref |
Get the best (strongest) available hasher. return: PhabicatorPasswordHasher Best hasher. |
getHasherForHash(PhutilOpaqueEnvelope $hash) X-Ref |
Get the hashser for a given stored hash. return: PhabicatorPasswordHasher Corresponding hasher. |
canUpgradeHash(PhutilOpaqueEnvelope $hash) X-Ref |
Test if a password is using an weaker hash than the strongest available hash. This can be used to prompt users to upgrade, or automatically upgrade on login. return: bool True to indicate that rehashing this password will improve |
generateNewPasswordHash(PhutilOpaqueEnvelope $password) X-Ref |
Generate a new hash for a password, using the best available hasher. param: PhutilOpaqueEnvelope Password to hash. return: PhutilOpaqueEnvelope Hashed password, using best available |
comparePassword(PhutilOpaqueEnvelope $password,PhutilOpaqueEnvelope $hash) X-Ref |
Compare a password to a stored hash. param: PhutilOpaqueEnvelope Password to compare. param: PhutilOpaqueEnvelope Stored password hash. return: bool True if the passwords match. |
getCurrentAlgorithmName(PhutilOpaqueEnvelope $hash) X-Ref |
Get the human-readable algorithm name for a given hash. param: PhutilOpaqueEnvelope Storage hash. return: string Human-readable algorithm name. |
getBestAlgorithmName() X-Ref |
Get the human-readable algorithm name for the best available hash. return: string Human-readable name for best hash. |
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |