You are here

function urllogin_inthash in urllogin 8

Same name and namespace in other branches
  1. 2.x urllogin_security.inc \urllogin_inthash()

Converts integer to 4-character string containing hashed values.

The characters contain 8-bit binary values rather than normal characters. If integer is greater than a 32 bit value, only the lower 32 bits are used.

Parameters

int $i: Integer to generate hash string.

Return value

string Four byte string of characters, each capable of 256 possible values.

2 calls to urllogin_inthash()
urllogin_decrypt in ./urllogin_security.inc
Decrypts a pair of integers.
urllogin_encrypt in ./urllogin_security.inc
Encrypts a pair of integers.

File

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

Code

function urllogin_inthash($i) {
  $s = hash('sha256', $i & 0x7fffffff, TRUE);
  return ord($s[0]) << 24 | ord($s[1]) << 16 | ord($s[2]) << 8 | ord($s[3]);
}