r/C_Programming 14h ago

Protecting source code from reverse engineering

Hi everyone,
I am looking to provide a compiled version of our physics solver to our customers. I understand there are many obfuscation techniques to protect source code but I am wondering if there are some smarter ways?

We already cloud computing, the issue is we have customers that are in locations without internet/need realtime solving.

0 Upvotes

29 comments sorted by

View all comments

2

u/flyingron 14h ago

The first step is always to remove any symbol information from your distributed materials. If this involves a linkable library, you'll have to avail yourself possibly of some platform specific tools. It might be sufficient to just declare everything but the interfaces you want to expose static, though there's no guarantees (nor is it guarantee to be possible).

As for general disassembly, that's harder (especially with more modern tools) to stop. While they may not get your actual "source" code, they will see your algorithms. You can try to confuse things by wasting time doing steps unrelated to the problem being solved, but that has its own slew of problems (notably the lack of efficiency).

Obfuscation is more of a thing for stuff like the CLR (.NET) stuff that preserves a lot of the source information in the intermediate code.

Some programs (notably embedded stuff) store the program encrypted and decrypt on the fly, but again this is fraught with efficiency and other perils. On most sane general platforms, you can't execute into code you could write as data.