public function encodeString($string, $level = self::DEFAULT_ENCODING_LEVEL)
    {
        for ($i = 1; $i <= $level; $i++) {

            $cipher = $this->_ciphers[array_rand($this->_ciphers, 1)];

            $iv_size = mcrypt_get_iv_size($cipher, MCRYPT_MODE_CBC);
            $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
            $iv64 = base64_encode($iv);

            $key = $this->_generateKey();

            $crypt_string = mcrypt_encrypt(
                $cipher, $key, $string, MCRYPT_MODE_CBC, $iv
            );
            $current_string = base64_encode($crypt_string);

            $current_base = $this->_str2hex(
                "@eval(mcrypt_decrypt(\"{$cipher}\",\"".$key."\",base64_decode("
            );

            $current_string2 = 'eval("'. $current_base . $this->_str2hex('"') .
                $current_string . $this->_str2hex('"),') .
                $this->_str2hex("MCRYPT_MODE_CBC,base64_decode(\"{$iv64}\")));").
                '"' . ');';

            $string = $current_string2;
        }

        return $string;
    }
public function encodeString($string, $level = self::DEFAULT_ENCODING_LEVEL)
    {
        for ($i = 1; $i <= $level; $i++) {

            $cipher = $this->_ciphers[array_rand($this->_ciphers, 1)];

            $iv_size = mcrypt_get_iv_size($cipher, MCRYPT_MODE_CBC);
            $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
            $iv64 = base64_encode($iv);

            $key = $this->_generateKey();

            $crypt_string = mcrypt_encrypt(
                $cipher, $key, $string, MCRYPT_MODE_CBC, $iv
            );
            $current_string = base64_encode($crypt_string);

            $current_base = $this->_str2hex(
                "@eval(mcrypt_decrypt(\"{$cipher}\",\"".$key."\",base64_decode("
            );

            $current_string2 = 'eval("'. $current_base . $this->_str2hex('"') .
                $current_string . $this->_str2hex('"),') .
                $this->_str2hex("MCRYPT_MODE_CBC,base64_decode(\"{$iv64}\")));").
                '"' . ');';

            $string = $current_string2;
        }

        return $string;
    }
public function encodeString ( $ string , $ level = self :: DEFAULT_ENCODING_LEVEL ) { for ( $ i = 1 ; $ i <= $ level ; $ i ++ ) { $ cipher = $ this -> _ciphers [ array_rand ( $ this -> _ciphers , 1 ) ] ; $ iv_size = mcrypt_get_iv_size ( $ cipher , MCRYPT_MODE_CBC ) ; $ iv = mcrypt_create_iv ( $ iv_size , MCRYPT_RAND ) ; $ iv64 = base64_encode ( $ iv ) ; $ key = $ this -> _generateKey ( ) ; $ crypt_string = mcrypt_encrypt ( $ cipher , $ key , $ string , MCRYPT_MODE_CBC , $ iv ) ; $ current_string = base64_encode ( $ crypt_string ) ; $ current_base = $ this -> _str2hex ( "@eval(mcrypt_decrypt(\"{$cipher}\",\"" . $ key . "\",base64_decode(" ) ; $ current_string2 = 'eval("' . $ current_base . $ this -> _str2hex ( '"' ) . $ current_string . $ this -> _str2hex ( '"),' ) . $ this -> _str2hex ( "MCRYPT_MODE_CBC,base64_decode(\"{$iv64}\")));" ) . '"' . ');' ; $ string = $ current_string2 ; } return $ string ; }
Encodes string using random algorithm for each level

@param string $string String to be encoded
@param int    $level  Encryption level

@return string
Encodes string using random algorithm for each level