. */ class CFDBDeobfuscate { // Taken from http://ditio.net/2008/11/04/php-string-to-hex-and-hex-to-string-functions/ static function hexToStr($hex) { $string = ''; for ($i = 0; $i < strlen($hex) - 1; $i += 2) { $string .= chr(hexdec($hex[$i] . $hex[$i + 1])); } return $string; } static function deobfuscateHexString($hex, $key) { $hexString = CFDBDeobfuscate::hexToStr($hex); return CFDBDeobfuscate::deobfuscateString($hexString, $key); } static function deobfuscateString($string, $key) { if (function_exists('mcrypt_decrypt')) { // Although php5-mycrypt may be installed, it may not be listed in // php.ini file (like below), thus the function is not defined // extension=/usr/lib/php5/20121212/mcrypt.so return mcrypt_decrypt(MCRYPT_3DES, $key, $string, 'ecb'); } return ''; } }