C Code Obfuscation Tutorials

I'm fascinated by how people obfuscate their code (mostly C) (examples here: http://ioccc.org/ ) and would like to learn different methods for the same thing. I was told about the book Obfuscated C and Other Mysteries, but I cannot get this book. Are there any textbooks or books that give tips on this topic? Thanks.

+5
source share
2 answers

The best you can do is read the comments of the author of the programs on IOCCC. They describe how they manage to confuse their code. Here are a few pointers:

Short and meaningless identifiers

Because a=aaa*aa; will always be more confusing than result = value * factor;

In order to have short identifiers, obfuscators, as a rule, even #define lot of things.

Array Reverse Indexing

You just need to remember that var[3] and 3[var] equivalent.

Digraphs and Trigraphs

if(a< <:b+aa??))??<f();%>

should be less readable than:

if (a < (b+aa)) { f(); }

Related characters

Sometimes it's hard to say appart l , 1 and I or o , 0 and O For example, if you write 10l , I am sure everyone will read 101 instead.

Coding Style Guidelines

Generally speaking, just try to find good coding guidelines and try to break them all. Those documents that you can find anywhere on the Internet can help you more than most things and allow you to buy nothing.

Here are some links:

+22
source

Morwenn's answer beautifully covers syntax obfuscation. But there is one more level, and this is semantic obfuscation. Note that the Turing machine mentioned has the same processing power as any other programming language (ignoring input and output considerations). In fact, all the different calculation models have sibling models with equivalent power.

For example, the string char s[N] can be considered a mapping from indices to characters, so any string can be represented instead of a function that always produces the corresponding character when called with the specified char f(int i) index. Now read. Crazy, right?

+5
source

Source: https://habr.com/ru/post/1485934/


All Articles