You are here

public static function CryptConnector::acquiaHash in Acquia Connector 8.2

Same name and namespace in other branches
  1. 8 src/CryptConnector.php \Drupal\acquia_connector\CryptConnector::acquiaHash()
  2. 3.x src/CryptConnector.php \Drupal\acquia_connector\CryptConnector::acquiaHash()

Helper function. Calculate sha1 hash.

Parameters

string $key: Acquia Subscription Key.

string $string: String to calculate hash.

Return value

string Sha1 string.

5 calls to CryptConnector::acquiaHash()
Client::hash in src/Client.php
Calculates a HMAC-SHA1 according to RFC2104.
NspiController::getCredentials in tests/modules/src/Controller/NspiController.php
Test returns subscriptions for an email.
NspiController::getSubscription in tests/modules/src/Controller/NspiController.php
Test validates an Acquia subscription.
NspiController::nspiUpdate in tests/modules/src/Controller/NspiController.php
SPI API site update.
NspiController::validateAuthenticator in tests/modules/src/Controller/NspiController.php
Test validates an Acquia authenticator.

File

src/CryptConnector.php, line 81

Class

CryptConnector
Class CryptConnector.

Namespace

Drupal\acquia_connector

Code

public static function acquiaHash($key, $string) {
  return sha1((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x5c), 64)) . pack("H*", sha1((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x36), 64)) . $string)));
}