how to obfuscate C programs
use really strange identifier names like
"aaaaa"
also go for names that are the opposite of what they're meant for
or thematic names
or human names
play with scope and try to repeat a name as often as possible
arr[3]
is equivalent to
3[arr]
put code inside comments
sneak in octal numbers beginning with
0
semicolons can go in so many places
pointer arithmetic, eg
"str"+1
obfuscate the numbers, eg
(unix)["have"]+"fun"-0x60 (just "fun"+1 ==> "un")
multidimensional arrays?
+++
and
---
are actually
(++) +
and
(--) -
in a loop incrementing i, making the condition
"string"[i]
loops the length of
"string"
when using strings as numbers, put code in the string for extra confusion
write a simple program and then break it down into chaos
use digraphs and trigraphs
->
use numbers that look like letters, and vice versa
you don't need to declare/initialize with a type
K&R-style declarations list parameter names, and then their types:
#include <stdio.h> int foo(a, b) int a; char b; { printf("Hello, world!\n"); }
the comma operator evaluates
a
in
(a, b)
and then evals and returns
b
use predefined variables like
"unix"