![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/speedtest/results/ |
Upload File : |
<?php define('ID_OBFUSCATION_SALT_FILE', __DIR__.'/idObfuscation_salt.php'); /** * @return string|int */ function getObfuscationSalt() { if (!file_exists(ID_OBFUSCATION_SALT_FILE)) { $bytes = openssl_random_pseudo_bytes(4); $saltData = "<?php\n\n\$OBFUSCATION_SALT = 0x".bin2hex($bytes).";\n"; file_put_contents(ID_OBFUSCATION_SALT_FILE, $saltData); } if ( file_exists(ID_OBFUSCATION_SALT_FILE) && is_readable(ID_OBFUSCATION_SALT_FILE) ) { require ID_OBFUSCATION_SALT_FILE; } return isset($OBFUSCATION_SALT) ? $OBFUSCATION_SALT : 0; } /** * This is a simple reversible hash function I made for encoding and decoding test IDs. * It is not cryptographically secure, don't use it to hash passwords or something! * * @param int|string $id * @param bool $dec * * @return int|string */ function obfdeobf($id, $dec) { $salt = getObfuscationSalt() & 0xFFFFFFFF; $id &= 0xFFFFFFFF; if ($dec) { $id ^= $salt; $id = (($id & 0xAAAAAAAA) >> 1) | ($id & 0x55555555) << 1; $id = (($id & 0x0000FFFF) << 16) | (($id & 0xFFFF0000) >> 16); return $id; } $id = (($id & 0x0000FFFF) << 16) | (($id & 0xFFFF0000) >> 16); $id = (($id & 0xAAAAAAAA) >> 1) | ($id & 0x55555555) << 1; return $id ^ $salt; } /** * @param int $id * * @return string */ function obfuscateId($id) { return str_pad(base_convert(obfdeobf($id + 1, false), 10, 36), 7, 0, STR_PAD_LEFT); } /** * @param string $id * * @return int */ function deobfuscateId($id) { return obfdeobf(base_convert($id, 36, 10), true) - 1; }