Ive been asked to convert some C++ code so that we can use it in a C# application. This snippet of code is used to decrypt a registration licence key which is embedded and passed about in configuration files.
It looks to me like encrypting the string 2 bytes (correction) at a time and for the life of me, I cant work out how to do something similar in C#.
void APIENTRY EncryptRegBuffer(LPSTR StrInput,int SizeInput,LPSTR StrOut)
{
#define SEMENTE 17
#define COMUL 37
WORD randomic=SEMENTE;
WORD *pw;
int i;
memcpy(StrOut,StrInput,SizeInput);
StrOut[SizeInput]=NULO;
pw=(WORD *) StrOut;
for(i=0; i < (SizeInput/2); ++i) {
randomic*=COMUL;
*pw+=randomic;
++pw;
}
}
Can someone advise me on the methods use to perform these kinds of operations on a string using C#?