Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/util/PhabricatorHash.php
Show All 16 Lines | final class PhabricatorHash extends Phobject { | ||||
public static function weakDigest($string, $key = null) { | public static function weakDigest($string, $key = null) { | ||||
if ($key === null) { | if ($key === null) { | ||||
$key = PhabricatorEnv::getEnvConfig('security.hmac-key'); | $key = PhabricatorEnv::getEnvConfig('security.hmac-key'); | ||||
} | } | ||||
if (!$key) { | if (!$key) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"Set a '%s' in your Phabricator configuration!", | "Set a '%s' in your configuration!", | ||||
'security.hmac-key')); | 'security.hmac-key')); | ||||
} | } | ||||
return hash_hmac('sha1', $string, $key); | return hash_hmac('sha1', $string, $key); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |