function PermissionsHashGenerator::hash

Same name in other branches
  1. 9 core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::hash()
  2. 8.9.x core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::hash()
  3. 10 core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::hash()

Hashes the given string.

Parameters

string $identifier: The string to be hashed.

Return value

string The hash.

1 call to PermissionsHashGenerator::hash()
PermissionsHashGenerator::generate in core/lib/Drupal/Core/Session/PermissionsHashGenerator.php
Generates a hash that uniquely identifies a user's permissions.

File

core/lib/Drupal/Core/Session/PermissionsHashGenerator.php, line 93

Class

PermissionsHashGenerator
Generates and caches the permissions hash for a user.

Namespace

Drupal\Core\Session

Code

protected function hash($identifier) {
    return hash('sha256', $this->privateKey
        ->get() . Settings::getHashSalt() . $identifier);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.