You are here

function urllogin_base64enc in urllogin 6

Same name and namespace in other branches
  1. 8 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 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

$i: First Integer

$j: Second Integer

$x: Extra byte

Return value

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 113
Include file for urllogin security functions. This module is designed for easy drop-in replacement where an alternative encryption model is required.

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)), '+/=', '-_,');

  // modify to use base64url encoding
}