Kingdom Ablaze
Sponsor
i keep getting:
here is my rgss code:
@dll = Win32API.new('encORdec.dll', 'encORdec', ['p','p'], 'p')
here is the c++ method if you need it, im keeping it simple for now just to get it working
header
cpp
if this is all very bad, please keep in mind this is my first attempt to use c++ lol
Thanks for any help
here is my rgss code:
@dll = Win32API.new('encORdec.dll', 'encORdec', ['p','p'], 'p')
here is the c++ method if you need it, im keeping it simple for now just to get it working
header
Code:
#include <string>
using namespace std;
namespace test
{
class crypto
{
public:
static __declspec(dllexport) string encORdec(string text, string key);
};
}
Code:
#include "encORdec.h"
#include <string>
#include <stdexcept>
using namespace std;
namespace test
{
string crypto::encORdec(string text, string key)
{
string result = "";
for (int c = 0; c < text.size(); c++)
{
char character = text[c];
unsigned int charcode = (unsigned int)character;
int keypos = c % key.size();
char keychar = key[keypos];
unsigned int keycode = (unsigned int)keychar;
unsigned int combinedcode = charcode ^ keycode;
char combinedchar = (char)combinedcode;
result.append(combinedchar, 1);
}
return result;
}
}
if this is all very bad, please keep in mind this is my first attempt to use c++ lol
Thanks for any help