12 days of christmas

obfuscated C

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 13495 Views - Last Post: 30 May 2009 - 03:12 PM Rate Topic: -----

#16 IngeniousHax  Icon User is online

  • |>|20-514<|{3|2

Reputation: 79
  • View blog
  • Posts: 1,366
  • Joined: 28-March 09

Re: 12 days of christmas

Posted 30 May 2009 - 11:47 AM

isn't it though? I was pretty in awe myself.
Was This Post Helpful? 0
  • +
  • -

#17 apw5020  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: 12 days of christmas

Posted 30 May 2009 - 12:25 PM

Well, when I tried it I ended up getting these 3 errors. Anyone know why?

't' : undeclared identifier
'_' : undeclared identifier
'a' : undeclared identifier
'main' : function-style initializer appears to be a function definition
Was This Post Helpful? 0
  • +
  • -

#18 IngeniousHax  Icon User is online

  • |>|20-514<|{3|2

Reputation: 79
  • View blog
  • Posts: 1,366
  • Joined: 28-March 09

Re: 12 days of christmas

Posted 30 May 2009 - 12:32 PM

Did you compile as a C or C++ program? Cause it should be compiled as a C program.
Was This Post Helpful? 0
  • +
  • -

#19 Dantheman  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 445
  • Joined: 27-May 09

Re: 12 days of christmas

Posted 30 May 2009 - 01:55 PM

Here are some features of C syntax your obfuscated code relies on:

1. Old C function declarations. That's when you had to declare the aruments not inside the parenthesis, but outside. For example:

Modern C:

void f(char c) { }



Old C:

void f() char c { }



2. "_" is a valid variable name.

3. Array index evaluation can be done in any order. For example:

int array[5] = {1,2,3,4,5};
printf("%d", array[0]);
printf("%d", 0[array]);



Compile it, you will see that both printf() statements are identical.

Couple all of the above with some crazy bit arithmetic and usage of newlines, and you get yourself an obfuscated code.

P.S. I just found an interesting link on this website. If you want to learn more about obfuscated code, check it out - http://www.dreaminco...showtopic=38102

This post has been edited by Dantheman: 30 May 2009 - 02:04 PM

Was This Post Helpful? 1
  • +
  • -

#20 IngeniousHax  Icon User is online

  • |>|20-514<|{3|2

Reputation: 79
  • View blog
  • Posts: 1,366
  • Joined: 28-March 09

Re: 12 days of christmas

Posted 30 May 2009 - 03:12 PM

Very nice. Thanks dantheman
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2