Reputation:
I have to deliver a small C++ software. I want to mask the headers files with some implementations (I've used expression templates) in order to make it illegible to final users so they can't modify them. I can't enclose the code in a static or dynamic library. Is there any method to mask content of header files?
Thank you!
Upvotes: 1
Views: 695
Reputation: 27365
I want to mask the headers files with some implementations (I've used expression templates) in order to make it illegible to final users so they can't modify them.
Why is it important to you that users don't modify the code?
I can't enclose the code in a static or dynamic library.
Can you give any details on the reason?
Is there any method to mask content of header files?
Not really. Header files are included textually on compilation.
You can obfuscate the code so it doesn't make any semantic sense (replacing each function name with a different number of underscores comes to mind), but if it's important to your clients that they change it, they will still be able to do so (just taking more effort to understand what you did).
Upvotes: 1
Reputation: 129344
If this is a header only implementation, aside from renaming variables and protected/private member functions to names that make little sense, there isn't much you can do (so everything is called xx, yy, aa, bb, ll l1, I, and such)
If your functionality is unique and highly valuable as source code, someone will make the effort of "unobfuscating it". If I can spend half an hour or so unobfuscating some IOCCC code and get it reasonably readable and understandable, I'm not sure what technique you would be using to make it HARDER than that (sure, the code may be larger, so it will take longer, but it's almost certainly pretty pointless).
Upvotes: 3