Calculates a base-64 encoded, URL-safe sha-256 hash.
$data: String to be hashed.
A base-64 encoded sha-256 hash, with + replaced with -, / with _ and any = padding characters removed.
function drupal_hash_base64($data) {
$hash = base64_encode(hash('sha256', $data, TRUE));
// Modify the hash so it's safe to use in URLs.
return strtr($hash, array(
'+' => '-',
'/' => '_',
'=' => '',
));
}