compile sources on customers pc

Code, algorithms, languages, construction...
Post Reply
quantum
Posts: 28
Joined: Mon Dec 19, 2011 12:19 am

compile sources on customers pc

Post by quantum » Mon Apr 02, 2012 3:14 pm

Hi

the following question came to my mind: An Engine developer wants his costumers around the world to compile his sources on their own machine in order to gain some speed. But he also wants to keep his sources secret because he wants to gain some bucks.

I wonder if there is a way to accomplish both aims?

Greetings

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: compile sources on customers pc

Post by kingliveson » Tue Apr 03, 2012 4:32 am

He could ask the customers to close their eyes, and/or have them promise they are not programmers or software developers. Perhaps, a non-disclosure agreement...But wait, who will provide the compiler? :lol:
PAWN : Knight >> Bishop >> Rook >>Queen

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: compile sources on customers pc

Post by hyatt » Tue Apr 03, 2012 10:53 pm

quantum wrote:Hi

the following question came to my mind: An Engine developer wants his costumers around the world to compile his sources on their own machine in order to gain some speed. But he also wants to keep his sources secret because he wants to gain some bucks.

I wonder if there is a way to accomplish both aims?

Greetings

I don't see how this would be possible. A compiler would obviously need access to the source. If a compiler can gain access to it, then a savvy user can do the same thing, even if it involves using a debugger on the compiler itself to catch it after each source line is read/decrypted...

You could write a compiler for a new language yourself, write your engine in that language (one that is nearly impossible to read), but that seems like a lot of work. And one can still take the asm produced and work back to something that is more readable if one is intent on "looking under the hood."

syzygy
Posts: 148
Joined: Sun Oct 16, 2011 4:21 pm

Re: compile sources on customers pc

Post by syzygy » Wed Apr 04, 2012 12:06 am

quantum wrote:the following question came to my mind: An Engine developer wants his costumers around the world to compile his sources on their own machine in order to gain some speed. But he also wants to keep his sources secret because he wants to gain some bucks.

I wonder if there is a way to accomplish both aims?
It depends on the level of security you want. You cannot make it impossible for the client to discover the secrets of your code, but you can make it harder.

The most straightforward way is to run the code through a code obfuscator. That will make it somewhat hard for the client to make sense out of it.

Another way would be to encrypt the source and to let the compiler decrypt it (assuming you are able to modify the compiler). However, this would be relatively easy to hack. This should probably be combined with code obfuscation (before encryption).

Yet another possibility would be to not provide the actual source code, but only a form of intermediate code. Whether this is possible depends on the level of control you have over the compiler.

It's probably safer to keep the source on the developer's machine and compile it differently for each client. There is no absolute need to compile it on the client's machine, it is sufficient to know the specs of the client's system and let a (cross-)compiler compile the code specifically for that client.

If it's a product aimed at a mass market, just compile it for a fixed set of architectures and add a script that runs the version best matching the client's specs.

HumbleProgrammer
Posts: 40
Joined: Sat Jun 19, 2010 11:00 pm
Real Name: Lee Neuse

Re: compile sources on customers pc

Post by HumbleProgrammer » Wed Apr 04, 2012 2:21 am

The idea of letting customers "self-compile" was/is very popular in Linux days of yore, when tweaking compiler flags for specific CPU architectures could get measurable performance gains. (Not necessarily large gains...but at least measurable ones.) I would offer the theory that the greatest benefit would come from recognizing the presence of "newer" technology--like intrinsic BSF or POPCNT opcodes--that are (hopefully) faster when found in microcode on the CPU than in conventional object code churned out by a compiler. If that is the case, would it be possible for a customer to only "self-compile" specific portions of the code that truly benefit from certain architectures, and leave the rest of the code nicely obfuscated as pre-compiled binaries? There's no "secret sauce" in bit-counting, so who cares if it's visible to the end consumer? Give the customer a rack of .obj files (either 32-bit or 64-bit or both) and a handful of C source files and tell them to "compile and link" with whatever compiler switches float their boats. They (& I) will happily waste hours compiling and benchmarking, all for a 1% gain in performance. Not because that really makes a difference, but because it's measurable!

Cheers!
Humble Programmer

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: compile sources on customers pc

Post by BB+ » Mon Apr 16, 2012 2:38 am

An Engine developer wants his costumers around the world to compile his sources on their own machine in order to gain some speed. But he also wants to keep his sources secret because he wants to gain some bucks.
I wonder if there is a way to accomplish both aims?
Fully homomorphic encryption would likely solve this. This essentially allows (say) cloud computing to be done on sensitive data. Probably completely impracticable at present, as the slowdown is about 250000x or something.

Post Reply