protected function decrypt($encryptedText,$key)
    {
        $secretKey = $this->hextobin(md5($key));
        $initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
        $encryptedText=$this->hextobin($encryptedText);
        $openMode = @mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');
        @mcrypt_generic_init($openMode, $secretKey, $initVector);
        $decryptedText = @mdecrypt_generic($openMode, $encryptedText);
        $decryptedText = rtrim($decryptedText, "\0");
        @mcrypt_generic_deinit($openMode);
        return $decryptedText;

    }
protected function decrypt($encryptedText,$key)
    {
        $secretKey = $this->hextobin(md5($key));
        $initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
        $encryptedText=$this->hextobin($encryptedText);
        $openMode = @mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');
        @mcrypt_generic_init($openMode, $secretKey, $initVector);
        $decryptedText = @mdecrypt_generic($openMode, $encryptedText);
        $decryptedText = rtrim($decryptedText, "\0");
        @mcrypt_generic_deinit($openMode);
        return $decryptedText;

    }
protected function decrypt ( $ encryptedText , $ key ) { $ secretKey = $ this -> hextobin ( md5 ( $ key ) ) ; $ initVector = pack ( "C*" , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f ) ; $ encryptedText = $ this -> hextobin ( $ encryptedText ) ; $ openMode = @ mcrypt_module_open ( MCRYPT_RIJNDAEL_128 , '' , 'cbc' , '' ) ; @ mcrypt_generic_init ( $ openMode , $ secretKey , $ initVector ) ; $ decryptedText = @ mdecrypt_generic ( $ openMode , $ encryptedText ) ; $ decryptedText = rtrim ( $ decryptedText , "\0" ) ; @ mcrypt_generic_deinit ( $ openMode ) ; return $ decryptedText ; }
CCAvenue Decrypt Function

@param $encryptedText
@param $key
@return string
CCAvenue Decrypt Function