/** * To create hash of a string using dynamic and static salt. * @param string $pass password in plain-text * @param string $dynamicSalt dynamic salt * @param string $algo The algorithm used to calculate hash * @return string final hash */ protected static function hashPassword($pass, $dynamicSalt = "", $algo = "") { if ($algo == "") { $algo = BasicPasswordManagement::$hashAlgo; } return hash($algo, strtolower($dynamicSalt . $pass . BasicPasswordManagement::getStaticSalt())); }
/** * To check if we can retrieve the static salt. */ public function testGetStaticSalt() { $this->assertTrue(strlen(BasicPasswordManagement::getStaticSalt()) > 1); }