add fulcrm_crypto_check_object_id_hmac

master
Marek Isalski 9 years ago
parent 743f6ce8fd
commit 2bb12ade50

@ -34,6 +34,11 @@ function fulcrm_crypto_object_id_hmac( $object_type, $object_id ) {
return drupal_hmac_base64( 'fulcrm:' . strval( $object_id ) . ':' . $object_type, session_id() . drupal_get_hash_salt() );
}
function fulcrm_crypto_check_object_id_hmac( $object_type, $object_id, $hmac ) {
$real_hmac = fulcrm_crypto_object_id_hmac( $object_type, $object_id );
return hash_equals( $real_hmac, $hmac );
}
function fulcrm_crypto_object_id_form_value( $object_type, $object_id ) {
return $object_id . ':' . fulcrm_crypto_object_id_hmac( $object_type, $object_id );
}

Loading…
Cancel
Save