Link to home
Start Free TrialLog in
Avatar of maloriopolium
maloriopolium

asked on

Encrypting a CString

Hi,
I want to be able to encrypt a CString. Since I am doing some application programming in MFC, I would like to use the CryptEncrypt() function. Can somebody show me how to use this function? The example in MSDN deals with encrpyting a file, but I need to just encrypt a string.
I don't need the encryption to be very complicated, just reasonably secure.

Thanks.
Avatar of yogesh28577
yogesh28577

Here is    simple technique

      char szTemp[256];
      int nIdx;

      strcpy(szTemp, "INDIA");
      
      
      nIdx = 0;

      while (szTemp[nIdx] != 0)
      {
        szTemp[nIdx] ^= 21;
        nIdx++;
      }

      MessageBox ( szTemp);;
ASKER CERTIFIED SOLUTION
Avatar of mahesh1402
mahesh1402
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maloriopolium

ASKER

Thanks mahesh,

The codeproject link looks like what I need to figure out how to use the CryptEncrypt function.