You are here

function urllogin_base64enc in urllogin 8

Same name and namespace in other branches
  1. 6 urllogin_security.inc \urllogin_base64enc()
  2. 7 urllogin_security.inc \urllogin_base64enc()
  3. 2.x urllogin_security.inc \urllogin_base64enc()

Converts a pair of integers.

Converts a pair of integers plus an extra byte into a base64url encoded string. If integer is greater than a 32 bit value, only the lower 32 bits are used.

Parameters

int $i: First Integer.

int $j: Second Integer.

string $x: Extra byte.

Return value

string Return base64url encoded string which will be 11 characters long since the '=' is stripped off the end.

1 call to urllogin_base64enc()
urllogin_encode in ./urllogin_security.inc
Encodes a user ID into an encoded url string.

File

./urllogin_security.inc, line 112
Include file for urllogin security functions.

Code

function urllogin_base64enc($i, $j, $x) {
  return strtr(base64_encode(chr($i >> 24 & 0xff) . chr($i >> 16 & 0xff) . chr($i >> 8 & 0xff) . chr($i & 0xff) . chr($j >> 24 & 0xff) . chr($j >> 16 & 0xff) . chr($j >> 8 & 0xff) . chr($j & 0xff) . chr($x & 0xff)), '+/=', '-_,');
}