Solved

Encrypting a CString

Posted on 2007-03-26
3
686 Views
Last Modified: 2013-12-04
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.
0
Comment
Question by:maloriopolium
3 Comments
 
LVL 1

Expert Comment

by:yogesh28577
ID: 18797850
Here is    simple technique

      char szTemp[256];
      int nIdx;

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

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

      MessageBox ( szTemp);;
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 125 total points
ID: 18798303
0
 

Author Comment

by:maloriopolium
ID: 18806429
Thanks mahesh,

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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
dog bark java program 15 95
zeroFront challenge 7 97
Use of condition with 'serial' in ansible 2 58
Making an alias 7 94
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question