Impenetrable code

The impenetrable code of a computer program is a code whose comprehension is very difficult for human while remaining perfectly compilable by a computer.

Also called darkening or obfuscation , this technique of programming which goes against the usual uses, has its reasons.

It is first of all a means of protecting the investments from development of a software by techniques of generation of object code making more difficult the Retro-engineering. It consists in particular with the replacement of identifiers and mnemonic labels by labels not meaning.

But it is also a hobby of certain programmers. This leisure consists of the writing of source code whose function is difficult to determine. The use of a illegible Syntax, characteristics Semantic S little known or not very advisable of the language used or not very natural algorithms are various techniques of darkening.

The first form of darkening relates to the Object code generated at end of distribution of a program whereas the second relates to the Source code.

Some historical darkenings

Assembler

Programs eliminating all the comments from a source library and replacing all the labels (for example LOOP, RECOVERY, ERROR by ETI00001, ETI00002, ETI00003 less speaking.

More perverse alternative still: instead of bleaching the comments, to replace them by other comments which do not bring absolutely anything; for example:

LR 15, =X' 0F' One charges X' 0F' in register 15

Turbo Pascal 3

Time of Turbo Pascal 3 existed a program removing all the nonsignificant white of a source code, packing this one at a rate of 255 characters per line, and replacing all the variables per combinations of L (L lower-case) of 1 (figure 1), O (O capital letter) and 0 (figure 0). For example A:=B+C became l0O1l10O=O1ll10O0+O0O1l00ll , regarded wrongly or rightly as less readable. The need for these obfuscators came owing to the fact that Turbo Pascal 3 did not make it possible to differently distribute subroutine than in form source.

Use of a generating language of the assembler

In the Years 1960 and 70, the majority of the manufacturers used for their developments of the languages of the type PL (PL 360, PL /M, PL/C, PL/S, PL/1600…) who translated an semi-advanced source code into assembler. The applications being saleable at the time only if their source code were available, it is this code generated assembler which was placed at the disposal of the customers. Thus, an instruction like A=B+31; became:

      LR 4, B
      ADD 4, =31
      ST 4, HAS

that the customer was less inclined to modify, the more so as the following version would have obliged it to start again all its modifications. It was not about free spite, but the more one customer modified his programs, the more the remote maintenance became difficult about it for the manufacturers.

FORTRAN

C 10 I=1, NR C 10 J=1, NR 10 HAS (I, J) = (I/J) * (J/I) It takes a small moment to realize that this end of code puts quite simply of the 1 on the principal diagonal of has and of the 0 everywhere else.

Algorithmic darkening

Division in equal under-chains of a chain length N proves that N is not first. The use of a rational Expression for such a test is thus possible, although not very natural and rather slow. A proof of concept was written in Perl.

A particular form of darkening is a multilingual program which makes the same thing when carried out by different Interpréteur S or Compilateur S. There exists thus a program which is carried out indifferently interpreted by Perl and compiled out of C, and that constitutes the only interest besides.

Others

The darkening often uses recesses little tested of the implementation of a language and can sometimes contribute to the detection of bugs.

The IOCCC (International Obfuscated C Codes Contest) is the annual contest of darkening out of C. The Perl Newspaper organized contests of darkening in Perl. Some JAPH are darkenings.

Certain languages like the C, Perl and APL lend very well to the darkening. In Humble To program , Edsger Dijkstra has very hard words for the rich languages which lend themselves to such techniques and is made lawyer of more modest languages. Larry Wall affirms on the other hand that a language which would try to prohibit bad practices such as the darkening would also prevent from writing legitimate programs such as the Uniligne S.

References

Appendices

See too

External bonds

  • darkening by the Technical “mongueurs” of Perl

  • Unilignes Perl
  • of obfuscation: to protect the source code against the reverse engineering
  • obfuscator: the obfuscator at Preemptive
  • International Obfuscated Ruby Codes Contest
  • Unilignes Perl
  • The Humble To program

Random links:Lobo (comics) | Castle of Bran | Amar Ammour | Chaîne folds back Inter | Sebastien Bruzzese | Attaque_de_suicide