You are here

function _urllogin_inthash in urllogin 6

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

$i: Integer to generate hash string.

Return value

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 21
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_inthash($i) {
  $s = hash('sha256', $i & 0x7fffffff, TRUE);
  return ord($s[0]) << 24 | ord($s[1]) << 16 | ord($s[2]) << 8 | ord($s[3]);
}