Falcon::get_hash PHP Method

get_hash() public static method

Uses a HMAC rather than a straight hash to avoid vulnerabilities.
See also: http://benlog.com/articles/2008/06/19/dont-hash-secrets/
See also: http://blog.jcoglan.com/2012/06/09/why-you-should-never-use-hash-functions-for-message-authentication/
public static get_hash ( integer $post_id, WP_User $user, $site_id ) : string
$post_id integer Post ID
$user WP_User User object
return string Verification hash (10 characters long)
    public static function get_hash($post_id, $user, $site_id)
    {
        return hash_hmac('sha1', $post_id . '|' . $site_id . '|' . $user->ID, 'bbsub_reply_by_email');
    }

Usage Example

Ejemplo n.º 1
0
 public function is_valid()
 {
     $user = $this->get_user();
     return $this->nonce === Falcon::get_hash($this->post, $user, $this->site);
 }
All Usage Examples Of Falcon::get_hash