function _openid_dh_xorsecret

7.x openid.inc _openid_dh_xorsecret($shared, $secret)
6.x openid.inc _openid_dh_xorsecret($shared, $secret)
3 calls to _openid_dh_xorsecret()
OpenIDTestCase::testOpenidDhXorsecret in drupal-7.x/modules/openid/openid.test
Test _openid_dh_xorsecret().
openid_association in drupal-7.x/modules/openid/openid.module
Attempt to create a shared secret with the OpenID Provider.
_openid_test_endpoint_associate in drupal-7.x/modules/openid/tests/openid_test.module
OpenID endpoint; handle "associate" requests (see OpenID Authentication 2.0, section 8).

File

drupal-7.x/modules/openid/openid.inc, line 513
OpenID utility functions.

Code

function _openid_dh_xorsecret($shared, $secret) {
  $dh_shared_str = _openid_dh_long_to_binary($shared);
  $sha1_dh_shared = sha1($dh_shared_str, TRUE);
  $xsecret = "";
  for ($i = 0; $i < strlen($secret); $i++) {
    $xsecret .= chr(ord($secret[$i]) ^ ord($sha1_dh_shared[$i]));
  }

  return $xsecret;
}