You are here

public static function CryptConnector::createDerivedKey in Acquia Connector 3.x

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

Derive a key for the solr hmac using a salt, id and key.

Parameters

string $salt: Salt.

string $id: Acquia Subscription ID.

string $key: Acquia Subscription Key.

Return value

string Derived Key.

File

src/CryptConnector.php, line 98

Class

CryptConnector
Class CryptConnector.

Namespace

Drupal\acquia_connector

Code

public static function createDerivedKey($salt, $id, $key) {
  $derivation_string = $id . 'solr' . $salt;
  return hash_hmac('sha1', str_pad($derivation_string, 80, $derivation_string), $key);
}