You are here

function simplenews_statistics_encoder_generate_hash in Simplenews Statistics 7

Same name and namespace in other branches
  1. 7.2 simplenews_statistics_encoder/encoder.inc \simplenews_statistics_encoder_generate_hash()

Generate a md5 hash for the given ID.

2 calls to simplenews_statistics_encoder_generate_hash()
simplenews_statistics_encoder_decode_hash in simplenews_statistics_encoder/encoder.inc
Decode a md5 hash and return an ID.
simplenews_statistics_encoder_simplenews_statistics_encode in simplenews_statistics_encoder/simplenews_statistics_encoder.module
Implements hook_simplenews_statistics_encode().

File

simplenews_statistics_encoder/encoder.inc, line 106
Encoder for IDs. Some logic borrowed from shorturl module.

Code

function simplenews_statistics_encoder_generate_hash($id, $id_key) {
  $key = variable_get('simplenews_statistics_encoder_private_key', 0);
  return drupal_substr(md5($key . $id . $id_key), 0, 10) . $id;
}