user3000234
user3000234

Reputation: 11

Hide char array from reverse engineer

Looking for the easiest way to hide char* from reverse engineer. Doesn't have to be strong encryption, but something simple. It has to happen in header, and here is my code:

#pragma once
const char * pw = "test";
#define PASS pw;

where PASS is used in the source.

I already tried reverse string and hex to text and vice versa but didn't succeed. Someone please post some easy solution for this.

Edit: This is just an example. The user will not input anything, I only have to hide a char pointer from debugger. What is the best way to do that?

Upvotes: 1

Views: 738

Answers (2)

Bert
Bert

Reputation: 2244

You could store the XOR value of the password, and then XOR the user input to compare. Refer to this answer for the code.

Then the problem becomes someone can run a debugger or dis-assembler to reveal what your program is doing when it checks the password.

Upvotes: 0

MikeMB
MikeMB

Reputation: 21156

The standard way would be to store only the hash of your string (computed offline and outside the code) in the code and to hash any user input with which you want to compare it during runtime and then compare the hashes instead of the plain passwords

Upvotes: 2

Related Questions