fix Makefile and README.md for 2012/zeitak
Rename the obfuscated source.
This commit is contained in:
1 parent
46da66b3f7
commit
84fad51c65
3 files changed
+93
-90
No files matched your search
@@ -168,11 +168,11 @@ ENTRY= zeitak
|
|||||||
PROG= ${ENTRY}
|
PROG= ${ENTRY}
|
||||||
#
|
#
|
||||||
OBJ= ${PROG}.o
|
OBJ= ${PROG}.o
|
||||||
DATA=
|
DATA= incorrect.c
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ= ${PROG}_deobfucate.o
|
ALT_OBJ= ${PROG}.alt.o
|
||||||
ALT_TARGET= ${PROG}_deobfucate
|
ALT_TARGET= ${PROG}.alt
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
@@ -189,7 +189,7 @@ all: data ${TARGET}
|
|||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
${PROG}_deobfucate: ${PROG}_deobfucate.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+89
-86
@@ -1,40 +1,44 @@
|
|||||||
# Balanced use of obfuscation - Gold award
|
# Balanced use of obfuscation - Gold award
|
||||||
|
|
||||||
Adar Zeitak
|
Adar Zeitak
|
||||||
<aa4z2@walla.co.il>
|
<aa4z2@walla.co.il>
|
||||||
|
|
||||||
## To build:
|
# To build:
|
||||||
|
|
||||||
make all
|
```sh
|
||||||
|
make
|
||||||
### To run
|
```
|
||||||
|
|
||||||
make zeitak
|
|
||||||
|
|
||||||
### To run:
|
### To run:
|
||||||
|
|
||||||
./zeitak < file.c
|
```sh
|
||||||
|
./zeitak < file.c
|
||||||
|
```
|
||||||
|
|
||||||
where file.c is the file to be checked for nesting errors. For example, you may
|
where file.c is the file to be checked for nesting errors. For example, you may
|
||||||
try incorrect.c and the program itself.
|
try incorrect.c and the program itself.
|
||||||
|
|
||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
./zeitak < zeitak.c
|
```sh
|
||||||
./zeitak < incorrect.c
|
./zeitak < zeitak.c
|
||||||
|
./zeitak < incorrect.c
|
||||||
|
```
|
||||||
|
|
||||||
### Alternate code
|
### Alternate code
|
||||||
|
|
||||||
An alternate version of this entry, `zeitak\_deobfucate.c`, is provided.
|
An alternate version of this entry, `zeitak.alt.c`, is provided.
|
||||||
The file `zeitak\_deobfucate.c` provides a version that has been slightly
|
The file `zeitak.alt.c` provides a version that has been slightly
|
||||||
deobfuscated. You may find reading that file helpful in your attempt
|
deobfuscated. You may find reading that file helpful in your attempt
|
||||||
to understand this extremely subtle entry.
|
to understand this extremely subtle entry.
|
||||||
|
|
||||||
To compile this alternate version:
|
To compile this alternate version:
|
||||||
|
|
||||||
make alt
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
Use `zeitak\_deobfucate.c` as you would `zeitak` above.
|
Use `zeitak.alt` as you would `zeitak` above.
|
||||||
|
|
||||||
## Judges' comments
|
## Judges' comments
|
||||||
|
|
||||||
@@ -47,80 +51,79 @@ just to understand 18 key characters of this code.
|
|||||||
|
|
||||||
## Author's comments
|
## Author's comments
|
||||||
|
|
||||||
### Nesting Errors Detector
|
### Nesting Errors Detector
|
||||||
|
|
||||||
#### What does it do
|
#### What does it do
|
||||||
|
|
||||||
As you have probably understood by looking at the source\*, this program has
|
As you have probably understood by looking at the source\*, this program has
|
||||||
something to do with parenthesis (and equality of opening and closing
|
something to do with parenthesis (and equality of opening and closing
|
||||||
parenthesis, if you look close enough). It goes over the file given to it and
|
parenthesis, if you look close enough). It goes over the file given to it and
|
||||||
checks that every opening (, [, or { has a matching closing one and
|
checks that every opening (, [, or { has a matching closing one and
|
||||||
vice versa. It also checks that every " or ' is closed.
|
vice versa. It also checks that every " or ' is closed.
|
||||||
|
|
||||||
If an error is detected, an error message will be printed. If the problem
|
If an error is detected, an error message will be printed. If the problem
|
||||||
is a superfluous closing bracket, it will even print a few characters
|
is a superfluous closing bracket, it will even print a few characters
|
||||||
around it's position.
|
around it's position.
|
||||||
|
|
||||||
* Make sure you view the source with 4 spaces tab width.
|
* Make sure you view the source with 4 spaces tab width.
|
||||||
|
|
||||||
#### Features
|
#### Features
|
||||||
|
|
||||||
* Ignores parenthesis inside strings or character constants, so no errors
|
* Ignores parenthesis inside strings or character constants, so no errors
|
||||||
will be detected in the following line:
|
will be detected in the following line:
|
||||||
|
|
||||||
printf(")");
|
printf(")");
|
||||||
|
|
||||||
* Doesn't get confused by the 1984/anonymous entry!
|
* Doesn't get confused by the 1984/anonymous entry!
|
||||||
|
|
||||||
#### Mis-Features
|
#### Mis-Features
|
||||||
|
|
||||||
* Escapes (e.g. `\"`) are ignored, so the following line will produce
|
* Escapes (e.g. `\"`) are ignored, so the following line will produce
|
||||||
an error:
|
an error:
|
||||||
|
|
||||||
printf("\"");
|
printf("\"");
|
||||||
|
|
||||||
#### Obfuscation
|
#### Obfuscation
|
||||||
|
|
||||||
IOCCC winners already contain entries without digits, control-flow
|
IOCCC winners already contain entries without digits, control-flow
|
||||||
keywords and certain operators in their source. This entry has an
|
keywords and certain operators in their source. This entry has an
|
||||||
even more limited source, that is:
|
even more limited source, that is:
|
||||||
|
|
||||||
* Without any digits.
|
* Without any digits.
|
||||||
* Without any character constants.
|
* Without any character constants.
|
||||||
* Without using functions from headers other than stdio.
|
* Without using functions from headers other than stdio.
|
||||||
* Without any control-flow keywords (not even the ?: operator).
|
* Without any control-flow keywords (not even the ?: operator).
|
||||||
* Without any arithmetic or logic operators!
|
* Without any arithmetic or logic operators!
|
||||||
|
|
||||||
So, what's left? Parenthesis, and lots of them, as looking at the source will
|
So, what's left? Parenthesis, and lots of them, as looking at the source will
|
||||||
reveal immediately. The main obfuscation is building the whole algorithm using
|
reveal immediately. The main obfuscation is building the whole algorithm using
|
||||||
only function calls, typecasts, array lookups and pointer operators.
|
only function calls, typecasts, array lookups and pointer operators.
|
||||||
|
|
||||||
Additional obfuscations include:
|
Additional obfuscations include:
|
||||||
|
|
||||||
* Extensive reuse of identifiers: Macros share names with variables, inner
|
* Extensive reuse of identifiers: Macros share names with variables, inner
|
||||||
curly braces scopes contain variables with names identical to those in the
|
curly braces scopes contain variables with names identical to those in the
|
||||||
outer scopes and some of the variables have different uses in different
|
outer scopes and some of the variables have different uses in different
|
||||||
parts of the program. Even the large array has more than one use.
|
parts of the program. Even the large array has more than one use.
|
||||||
* A complicated data structure with "unused" fields.
|
* A complicated data structure with "unused" fields.
|
||||||
* Mostly one-letter identifiers.
|
* Mostly one-letter identifiers.
|
||||||
* Complex recursion: A function might call itself once, twice, or not at all.
|
* Complex recursion: A function might call itself once, twice, or not at all.
|
||||||
|
|
||||||
#### Compilation/Running Notes
|
#### Compilation/Running Notes
|
||||||
|
|
||||||
* The program requires `char` to be one byte and pointers to be
|
* The program requires `char` to be one byte and pointers to be
|
||||||
at least two bytes long.
|
at least two bytes long.
|
||||||
|
|
||||||
* The program was tested on the following platforms:
|
* The program was tested on the following platforms:
|
||||||
|
|
||||||
** Ubuntu 9.04 32-bit with GCC
|
** Ubuntu 9.04 32-bit with GCC
|
||||||
** Windows 7 32-bit with GCC
|
** Windows 7 32-bit with GCC
|
||||||
** Windows 7 32-bit with OpenWatcom
|
** Windows 7 32-bit with OpenWatcom
|
||||||
|
|
||||||
|
## Copyright:
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
<!--
|
|
||||||
(c) Copyright 1984-2015, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
(c) Copyright 1984-2015, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||||
|
|
||||||
[judges]: http://www.ioccc.org/judges.html
|
[judges]: http://www.ioccc.org/judges.html
|
||||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
-->
|
|
||||||
File renamed without changes.
Reference in new issue
Block a user