Home > Back-end >  A C code for great god help convert DELPHI
A C code for great god help convert DELPHI

Time:09-19

//generated ciphertext
Bool CWHEncrypt: : XorEncrypt (LPCTSTR pszSourceData, LPTSTR pszEncrypData, WORD wMaxCount)
{
//variable definition
CT2CW strSrcData (pszSourceData);
WCHAR szEncrypData [MAX_ENCRYPT_LEN + 1]=L "";

//generate keys
WORD wRandKey [ENCRYPT_KEY_LEN];
WRandKey [0]=lstrlenW (strSrcData);
For (WORD I=1; i
//steps to prepare
WORD wTempCode=0;
WORD wTimes=((wRandKey ENCRYPT_KEY_LEN [0] + 1)/ENCRYPT_KEY_LEN) * ENCRYPT_KEY_LEN;

//parameters come
ASSERT ((wTimes * 8 + 1) & lt;=wMaxCount);
If ((wTimes * 8 + 1) & gt; WMaxCount) return false.

//generated ciphertext
For (WORD I=0; i{
If (iThe else wTempCode=wRandKey ENCRYPT_KEY_LEN] [I % ^ (WORD) (rand () % 0 XFFFF);
Swprintf (szEncrypData + I * 8, L "% % 4 x 4 x", wRandKey ENCRYPT_KEY_LEN] [I %, wTempCode);
}

//character conversion
CW2CT strEncrypData (szEncrypData);
Lstrcpyn (pszEncrypData strEncrypData, wMaxCount);

return true;
}

Converted to DELPHI thank the great god
  • Related