public static function Crypt::hashBase64

Calculates a base-64 encoded, URL-safe sha-256 hash.

Parameters

string $data: String to be hashed.

Return value

string A base-64 encoded sha-256 hash, with + replaced with -, / with _ and any = padding characters removed.

16 calls to Crypt::hashBase64()
ActionAddFormController::buildForm in drupal/core/modules/action/lib/Drupal/action/ActionAddFormController.php
ActionAdminManageForm::buildForm in drupal/core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php
Form constructor.
aggregator_test_feed in drupal/core/modules/aggregator/tests/modules/aggregator_test/aggregator_test.module
Page callback. Generates a test feed and simulates last-modified and etags.
ConfigurationTest::testActionConfiguration in drupal/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php
Tests configuration of advanced actions through administration interface.
Crypt::randomStringHashed in drupal/core/lib/Drupal/Component/Utility/Crypt.php
Generates a random, base-64 encoded, URL-safe, sha-256 hashed string.

... See full list

File

drupal/core/lib/Drupal/Component/Utility/Crypt.php, line 102
Contains \Drupal\Component\Utility\Crypt.

Class

Crypt
Utility class for cryptographically-secure string handling routines.

Namespace

Drupal\Component\Utility

Code

public static function hashBase64($data) {
  $hash = base64_encode(hash('sha256', $data, TRUE));

  // Modify the hash so it's safe to use in URLs.
  return strtr($hash, array(
    '+' => '-',
    '/' => '_',
    '=' => '',
  ));
}