Merge pull request #1564 from xexyl/cdupont91-alts
Remove an alt version of 1991/cdupont
This commit is contained in:
7 files changed
+102
-164
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
cdupont
|
cdupont
|
||||||
cdupont.alt
|
cdupont.alt
|
||||||
cdupont.alt2
|
cdupont.alt2
|
||||||
cdupont.alt3
|
|
||||||
cdupont.orig
|
cdupont.orig
|
||||||
prog.orig
|
prog.orig
|
||||||
@@ -38,7 +38,7 @@ include ../../var.mk
|
|||||||
|
|
||||||
# Common C compiler warnings to silence
|
# Common C compiler warnings to silence
|
||||||
#
|
#
|
||||||
CSILENCE= -Wno-unused-label -Wno-strict-prototypes
|
CSILENCE= -Wno-unused-label -Wno-strict-prototypes -Wno-implicit-int
|
||||||
|
|
||||||
# Common C compiler warning flags
|
# Common C compiler warning flags
|
||||||
#
|
#
|
||||||
@@ -111,8 +111,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o ${PROG}.alt3.o
|
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o
|
||||||
ALT_TARGET= ${PROG}.alt ${PROG}.alt2 ${PROG}.alt3
|
ALT_TARGET= ${PROG}.alt ${PROG}.alt2
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
|||||||
+9
-10
@@ -4,9 +4,10 @@
|
|||||||
make all
|
make all
|
||||||
```
|
```
|
||||||
|
|
||||||
There are three alt versions which demonstrate a problem that the code documents
|
There are two alt versions that demonstrate a problem that the code documents
|
||||||
(as an obfuscation technique) and what the judges document so you can see what
|
(as an obfuscation technique) and what the judges document, respectively, so
|
||||||
it looks like. See [alternate code](#alternate-code) below for more details.
|
that you can see what the results are. See [alternate code](#alternate-code)
|
||||||
|
below for more details.
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
@@ -18,14 +19,13 @@ it looks like. See [alternate code](#alternate-code) below for more details.
|
|||||||
|
|
||||||
## Alternate code:
|
## Alternate code:
|
||||||
|
|
||||||
These three versions show what will happen if certain things are done that were
|
These two versions show what will happen if certain things are done that were
|
||||||
warned against: if you remove a comment and more so an unused `goto` label or if
|
warned against: if you remove a comment and more so an unused `goto` label or if
|
||||||
you beautify it. The [cdupont.alt.c](cdupont.alt.c) is the one with both the
|
you beautify it. The [cdupont.alt.c](cdupont.alt.c) is the one with both the
|
||||||
unused `goto` label and comments removed, the [cdupont.alt2.c](cdupont.alt2.c)
|
unused `goto` label and comments removed and the [cdupont.alt2.c](cdupont.alt2.c)
|
||||||
is the version that has these things removed and is also beautified and the
|
is beautified. This required changing the `s` macro to be `__FILE__` as
|
||||||
[cdupont.alt3.c](cdupont.alt3.c) is just beautified. This required changing the
|
otherwise it would read in the original code which doesn't have the
|
||||||
`s` macro to be `__FILE__` as otherwise it would read in the original code which
|
modifications.
|
||||||
doesn't have the modifications.
|
|
||||||
|
|
||||||
|
|
||||||
### Alternate build:
|
### Alternate build:
|
||||||
@@ -42,7 +42,6 @@ make alt
|
|||||||
```sh
|
```sh
|
||||||
./cdupont.alt
|
./cdupont.alt
|
||||||
./cdupont.alt2
|
./cdupont.alt2
|
||||||
./cdupont.alt3
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Enjoy! :-)
|
Enjoy! :-)
|
||||||
|
|||||||
+20
-57
@@ -1,61 +1,24 @@
|
|||||||
/* common sense to nohonest programmer */
|
/* common sense to nohonest programmer */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
main ()
|
main(){int x ,gi=4,i,f,ri=1,httxkbl=1,m=012;long cd=0x5765248d,n;
|
||||||
{
|
char u[0x50][032];FILE *ind;
|
||||||
int x, gi = 4, i, f, ri = 1, httxkbl = 1, m = 012;
|
ind=fopen(s,t); for(i=0; i<0x1a; i++){goto daswjhkls;vhjsgfdy1l1gjhd:;}
|
||||||
long cd = 0x5765248d, n;
|
/*borntorun.*/goto c0g0;cOgO:i=0;fclose(ind);c0gO:
|
||||||
char u[0x50][032];
|
x= u [gi][m];
|
||||||
FILE *ind;
|
if( m==gi){x=0x70;f=0x68;}else goto cOg0 ; b:putchar(x); if(
|
||||||
ind = fopen (s, t);
|
!(n-httxkbl++))
|
||||||
for (i = 0; i < 0x1a; i++)
|
|
||||||
{
|
|
||||||
goto daswjhkls;
|
|
||||||
vhjsgfdy1l1gjhd:;
|
|
||||||
}
|
|
||||||
/*borntorun.*/ goto c0g0;
|
|
||||||
cOgO:i = 0;
|
|
||||||
fclose (ind);
|
|
||||||
c0gO:
|
|
||||||
x = u[gi][m];
|
|
||||||
if (m == gi)
|
|
||||||
{
|
|
||||||
x = 0x70;
|
|
||||||
f = 0x68;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
goto cOg0;
|
|
||||||
b:putchar (x);
|
|
||||||
if (!(n - httxkbl++))
|
|
||||||
#define yank(x) putchar(x)
|
#define yank(x) putchar(x)
|
||||||
{
|
{httxkbl=1; yank(' ');goto
|
||||||
httxkbl = 1;
|
hxi;}goto bl;
|
||||||
yank (' ');
|
daswjhkls: fgets(u[i], 0120, ind);
|
||||||
goto hxi;
|
/*obfuscated, eh? */goto
|
||||||
}
|
|
||||||
goto bl;
|
|
||||||
daswjhkls:fgets (u[i], 0120, ind);
|
|
||||||
/*obfuscated, eh? */ goto
|
|
||||||
vhjsgfdy1l1gjhd;
|
vhjsgfdy1l1gjhd;
|
||||||
c0g0:n = cd & 0x40000000L >> 0x1e;
|
c0g0 : n=cd&0x40000000L>>0x1e;
|
||||||
goto cOgO;
|
goto cOgO; g6w:
|
||||||
g6w:
|
if(x!=0x2e){i++;goto c0gO;}else /*
|
||||||
if (x != 0x2e)
|
injail*/yank('\n');goto vhjsgfdyl1lgjhd;
|
||||||
{
|
cOg0 :
|
||||||
i++;
|
f=u[m][gi];goto b;bl:m=(i+1)*(4*
|
||||||
goto c0gO;
|
x+3*f)%032;gi=(i+1)*(x+2*f)%0x1a; goto g6w;
|
||||||
}
|
hxi:cd^= n= cd&(7<<3*(014-++ri));
|
||||||
else /*
|
n >>=3*(12-ri); goto bl;vhjsgfdyl1lgjhd:;}
|
||||||
injail */
|
|
||||||
yank ('\n');
|
|
||||||
goto vhjsgfdyl1lgjhd;
|
|
||||||
cOg0:
|
|
||||||
f = u[m][gi];
|
|
||||||
goto b;
|
|
||||||
bl:m = (i + 1) * (4 * x + 3 * f) % 032;
|
|
||||||
gi = (i + 1) * (x + 2 * f) % 0x1a;
|
|
||||||
goto g6w;
|
|
||||||
hxi:cd ^= n = cd & (7 << 3 * (014 - ++ri));
|
|
||||||
n >>= 3 * (12 - ri);
|
|
||||||
goto bl;
|
|
||||||
vhjsgfdyl1lgjhd:;
|
|
||||||
}
|
|
||||||
+61
-20
@@ -1,23 +1,64 @@
|
|||||||
|
/* common sense to nohonest programmer */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
main(){int x ,gi=4,i,f,ri=1,httxkbl=1,m=012;long cd=0x5765248d,n;
|
main ()
|
||||||
char u[0x50][032];FILE *ind;
|
{
|
||||||
ind=fopen(s,t); for(i=0; i<0x1a; i++){goto daswjhkls;vhjsgfdy1l1gjhd:;}
|
int x, gi = 4, i, f, ri = 1, httxkbl = 1, m = 012;
|
||||||
/*borntorun.*/goto c0g0;cOgO:i=0;fclose(ind);c0gO:
|
long cd = 0x5765248d, n;
|
||||||
x= u [gi][m];
|
char u[0x50][032];
|
||||||
if( m==gi){x=0x70;f=0x68;}else goto cOg0 ; b:putchar(x); if(
|
FILE *ind;
|
||||||
!(n-httxkbl++))
|
ind = fopen (s, t);
|
||||||
|
for (i = 0; i < 0x1a; i++)
|
||||||
|
{
|
||||||
|
goto daswjhkls;
|
||||||
|
vhjsgfdy1l1gjhd:;
|
||||||
|
}
|
||||||
|
/*borntorun.*/ goto c0g0;
|
||||||
|
cOgO:i = 0;
|
||||||
|
fclose (ind);
|
||||||
|
c0gO:
|
||||||
|
x = u[gi][m];
|
||||||
|
sorryfor_this_unused_but_very_needed_label:
|
||||||
|
if (m == gi)
|
||||||
|
{
|
||||||
|
x = 0x70;
|
||||||
|
f = 0x68;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
goto cOg0;
|
||||||
|
b:putchar (x);
|
||||||
|
if (!(n - httxkbl++))
|
||||||
#define yank(x) putchar(x)
|
#define yank(x) putchar(x)
|
||||||
{httxkbl=1; yank(' ');goto
|
{
|
||||||
hxi;}goto bl;
|
httxkbl = 1;
|
||||||
daswjhkls: fgets(u[i], 0120, ind);
|
yank (' ');
|
||||||
/*obfuscated, eh? */goto
|
goto hxi;
|
||||||
|
}
|
||||||
|
goto bl;
|
||||||
|
/* hardlyundrstandable, but
|
||||||
|
likely to be missed if removed */
|
||||||
|
daswjhkls:fgets (u[i], 0120, ind);
|
||||||
|
/*obfuscated, eh? */ goto
|
||||||
vhjsgfdy1l1gjhd;
|
vhjsgfdy1l1gjhd;
|
||||||
c0g0 : n=cd&0x40000000L>>0x1e;
|
c0g0:n = cd & 0x40000000L >> 0x1e;
|
||||||
goto cOgO; g6w:
|
goto cOgO;
|
||||||
if(x!=0x2e){i++;goto c0gO;}else /*
|
g6w:
|
||||||
injail*/yank('\n');goto vhjsgfdyl1lgjhd;
|
if (x != 0x2e)
|
||||||
cOg0 :
|
{
|
||||||
f=u[m][gi];goto b;bl:m=(i+1)*(4*
|
i++;
|
||||||
x+3*f)%032;gi=(i+1)*(x+2*f)%0x1a; goto g6w;
|
goto c0gO;
|
||||||
hxi:cd^= n= cd&(7<<3*(014-++ri));
|
}
|
||||||
n >>=3*(12-ri); goto bl;vhjsgfdyl1lgjhd:;}
|
else /*
|
||||||
|
injail */
|
||||||
|
yank ('\n');
|
||||||
|
goto vhjsgfdyl1lgjhd;
|
||||||
|
cOg0:
|
||||||
|
f = u[m][gi];
|
||||||
|
goto b;
|
||||||
|
bl:m = (i + 1) * (4 * x + 3 * f) % 032;
|
||||||
|
gi = (i + 1) * (x + 2 * f) % 0x1a;
|
||||||
|
goto g6w;
|
||||||
|
hxi:cd ^= n = cd & (7 << 3 * (014 - ++ri));
|
||||||
|
n >>= 3 * (12 - ri);
|
||||||
|
goto bl;
|
||||||
|
vhjsgfdyl1lgjhd:;
|
||||||
|
}
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
/* common sense to nohonest programmer */
|
|
||||||
#include <stdio.h>
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
int x, gi = 4, i, f, ri = 1, httxkbl = 1, m = 012;
|
|
||||||
long cd = 0x5765248d, n;
|
|
||||||
char u[0x50][032];
|
|
||||||
FILE *ind;
|
|
||||||
ind = fopen (s, t);
|
|
||||||
for (i = 0; i < 0x1a; i++)
|
|
||||||
{
|
|
||||||
goto daswjhkls;
|
|
||||||
vhjsgfdy1l1gjhd:;
|
|
||||||
}
|
|
||||||
/*borntorun.*/ goto c0g0;
|
|
||||||
cOgO:i = 0;
|
|
||||||
fclose (ind);
|
|
||||||
c0gO:
|
|
||||||
x = u[gi][m];
|
|
||||||
sorryfor_this_unused_but_very_needed_label:
|
|
||||||
if (m == gi)
|
|
||||||
{
|
|
||||||
x = 0x70;
|
|
||||||
f = 0x68;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
goto cOg0;
|
|
||||||
b:putchar (x);
|
|
||||||
if (!(n - httxkbl++))
|
|
||||||
#define yank(x) putchar(x)
|
|
||||||
{
|
|
||||||
httxkbl = 1;
|
|
||||||
yank (' ');
|
|
||||||
goto hxi;
|
|
||||||
}
|
|
||||||
goto bl;
|
|
||||||
/* hardlyundrstandable, but
|
|
||||||
likely to be missed if removed */
|
|
||||||
daswjhkls:fgets (u[i], 0120, ind);
|
|
||||||
/*obfuscated, eh? */ goto
|
|
||||||
vhjsgfdy1l1gjhd;
|
|
||||||
c0g0:n = cd & 0x40000000L >> 0x1e;
|
|
||||||
goto cOgO;
|
|
||||||
g6w:
|
|
||||||
if (x != 0x2e)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
goto c0gO;
|
|
||||||
}
|
|
||||||
else /*
|
|
||||||
injail */
|
|
||||||
yank ('\n');
|
|
||||||
goto vhjsgfdyl1lgjhd;
|
|
||||||
cOg0:
|
|
||||||
f = u[m][gi];
|
|
||||||
goto b;
|
|
||||||
bl:m = (i + 1) * (4 * x + 3 * f) % 032;
|
|
||||||
gi = (i + 1) * (x + 2 * f) % 0x1a;
|
|
||||||
goto g6w;
|
|
||||||
hxi:cd ^= n = cd & (7 << 3 * (014 - ++ri));
|
|
||||||
n >>= 3 * (12 - ri);
|
|
||||||
goto bl;
|
|
||||||
vhjsgfdyl1lgjhd:;
|
|
||||||
}
|
|
||||||
+9
-9
@@ -1098,15 +1098,15 @@ more useful way to exit, just entering `q` followed by enter.
|
|||||||
|
|
||||||
## [1991/cdupont](1991/cdupont/cdupont.c) ([README.md](1991/cdupont/README.md]))
|
## [1991/cdupont](1991/cdupont/cdupont.c) ([README.md](1991/cdupont/README.md]))
|
||||||
|
|
||||||
Cody provided [three alternate](1991/cdupont/README.md#alternate-code) versions
|
Cody provided [two alternate](1991/cdupont/README.md#alternate-code) versions to
|
||||||
that allow one to see what would happen if one were to beautify the program or
|
see what would happen if certain things were done that were warned against: [one
|
||||||
remove a `goto` label or a comment that was in the original code. This required
|
that has an unused `goto` label and a comment
|
||||||
changing the `s` macro to be `__FILE__` (which is more reliable anyway) as
|
removed](1991/cdupont/cdupont.alt.c) and [another that was
|
||||||
otherwise it would read in the original code and not demonstrate the problem.
|
beautified](1991/cdupont/cdupont.alt2.c).
|
||||||
[One version](1991/cdupont/cdupont.alt2.c) has the comments and unused `goto`
|
|
||||||
label removed and [the other](1991/cdupont/cdupont.alt.c) has the comments and
|
This required changing the `s` macro to be `__FILE__` (which is more reliable
|
||||||
label removed and it is also beautified. The [third
|
anyway) as otherwise it would read in the original code and not demonstrate the
|
||||||
one](1991/cdupont/cdupont.alt3.c) is just beautified.
|
problem.
|
||||||
|
|
||||||
|
|
||||||
## [1991/davidguy](1991/davidguy/davidguy.c) ([README.md](1991/davidguy/README.md]))
|
## [1991/davidguy](1991/davidguy/davidguy.c) ([README.md](1991/davidguy/README.md]))
|
||||||
|
|||||||
Reference in new issue
Block a user