You are here

function _drupal_hmac_base64 in Node.js integration 6

1 call to _drupal_hmac_base64()
nodejs_generate_content_token in ./nodejs.module
Generate a token for a piece of content.

File

./nodejs.module, line 673

Code

function _drupal_hmac_base64($data, $key) {
  $hmac = base64_encode(hash_hmac('sha256', $data, $key, TRUE));

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