hide source code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to know if there is anyway to hide the string variables by
simply opening it from a notepad.

string mString = "thequick";

can view easily by opening the application file from Notepad.
 
iWrite said:
I would like to know if there is anyway to hide the string variables by
simply opening it from a notepad.

string mString = "thequick";

can view easily by opening the application file from Notepad.

Well, you could always have encrypted versions of the strings in your
code, and decrypt them at runtime. There are some obfuscators which do
this for you automatically.

It won't stop anyone sufficiently determined though. I hope this isn't
a way of hard coding connection details (or other sensitive
information) in your class though - security through obscurity isn't
real security.

See http://www.pobox.com/~skeet/csharp/obfuscation.html
 
I would like to know if there is anyway to hide the string variables by
simply opening it from a notepad.

string mString = "thequick";

can view easily by opening the application file from Notepad.


One way not to have the actual strings in your compiled
program is to put only encrypted copies in your source code. Include
a decryption function in your program to decrypt the strings before
you use them.

e.g. Source code:

string mySecretMessage = "Khoor Zruog";
string myRealMessage = Decrypt(mySecretMessage);
DoSomeWork(myRealMessage);

The real text of the message will only exist at runtime, and will not
be present in the executable file on disk.

In this case the decryption function just replaces each character with
the one three places earlier in the alphabet. Pick your
encryption/decryption method depending on how secure you want your
executable file to be.


HTH

rossum


The ultimate truth is that there is no ultimate truth
 
Back
Top