Files
ioccc/2015/burton/obfuscation.md
Cody Boone Ferguson 1ac055fa85 Reword the recent deobfuscation changes
In most cases the word was changed to 'obfuscation' as it was about
obfuscation, not deobfuscation. In some cases like 1995/leo since the
file was (in 1995/leo) about a secret switch it was changed to
'secret.md' (and 'secret.html') but there were others like that as well.

One entry had the words 'spoiling the size rule' but this had been
changed to 'deobfuscating the size rule' which was obviously wrong.

In the latter YYYY/README.md files the judges had written after some
entries (brief summaries) '...

    ...We'll stop spouting spoilers now. Have fun exploring all the
    entries!

but that was changed to:

    ...We'll stop spouting deobfuscation information now. Have fun
    exploring all the entries!

which wasn't really about deobfuscation but just a brief summary of what
the entries did.

And in the most problematic case (at least for me :-), 2018/ferguson) I
had put a joke in:

    ... but it's the only Easter egg I won't spoil

but it was changed to 'won't deobfuscate' which not only is not what it
is but it spoilt the joke.

In some cases the word was changed back to 'SPOILER' (or similar) but in
most cases not. I believe it should be better now. There are some
caveats, however, as below.

Although make find_missing_links is okay I do not remember if this will
catch links that refer to '%%REPO_URL%%' or other pandoc tokens. This
means I might have to go back to some earlier years to verify links are
okay. That should not take that much time I hope.

It might also be that some wording can still be improved some but it is
hoped this will be discovered when checking links and looking over the
manifest (which obviously changed).
2024-07-04 09:03:45 -07:00

2.2 KiB

Deobfuscation

calc is a recursive-descent parser. It allocates from the stack deep enough that all expressions are exhausted before the recursion stack depth reaches the allocations. The memory map and source is documented in src.doc.txt. Tokens are encoded using values 0-20, where 0 is an invalid token, 1 is minus, 2 is space, 3 is plus, etc. The necessary constants are derived at the start of the program, using the guarantee that globals are initialized to zero; so a correct NULL pointer is obtained from an uninitialized global pointer variable, and the integers from uninitialized global int variables. If x is a global int, then !x is 1, and the derivation proceeds from there, using some identities that are confusingly similar and interestingly combined (increasing obfuscation):

    obc    clr
    ---    ---
    -~x    x+1
    ~-x    x-1
    y-~x   y+x+1

The derived constants are a compromise between simple expressions, maximum utility, and minimum number of variables used.

Command line arguments are copied into the upper half of the input buffer, separated by a space. This allows the code to have a single input parser by using a pointer-to-func to either getchar(3) if live, or a getchar(3) simulator.

A small amount of obfuscation comes from void functions declared int, but missing return. This is necessary to allow these functions in ternary ?: expressions and paired with && and ||; but the requisite returns would add symbol count at no benefit to obscurity or functionality. Function decomposition was mostly chosen to avoid curly braces: if a for-loop required multiple statements, the body became a new function. Last, but not least: sharing state via global variables is an ancient and honored form of obfuscation, and remarkably effective.


Jump to: top