public static Crypt::hashBase64($data)
Calculates a base-64 encoded, URL-safe sha-256 hash.
string $data: String to be hashed.
string A base-64 encoded sha-256 hash, with + replaced with -, / with _ and any = padding characters removed.
public static function hashBase64($data) { $hash = base64_encode(hash('sha256', $data, TRUE)); // Modify the hash so it's safe to use in URLs. return str_replace(['+', '/', '='], ['-', '_', ''], $hash); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Crypt.php/function/Crypt::hashBase64/8.1.x