function _openid_hmac

1 call to _openid_hmac()
_openid_signature in modules/openid/openid.inc
Sign certain keys in a message

File

modules/openid/openid.inc, line 454

Code

function _openid_hmac($key, $text) {
    if (strlen($key) > OPENID_SHA1_BLOCKSIZE) {
        $key = sha1($key, TRUE);
    }
    $key = str_pad($key, OPENID_SHA1_BLOCKSIZE, chr(0x0));
    $ipad = str_repeat(chr(0x36), OPENID_SHA1_BLOCKSIZE);
    $opad = str_repeat(chr(0x5c), OPENID_SHA1_BLOCKSIZE);
    $hash1 = sha1(($key ^ $ipad) . $text, TRUE);
    $hmac = sha1(($key ^ $opad) . $hash1, TRUE);
    return $hmac;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.