topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 11:23 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Can you read and understand C? :-))  (Read 6513 times)

JoTo

  • Super Honorary
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 236
    • View Profile
    • Donate to Member
Can you read and understand C? :-))
« on: May 02, 2006, 09:30 AM »
Hi,

13 Years ago in 1993 there was a special programmers contest. The goal was to write the obfuscated C-code ever written. At that time i downloaded the winner code from the contest page.

If you want to have fun, look (like me) at the code and try to understand. I am willing to admit, that until today i never have understand that pointerstew.  :D

But i promise the following:

- The program can be compiled unmodified (at least the core functionality - maybe you have to adjust some compiler instructions and/or includefiles) with a normal C-Compiler with no errors and only one ignorable warning. A "ready to build" Microsoft Visual C++ .NET 2003 solution is included in the ZIPfile.

- The program creates an understandable output in the console window. (Its a console app, so open a commandprompt window first and start it from there). I will not reveal the output, try it by yourself.  :P

Click me to see the code
// Code93.cpp

#include "stdafx.h"

rmain(int t,int _,char* a)
{
return!

0<t?
t<3?

rmain(-79,-13,a+
rmain(-87,1-_,
rmain(-86, 0, a+1 )


+a)):

1,
t<_?
rmain(t+1, _, a )
:3,

rmain ( -94, -27+t, a )
&&t == 2 ?_
<13 ?

rmain ( 2, _+1, "%s %d %d\n" )

:9:16:
t<0?
t<-72?
rmain( _, t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+,/#;\
#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;\
q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){nl]!/n{n#'; \
r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
\
n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;\
{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
:
t<-50?
_==*a ?
putchar(31[a]):

rmain(-65,_,a+1)
:
rmain((*a == '/') + t, _, a + 1 )
:

0<t?

rmain ( 2, 2 , "%s")
:*a=='/'||

rmain(0,

rmain(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry")

,a+1);}

int _tmain(int argc, _TCHAR* argv[]){

rmain(1,

0,NULL

); return 0;
}


For those that don't want or can't compile the code itself, i upload a ready to run compiled windows exe too.

Have fun!
CU
JoTo

Rover

  • Master of Smilies
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 632
    • View Profile
    • Donate to Member
Re: Can you read and understand C? :-))
« Reply #1 on: May 02, 2006, 07:11 PM »
Un-freaking real  :P

It doesn't look like there is enough text in the source to generate the output!

Weird.
Insert Brilliant Sig line here

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Can you read and understand C? :-))
« Reply #2 on: May 02, 2006, 07:33 PM »
Amazing!  ;D ;D ;D

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Can you read and understand C? :-))
« Reply #3 on: May 03, 2006, 05:19 AM »
Hehe cute...

there's plenty of obfuscated C source out there, btw. I've seen files formatted to look like x-mas trees and nuke signs and whatnot :)
- carpe noctem

allen

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,206
    • View Profile
    • Donate to Member
Re: Can you read and understand C? :-))
« Reply #4 on: May 03, 2006, 05:20 AM »
I'm guessing it recurses through the verses and such, so in the source each gift only had to be typed once and reused to minimize text used in the source, but . . . man, that's amazing.

Tekzel

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 228
    • View Profile
    • Donate to Member
Re: Can you read and understand C? :-))
« Reply #5 on: May 05, 2006, 10:59 AM »
Yea thats what I was thinking, thats the reason for all the pointers.  Looks to be highly recursive too.