How to encrypt a c++ source code

So i have done a project and im not willing to share it with public(it's going to be sold).
i was wondering if anyone knows how to encrypt the source code in c++ so programs such as Ollydbg etc... can't access the real code.
... but am happy to solicit help on a public forum.
What??????
@ kbw: lol so true :)
@ nima: first off it's easier for us to help you if you post the code. And secondly, if it's going to be sold, I assume you're in some company. If so, ask someone working there... If you're not willing to make it public, don't come to a public forum, and just ask some employee :)

Fuck it. this forum isn't a good place to ask anything :)
Obfuscate it IMO.

http://en.wikipedia.org/wiki/Obfuscated_code

Some are available such as:

http://3d2f.com/tags/c++/obfuscator/
http://stunnix-c-and-c-obfuscator.stunnix.qarchive.org/

@ kbw and kaduuk
The help was not apparantly solicited for the code itself.
Obfuscated code won't affect much disassemblers/decompilers...

BTW: http://www.cplusplus.com/forum/windows/25402/
Are you going to sell it to professional crackers? Why do you put so much efforts on this?
Last edited on
Thank you mgupta.
The links are very informative.
But, why do you intend to ship your code with the executable.
In that case the buyer should most probably be entitled to be able to see the source code.

Well, from the link in Bazzy's answer, it is pretty unclear if you want to secure the application or the source code.
Last edited on
Both!

I've done like 90% of the application and the only part which is left is application security.
I'm not sure how to handle it and there is no good resource for Securing C++ applications.
@ Bazzy

The website where i sell my applications meant to be for hackers/reverse engineers etc... so i can't simply sell the applications without being worried of it getting cracked!
Wait... what?

The website where i sell my applications meant to be for hackers/reverse engineers

Maybe you shouldn't be selling seemingly illegal software to a group of people of a subculture known for not giving a damn about piracy laws?

What exactly is this program anyway?
1- My software is not illegal. (It's just a File enrypter/decrypter which is technically not illegal)
2- If i had a company,I wouldn't bother selling on those type of forums. but since im a junior coder,i can't find any better market to make some cash. (yeah maybe a part-time job in Mcdonalds!)
Last edited on
1- My software is not illegal. (It's just a File enrypter/decrypter which is technically not illegal)


I think you're marketing to the wrong crowd.

Anyone that could decompile and crack your program's source could easily encrypt/decrypt files on their own, and thus wouldn't have any need for your program.

It also kind of raises a red flag that you're asking security questions about a security program you're writing. It makes me question the quality of this encrypter.
I'm not sure what's the reason of everyone changing the topic.
Just give me some hints IF YOU KNOW how to secure an application,else don't bother typing.
We are changing the topic because, apparently, what you asked is not what you want.
What you want was answered here: http://www.cplusplus.com/forum/windows/25402/
You seem to assume that a compiled program contains the original source code, but that is not the case.
However, you can always disassemble the program (which doesn't get you the source code, but you can still figure out what it is doing with some effort). There is no way to prevent that. Sure, there are executable encryptors that can make your life harder, but none of them can keep someone who is determined away.
And there will never be one that can - because in order for the program to execute, the code currently executed must exist unencrypted in memory, even if only for a tiny fraction of a second. And that is where the whole concept falls apart.

On the other hand, protecting the original source code is easy: don't give it to anyone who isn't supposed to see it.
Topic archived. No new replies allowed.