You are here

function _openid_dh_binary_to_long in Drupal 7

Same name and namespace in other branches
  1. 6 modules/openid/openid.inc \_openid_dh_binary_to_long()
3 calls to _openid_dh_binary_to_long()
OpenIDTestCase::testConversion in modules/openid/openid.test
Test _openid_dh_XXX_to_XXX() functions.
_openid_dh_base64_to_long in modules/openid/openid.inc
_openid_dh_rand in modules/openid/openid.inc

File

modules/openid/openid.inc, line 478
OpenID utility functions.

Code

function _openid_dh_binary_to_long($str) {
  $bytes = array_merge(unpack('C*', $str));
  $n = 0;
  foreach ($bytes as $byte) {
    $n = _openid_math_mul($n, pow(2, 8));
    $n = _openid_math_add($n, $byte);
  }
  return $n;
}