Cryptography Reference
In-Depth Information
want to avoid slowing down the software. These dead code
detection schemes, though, can also be used to identify the
worthless instructions and remove them.
Another solution is to ensure that the worthless code will al-
wayscomputesomevalueofzeroandthenaddthisresulttoa
live variable. Here's an example:
int dummy=2*live;
dummy=dummy*10;
for (int i=0;i<20;i++)
{
dummy=dummy-live;
live=live+dummy;
This code won't change the value of
live
,atleastuntilitover-
flows a 32-bit architecture.
Renaming Code rearrangement for optimization uses renam-
ing to let two different blocks of code run simultaneously even
if they happen to be using the same variable name. It's com-
mon, for instance, for many loops to use the variable
to count.
In the source code, two independent loops can be given differ-
ent names without affecting the results.
i
For fun, some
programmers run the
International
Obfuscated C Code
Contest, the Obfuscated
Perl Contest, the
International
Obfuscated Ruby Code
Contest, and the
Obfuscated PostScript
Contest.
If the goal is obfuscation, new variables can be created and in-
formation can be copied from one to the other. If two blocks of
code use variable
foo
5000 ,thenanadditionalvariable,
bar
422 ,
can be created to replace
5000 in one of the blocks if the
right copying statements are included.
foo
foo
5000 =
bar
422
should be added to the end of one block and
5000
should be added to the other. If you can be certain that one
block is always executed before the other, then you can remove
the copying statement from the second.
bar
422 =
foo
Naming The names of the actual variables can be used to en-
code information in the process of obfuscating the code— a
technique that doesn't do anything for optimization. Any of
the techniques from the text steganography Chapters such as
Chapter 6 can create variable names that encode hidden bits. If
you're programming in very prolix languages like Java that en-
courage people to give their variables names thatAreEntireSen-
tencesSeparatedByCamelCase, then you might even use vari-
able names built by grammar-based tools like the ones inChap-
ter 7 or 8.
Search WWH ::




Custom Search