function login_history_assemble_cookie in Login History 7
Assembles and signs a device ID cookie.
Parameters
string $device_id: The device id.
int $login_id: The login_history.login_id.
$salt: The salt, e.g. from drupal_get_hash_salt().
Return value
string A signed string to set in a cookie.
2 calls to login_history_assemble_cookie()
- login_history_get_device_id_from_cookie in ./
login_history.inc - Gets a device id from a login history cookie while validating authenticity.
- login_history_user_login in ./
login_history.module - Implements hook_user_login().
File
- ./
login_history.inc, line 65 - Helper functions for login_history that have no dependencies.
Code
function login_history_assemble_cookie($device_id, $login_id, $salt) {
$message = $device_id . '-' . $login_id;
return hash_hmac('sha256', $message, $salt) . '-' . $message;
}