Re: code transformations? (Torben AEgidius Mogensen)
29 Sep 1996 23:44:14 -0400

          From comp.compilers

Related articles
code transformations? (1996-09-22)
Re: code transformations? (1996-09-23)
Re: code transformations? (Charles Fiterman) (1996-09-23)
Re: code transformations? (1996-09-25)
Re: code transformations? (Darius Blasband) (1996-09-26)
Re: code transformations? (1996-09-26)
Re: code transformations? (1996-09-26)
Re: code transformations? (1996-09-29)
Re: code transformations? (Norman Culver) (1996-09-29)
Re: code transformations? (1996-10-03)
Re: code transformations? (Henry Dan Lambright) (1996-10-20)
Re: code transformations? hogan@rintintin.Colorado.EDU (1996-10-24)
Re: code transformations? (1996-10-24)
| List of all articles for this month |

From: (Torben AEgidius Mogensen)
Newsgroups: comp.compilers
Date: 29 Sep 1996 23:44:14 -0400
Organization: Department of Computer Science, U of Copenhagen
References: 96-09-094
Keywords: tools

Tom Lord wrote:

> ... This got me to thinking -- suitably
> sophisticated transformations could preserve the semantics of the
> program, while completely disguising the text of the source. This has
> obvious implications for anyone into intellectual property theft.
> So the question is, has anybody written such a program? Will anyone?
> Would releasing such a program on the net be like the SATAN of IP?
> [There are certainly C obfuscators, but the ones I know of perform primarily
> lexical smooshing. -John]

Automatic code transformation for various purposes are well-known and
used for functional languages like Scheme. These include partial
evaluators (which optimize a program based on partial knowledge of the
input) and continuation-passing style (CPS) transformers. Both of
these can make a program quite different in structure from the
original. CPS, in particular, will make the program completely
unrecognizable to anyone who doesn't understand the CPS style. If the
two methods are combined (as they sometimes are) the result is only
recognizable by preserving the names of some functions. If these are
renamed and the definitions of functions are re-ordered (as well as
their parameters) I doubt anyone will be able to recognize the code.

Even though partial evaluators exist for subsets of C, they are not
capable of handling anything approaching 'real' applications without
extensive manual rewriting, which somehow defeats the abovestated
purpose. For C programs I would think a better approach would be to
make a back-end for e.g. GCC which produce code for a 'machine' in
which the instructions are actually C statements. Or even better,
FORTRAN statements to make it even harder to even consider that it is
the same program. Obviously, you would have a hard time convincing
anyone that you actually wrote this code by hand.

Torben Mogensen (

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.