Jump to content

Obfuscated C++ Contest

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
36 replies to this topic

#1
LogicKills

LogicKills

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts
Just C++, less #defines = better..
http://logickills.org
Science - Math - Hacking - Tech

#2
LogicKills

LogicKills

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts
This one should be easy..

#include <iostream>

using namespace std;

inline string put(string x){string coded;for( int i = 0; i <= x.size() - 1; i++ )

{char c = x[i];c += 13;if (c > 'z'){c -= ('z' % 'a') + 1;

}if(c == ' '){c =+ ' ';}coded += c;}return coded;}

int main(){ while(1){;break;}int test; { cout << put("hello world");

cout << endl << endl;

cin.get();

cin.get();



return 0;

}

}

http://logickills.org
Science - Math - Hacking - Tech

#3
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Cool! This is something for those saying C++ is not maintainable, eh?
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#4
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Mm, you want me to just post the non-obfuscated translation? Okay, one second.

#5
LogicKills

LogicKills

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts
oh btw this really isn't a contest..
Just for fun, see what kind of entries we can get.
http://logickills.org
Science - Math - Hacking - Tech

#6
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Okay, here is your code 'un-obfuscated'.

// Here is my version which takes out the unnecessary crap

#include <iostream>


using namespace std;


string put(string x);


int main() {

	cout << put("hello world") << endl;

	

	return 0;

}


string put(string x) {

	string coded;

	int i = 0;

	char * s_pointer;

	

	for (i = 0; i < x.size(); i++) {

		

		s_pointer = &x[i];

		*s_pointer += 13;

		if (*s_pointer > 'z') {

			*s_pointer -= ('z' % 'a') + 1;

		}

		if (*s_pointer == ' ') {

			*s_pointer = ' ';

		}

		coded += *s_pointer;

		

		s_pointer++;

	}

	

	return coded;

}


P.S. I am ready to 'unobfuscate all of you fucker's code'.

#7
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I made this two years ago, but I still kind of like it.
#include <iostream>

#define __end
#define __start int start; int i = 0
#define __stop  __start; int stop = 0;
#define __inc i++
#define __do ;\
    if(i == 0) i = start;\
    else __inc; std::cout << i << std::endl;
#define loop(_start, _stop) __stop\
    ((start = (_start)) &&\
    (stop = (_stop))) ; _do: __do;\
    if(!(i >=  stop)) goto _do

int main()
{
    loop(1, 100);
    return 0;
}


#8
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts
I'll just recycle this one I wrote a while back (even though it's a few months early for a Christmas contest).
                       \
                      int
                     _,l;\
                    char*I,
                   *O[]={"",
                  "gjstu","t"
                 "fdpoe","uij"
                "se","gpvsui",\
                  "gjgui","t"
                 "jyui","tfwf"
                "oui","fjhiui",
               "ojoui","ufoui",\
              "fmfwfoui","uxfmgu"
             "i","b!qbsusjehf!jo!"
            "b!qfbs!usff/\xb\xb",""
               "uxp!uvsumf!epwf"
              "t-\xb","uisff!gsf"
             "odi!ifot-!","gpvs!d"
            "bmmjoh!cjset-!","gjwf"
           "!hpme!sjoht<\xb","tjy!h"
          "fftf!b.mbzjoh-!","tfwfo!t"
         "xbot!b.txjnnjoh-\xb","fjhiu"
        "!nbjet!b.njmljoh-!","ojof!mbe"
            "jft!ebodjoh-!","ufo!m"
           "pset!b.mfbqjoh-\xb","fm"
          "fwfo!qjqfst!qjqjoh-!","ux"
         "fmwf!esvnnfst!esvnnjoh-!",""
        "Po!uif!","!ebz!pg!Disjtunbt!n"
       "z!usvf!mpwf!hbwf!up!nf\xb","boe"
      "!"};int putchar(int);int main(void
     ){while(l<(sizeof O/sizeof*O-2)/2-1){
          I=O[_=!_?sizeof O/sizeof*O-
         3:_<(sizeof(O)/sizeof*O-2)/2?
        sizeof O/sizeof*O-2:_==(sizeof(
       O)/sizeof*O-2)/2?++l,0:_<(sizeof(
      O)/sizeof(*O))-3?(_-1)==(sizeof(O)/
     sizeof*O-2)/2?sizeof O/sizeof*O-1:_-1
    :_<sizeof(O)/sizeof*O-2?l+1:_<sizeof(O)
   /sizeof*O-1?l+(sizeof O/sizeof(*O)-2)/2:(
  sizeof(O)/sizeof*O-2)/2];while(*I){putchar(
                  *I++-1);}}
                  return 0;}


#9
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Wow, :lol: that one's awesome dcs :P
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#10
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Ugliest thing I can come up with
void         _(char *__, int ___, int ____) {//{+
if(___ <= ____)/*cin>>*/{cout<< *(__+___);//###
_((__),(++(___)),(____));}}/*printf("%s\t", *__x)*/
int/*0xFF___\p+*/main() {char x___[8/*__(*Z_)
*/]={0x43,0x6F,0x64,0x65,0x43,0x61,0x6C,0x6C};
_(x___, 0, 7);return 
0
;
}
but dcs takes the cake

#11
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts
Another relic (which is alas C-only):
#include<stdio.h>

#include<string.h>

char*q(char*o){char*s=o,*e=s+strlen(s)-1;while(s

<e){char t=*e;*e--=*s;*s++=t;}return o;}char*u(a

,b,c,n)char*a,*b,*c;size_t n;{char*d=a,*e=b,*f=c

;int x=0;a=q(a);b=q(b);for(;;){int y=0;if(c>=&f[

n-1]){return 0;}if(*a){y+=*a-'0';++a;}if(*b){y+=

*b-'0';++b;}y+=x;x=y>10;if(!y&&!*a&&!*b){break;}

else if(y>9){x=1;y-=10;}else{x=0;}*c++=y+'0';}*c

='\0';;strcpy(d,q(e));strcpy(e,q(f));return(f);}

char A[8192]="0";char B[sizeof(A)/sizeof(*A)]="\

1";char C[sizeof(A)/sizeof(*A)];;int main(){char

f[]="f(%d)= %s\n";int i=0;printf(f,i++,A);printf

(f,i++,B);while(i<=10000){char*c=u(A,B,C,sizeof(

C));if(!(c)){break;}printf(f,i++,c);}return(0);}
Please try to figure it out first. But when you do try to run it, pipe the output to a text file and read in a decent editor.

#12
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Okay, I'll solve those three and post. Give me an hour or so.

Also, John your code is not legal, but I will change it so it is.