Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/util/password/PhabricatorPasswordHasher.php
Show First 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | /* -( Using Hashers )------------------------------------------------------ */ | ||||
/** | /** | ||||
* Get the human-readable algorithm name for a given hash. | * Get the human-readable algorithm name for a given hash. | ||||
* | * | ||||
* @param PhutilOpaqueEnvelope Storage hash. | * @param PhutilOpaqueEnvelope Storage hash. | ||||
* @return string Human-readable algorithm name. | * @return string Human-readable algorithm name. | ||||
*/ | */ | ||||
public static function getCurrentAlgorithmName(PhutilOpaqueEnvelope $hash) { | public static function getCurrentAlgorithmName(PhutilOpaqueEnvelope $hash) { | ||||
$raw_hash = $hash->openEnvelope(); | $raw_hash = $hash->openEnvelope(); | ||||
if (!strlen($raw_hash)) { | if (!phutil_nonempty_string($raw_hash)) { | ||||
return pht('None'); | return pht('None'); | ||||
} | } | ||||
try { | try { | ||||
$current_hasher = self::getHasherForHash($hash); | $current_hasher = self::getHasherForHash($hash); | ||||
return $current_hasher->getHumanReadableName(); | return $current_hasher->getHumanReadableName(); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$info = self::parseHashFromStorage($hash); | $info = self::parseHashFromStorage($hash); | ||||
Show All 21 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0