D
Delphido
Hello,
i've been programming ASP for a few years, but this time i'm lost..
I need to translate a piece of C++ code which encrypts a string into the ASP
equivalent. Can anybody give me a had with this. I have nog clue about
bit-operations etc, and don't no to much about C++ as well..
+++++++++++++++ C++ code +++++++++++++++
rstring Encrypt_String( const rstring& OrgString, const rstring& KeyString)
{
rstring Result;
unsigned char* pKey;
unsigned char Val;
unsigned char ValRes;
int LenOrg = OrgString.GetLength();
int LenKey = KeyString.GetLength();
const char* pConvert = OrgString;
for( int i=0; i< LenOrg; ++i, ++pConvert)
{
Val = *pConvert ^ KeyString[ i % LenKey];
ValRes = 'a' + ((Val >> 4) & 0x0F);
Result.add( (const char*)&ValRes, 1);
ValRes = 'a' + (Val & 0x0F);
Result.add( (const char*)&ValRes, 1);
}
return Result;
}
++++++++++++++++++++++++++++++++++++++
i've been programming ASP for a few years, but this time i'm lost..
I need to translate a piece of C++ code which encrypts a string into the ASP
equivalent. Can anybody give me a had with this. I have nog clue about
bit-operations etc, and don't no to much about C++ as well..
+++++++++++++++ C++ code +++++++++++++++
rstring Encrypt_String( const rstring& OrgString, const rstring& KeyString)
{
rstring Result;
unsigned char* pKey;
unsigned char Val;
unsigned char ValRes;
int LenOrg = OrgString.GetLength();
int LenKey = KeyString.GetLength();
const char* pConvert = OrgString;
for( int i=0; i< LenOrg; ++i, ++pConvert)
{
Val = *pConvert ^ KeyString[ i % LenKey];
ValRes = 'a' + ((Val >> 4) & 0x0F);
Result.add( (const char*)&ValRes, 1);
ValRes = 'a' + (Val & 0x0F);
Result.add( (const char*)&ValRes, 1);
}
return Result;
}
++++++++++++++++++++++++++++++++++++++