Click here to Skip to main content
15,914,323 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to highlight a Check box if no caption Pin
vikas amin6-Nov-06 21:28
vikas amin6-Nov-06 21:28 
GeneralRe: How to highlight a Check box if no caption Pin
Hamid_RT7-Nov-06 4:31
Hamid_RT7-Nov-06 4:31 
AnswerRe: How to highlight a Check box if no caption Pin
Niklas L6-Nov-06 20:54
Niklas L6-Nov-06 20:54 
GeneralRe: How to highlight a Check box if no caption Pin
Niklas L6-Nov-06 21:33
Niklas L6-Nov-06 21:33 
AnswerRe: How to highlight a Check box if no caption Pin
Blake Miller7-Nov-06 3:48
Blake Miller7-Nov-06 3:48 
QuestionInserting Data in database by Atl consumer wizard [modified] Pin
With_problem6-Nov-06 16:26
With_problem6-Nov-06 16:26 
Questionwrap/hide string references Pin
Benlahrech .Dj6-Nov-06 13:39
Benlahrech .Dj6-Nov-06 13:39 
AnswerRe: wrap/hide string references Pin
Jörgen Sigvardsson6-Nov-06 14:32
Jörgen Sigvardsson6-Nov-06 14:32 
I assume you want to obfuscate the string so that it's not visible when greping through the binary for strings? You can always use XOR.

// common.h
#define XOR_KEY "%¤#\"¤%!¤12323%%3kjlkjlkl5j312l4j3#¤\"!\"#"

// stringgen.cpp
int main(int ac, char** av) {
   LPCSTR szKey = XOR_KEY;
   int k = 0;
   int s = 0;
   printf("int len = %d;\n", strlen(av[0]));
   printf("char str[] = { ");
   while(av[0][s]) {
      printf("%d", av[0][s] ^ *szKey++);
      if(!*szKey)
          szKey = XOR_KEY;
   }
   printf("};\n");
}
This small app will from the first given program argument, generate an encoded char array, and a length variable containing the length of the array. The output may for example be:
int len = 6;
char str[] = { 5, 122, 53, 21, 45, 139 };
In your app, include common.h, and put those variable declarations somewhere in your .cpp file. Then when you want to use the string, decode it using the XOR key again.
#include "common.h"
int len = 6;
char str[] = { 5, 122, 53, 21, 45, 139 };
...
LPCSTR newstr = new char[len + 1];
LPCSTR szKey = XOR_KEY; 
for(int i = 0; i < len; ++i) {
   newstr[i] = str[i] ^ *szKey++;
   if(!*szKey)
      szKey = XOR_KEY;
}

newstr[len] = 0;

At the end of this code, newstr will contain the string you passed as argument to the encoding application.

This encoding scheme works on the premise that: Charenc != Charorig ^ Key, and that Charorig = Charorig ^ Key ^ Key.

It won't help you against skilled crackers, but it will be a simple way to hide strings which you do not want to reveal for the casual "grepper".


--
Based on a True Story

AnswerRe: wrap/hide string references Pin
Michael Dunn6-Nov-06 16:07
sitebuilderMichael Dunn6-Nov-06 16:07 
AnswerRe: wrap/hide string references Pin
Benlahrech .Dj7-Nov-06 11:31
Benlahrech .Dj7-Nov-06 11:31 
QuestionCAsyncSocket - Client receives some messages but not others Pin
realius2226-Nov-06 11:24
realius2226-Nov-06 11:24 
AnswerRe: CAsyncSocket - Client receives some messages but not others Pin
Mark Salsbery6-Nov-06 12:33
Mark Salsbery6-Nov-06 12:33 
AnswerRe: CAsyncSocket - Client receives some messages but not others Pin
iserik6-Nov-06 18:06
iserik6-Nov-06 18:06 
QuestionActiveX Controls [modified] Pin
Stober6-Nov-06 11:21
Stober6-Nov-06 11:21 
QuestionMAPILogon with Groupwise Pin
yyf6-Nov-06 10:54
yyf6-Nov-06 10:54 
GeneralRe: MAPILogon with Groupwise Pin
yyf7-Nov-06 2:21
yyf7-Nov-06 2:21 
QuestionUse exisiting printing methods for Printers in Print Preview Pin
skywalkerking6-Nov-06 10:06
skywalkerking6-Nov-06 10:06 
AnswerRe: Use exisiting printing methods for Printers in Print Preview" Pin
skywalkerking6-Nov-06 10:26
skywalkerking6-Nov-06 10:26 
QuestionLinking DLL's Pin
joeller6-Nov-06 8:57
professionaljoeller6-Nov-06 8:57 
AnswerRe: Linking DLL's Pin
Mark Salsbery6-Nov-06 12:45
Mark Salsbery6-Nov-06 12:45 
GeneralRe: Linking DLL's Pin
joeller7-Nov-06 3:42
professionaljoeller7-Nov-06 3:42 
GeneralRe: Linking DLL's Pin
Mark Salsbery7-Nov-06 5:27
Mark Salsbery7-Nov-06 5:27 
GeneralRe: Linking DLL's Pin
joeller7-Nov-06 8:08
professionaljoeller7-Nov-06 8:08 
GeneralRe: Linking DLL's Pin
Mark Salsbery7-Nov-06 8:17
Mark Salsbery7-Nov-06 8:17 
AnswerRe: Linking DLL's Pin
Michael Dunn6-Nov-06 16:14
sitebuilderMichael Dunn6-Nov-06 16:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.