/** * Generate hash on user info and password * * @param string $userInfo User name, email, etc * @param string $password * @return string */ private function generateHash($userInfo, $password) { // mitigate rainbow table attack $passwordLen = strlen($password) / 2; $hash = Common::hash($userInfo . substr($password, 0, $passwordLen) . SettingsPiwik::getSalt() . substr($password, $passwordLen)); return $hash; }
private function generateCommandId($command) { return substr(Common::hash($command . microtime(true) . rand(0, 99999)), 0, 100); }
/** * Hashes a string. By default generates an MD5 hash. * * Derived classes can override this to provide a different hashing implementation. * * @param string $data The data to hash. * @return string */ protected function hashData($data) { return Common::hash($data); }