You are here

function modr8_response_token in modr8 7

Same name and namespace in other branches
  1. 5 modr8.module \modr8_response_token()
  2. 6 modr8.module \modr8_response_token()

Generate a token for responding to a node in moderation.

Calculates a HMAC-MD5 according to RFC2104 (http://www.ietf.org/rfc/rfc2104.txt).

1 call to modr8_response_token()
modr8_response_access in ./modr8.module
Access callback.

File

./modr8.module, line 99
Easy dedicated content moderation

Code

function modr8_response_token($nid, $uid) {
  $key = md5(drupal_get_private_key() . 'modr8token');
  return bin2hex(pack("H*", md5((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x5c), 64)) . pack("H*", md5((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x36), 64)) . $nid . ':' . $key . ':' . $uid)))));
}