Generate request hash

@param string $authTicket
@param string $request

@return int
486766
protected function generateRequestHash(string $authTicket, string $request) : int
    {
        $seed = (unpack("J", pack("H*", xxhash64($authTicket, 0x1B845238))))[1];
        return (unpack("J", pack("H*", xxhash64($request, $seed))))[1];
    }
1262635
public function createManyToOne($request, $match)
    {
        $parent = Pluf_Shortcuts_GetObjectOr404('Tenant_Ticket', $match['parentId']);
        $object = new Tenant_Comment();
        $form = Pluf_Shortcuts_GetFormForModel($object, $request->REQUEST);
        $object = $form->save(false);
        $object->ticket_id = $parent;
        $object->author_id = $request->user;
        $object->create();
        return $object;
    }
512223
private function authHeader(Request $request) {
		if ($request->headers->has('authorization')) {
			$auth = $request->headers->get('authorization');
			if (!empty($auth)) {
				list(, $token) = explode(' ', $auth);
				if (empty($token)) {
					return null;
				}
				return $this->authToken($token);
			}
		}
		return null;
	}
893384
public function generateToken(ServerRequest $request)
    {
        if ($request->is('requested')) {
            if ($this->session->check('_Token')) {
                $request = $request->withParam('_Token', $this->session->read('_Token'));
            }

            return $request;
        }
        $token = [
            'allowedControllers' => $this->_config['allowedControllers'],
            'allowedActions' => $this->_config['allowedActions'],
            'unlockedFields' => $this->_config['unlockedFields'],
        ];

        $this->session->write('_Token', $token);

        return $request->withParam('_Token', [
            'unlockedFields' => $token['unlockedFields']
        ]);
    }
1276768
public function requestToken(Request $request)
    {
        $client = $this->getClient($request);
        $user   = $this->getUser($request);

        $accessToken = $this->accessTokenManager->createWithExpirationDate($client, $user);
        if (!$accessToken->isValid($this->validator)) {
            return $accessToken->getViolations();
        }
        $this->accessTokenManager->save($accessToken);

        $tokenFacade = new AccessTokenFacade();
        $tokenFacade->accessToken  = $accessToken->getCode();
        $tokenFacade->expiresAt    = $accessToken->getExpiredAt();
        $tokenFacade->refreshToken = $accessToken->getRefreshCode();

        return $tokenFacade;
    }
276405
public static function generateTokenHash($host, $uri, $token, $secret)
    {
        $m0 = static::$tokenHashMagics[ord(substr($secret, -1, 1)) % 4];
        $m1 = static::$tokenHashMagics[ord(substr($secret, -2, 1)) % 4];
        $m2 = static::$tokenHashMagics[ord(substr($secret, -3, 1)) % 4];
        $m3 = static::$tokenHashMagics[ord(substr($secret, -4, 1)) % 4];

        $sha1 = sha1(
                $m0
                . $host
                . $m1
                . $uri
                . $m2
                . $token
                . $m3
                . $secret
        );

        return substr($sha1, 3, 4)
                . substr($sha1, 33, 4)
                . substr($sha1, 17, 4)
                . substr($sha1, 25, 4);
    }
1060048
public static function authQueryString($authKey, $accessToken, $request = null)
    {
        return HashHelper::hash($request ? $request->getParam($authKey) : Lb::app()->getParam($authKey)) == $accessToken;
    }
1120253
protected function throttleKey(Request $request)
    {
        return Str::lower($request->input($this->username())).'|'.$request->ip();
    }
1139207
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
    {
        // If authentication was successful, redirect to the current URI with
        // the ticket parameter removed so that it is hidden from end-users.
        if ($request->query->has($this->query_ticket_parameter)) {
            return new RedirectResponse($this->removeCasTicket($request->getUri()));
        } else {
            return null;
        }
    }
627404
public function get($method, array $parameters = [], $authRequired = false)
    {
        $method = str_replace('_', '.', $method);
        return $this->doRequest($method, $parameters, $authRequired);
    }
744481
public function getVaryKey(array $vary, Request $request)
    {
        if (0 === \count($vary)) {
            return self::NON_VARYING_KEY;
        }

        sort($vary);

        $hashData = '';

        foreach ($vary as $headerName) {
            $hashData .= $headerName.':'.$request->headers->get($headerName);
        }

        return hash('sha256', $hashData);
    }
219089
private function authBasic(Request $request) {
		$user = $this->findUser($request->getUser());
		if ($user !== null && $this->verifyUser($user, $request->getPassword())) {
			$session = $this->findSession($user);
			if ($session === null) {
				$session = $this->createSession($user);
			}
			$this->authenticated = true;

			return $session;
		}
		return null;
	}
944687
protected function generateTH($thData, $attributes = array())
    {
        $thData = strtoupper(str_replace("_", " ", $thData->getName()));
        return $this->generateElement('th', $attributes, $thData, true);
    }
496768
private function authCookie(Request $request) {
		if ($request->cookies->has(self::COOKIE_TOKEN_NAME)) {
			$token = $request->cookies->get(self::COOKIE_TOKEN_NAME);
			return $this->authToken($token);
		}
		return null;
	}
1126600
public function start(Request $request, AuthenticationException $authException = null)
    {
        return $this->httpUtils->createRedirectResponse($request, $this->loginPath);
    }
190607
public static function getScriptToken($request)
    {
        // Check for script authorizing token in request parameters.
        $token = $request->query('script_token');
        if (empty($token)) {
            // Check for script token in request HEADER.
            $token = $request->header('X_DREAMFACTORY_SCRIPT_TOKEN');
        }
        if (empty($token)) {
            // Check for script token in request payload.
            $token = $request->input('script_token');
        }

        return $token;
    }
668258
private function addAuthenticationHeaders(Request $request) {
        $client = $request->getClient();

        // Get a GMT/UTC timestamp
        $timestamp = gmdate('Y-m-d\TH:i:s\Z');

        // Build the data to base the hash on
        $data = $request->getMethod() . '|' .
                $request->getUrl() . '|' .
                $client->getConfig('publicKey') . '|' .
                $timestamp;

        // Generate signature
        $signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));

        // Add relevant request headers (overwriting once that might already exist)
        $request->setHeader('X-Imbo-Authenticate-Signature', $signature);
        $request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
    }