Solved

Encrypting a CString

Posted on 2007-03-26
3
683 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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:maloriopolium
Comment Utility
Thanks mahesh,

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now