View Full Version : Can anyone figure out this C Code?
purifier
14-04-2006, 10:42 PM
Does anybody have any idea how this works???
#include<stdio.h>
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a=
"- LLLLLL?, LMKC,XYZHELLO FOLKS,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )
for(; a-- > 64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
}
It somehow manages to print map of India
i feel a prog has be used to generate this code ...can nybody tell does such program exists for converting a simple logic into a cryptic form
QwertyManiac
14-04-2006, 10:59 PM
I saw this here (www.whoismadhur.com) I guess... Pointers I think...
purifier
14-04-2006, 11:01 PM
Oh...yeah after posting...i'm searching too.. but not able to see a complete valid explanation anywhere...well pointers could be the thing...but i wonder how everything works out...
nikhil ramteke
03-01-2007, 05:28 PM
u may get answer 4m www.programmersheaven.com (http://www.programmersheaven.com) .....i dnt know certainly u wil b getting it or not but try.....i wil also look 4 it.....
tuxfan
03-01-2007, 06:22 PM
I saw this here (http://www.whoismadhur.com) I guess... Pointers I think...
This is not pointers.
But a is declared as an int. So it can store 2 bytes of data. Instead of that, it is stuffed with so many characters.
Additionally, the second part in the for() loop is the condition. So there should "a==..." instead of that there is a single =. So it is an assignement and not a condition.
b and c are declared immediately after a. So most likely they will occupy next 4 bytes after a. But a is stuffed with these characters. First 2 characters are accessible with a, next two with b and next 2 with c. Even count will have characters from the same string.
This is cryptic programming. My (rusted) knowledge of C isn't so good that I would understand this. But these are just a few observations. I have heard that there used to be competitions held for cryptic C programming. C is endless. :)
jal_desai
03-01-2007, 09:40 PM
ya such programs can create graphical outputs... but i think u may need to include graphics.h header file
sachin_kothari
26-10-2007, 10:54 AM
#include<stdio.h>
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a=
"- LLLLLL?, LMKC,XYZHELLO FOLKS,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )
for(; a-- > 64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
}
It somehow manages to print map of India
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki (http://en.wikipedia.org/wiki/Obfuscated_code) details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.
saurabh kakkar
26-10-2007, 11:49 AM
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki (http://en.wikipedia.org/wiki/Obfuscated_code) details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.
Thanks for the info :) .I had never come through such a program :D
adi007
26-10-2007, 12:31 PM
me too :D:D
aditya.shevade
26-10-2007, 12:55 PM
Search for obfuscated c code in google. Even looking at the winning programs gives you a headache.
fun2sh
27-10-2007, 02:02 AM
how do get such ideas :shock: :shock: :shock: :shock: :shock: :shock:
cant any1 explain that india map program. also first [B]for[\B] loop in that prog contains only two expression instead of for(exp1;exp2;exp3)
QwertyManiac
27-10-2007, 07:39 AM
^^
For can be used without initialization and counter expressions :?
for( ; condition ; ) is valid as you can place the initialization outside and counter inside the loop if you have to. Removing the condition makes it infinite loop until break.
sachin_kothari
27-10-2007, 09:49 AM
@fun2sh
The code is obfuscated so that it remains unexplainable.
Its like you can look at the code, but cant make out the flow of the code.
fun2sh
27-10-2007, 04:40 PM
yeah i know that.we can even use like for(;;) but first [B]for[\B] loop contains only one [B];[\b] there.
deepak.krishnan
27-10-2007, 05:20 PM
OMG how can one think of such a code??? :))
ayush_chh
27-10-2007, 07:24 PM
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki (http://en.wikipedia.org/wiki/Obfuscated_code) details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.
man u did a great job...never knew this........:):)
@purifirer
where did u get tis from man????
sachin_kothari
27-10-2007, 08:47 PM
^^ Check this (http://www.cis.ufl.edu/~manuel/obfuscate/obfuscate.html) link for more obfuscated codes.
This link is of International Obfuscated C code contest.
Enjoy :)
OMG how can one think of such a code??? :)) You cannot write such codes directly.
There are obfuscated code generators which take your normal programs as input and produce obfuscated code.
Pathik
27-10-2007, 08:56 PM
Yup... and i think coes are also obfuscated to make it difficult to reverse engineer it..
sachin_kothari
27-10-2007, 09:02 PM
These codes can be reversed engineered only if the technique used by the obfuscator is known.
There are some well know obfuscation techniques like
> Layout obfuscations - modify the layout structure of the program by two basic methods: renaming identifiers and removing debugging information. They make the program code less informative to a reverse engineer. Most layout obfuscations cannot be undone because they use one-way functions such as changing identifiers by random symbols and removing comments, unused methods, and debugging information. Though layout obfuscations cannot prevent reverse engineers to understand the program by observing the obfuscated code, they at least consume the cost of reverse engineering. Layout obfuscations are the most well studied and widely used in code obfuscation. Almost all Java obfuscators contain this technique.
|> Control obfuscations - change the control flow of the program. The trick is simple: For a routine A() obfuscator creates an additional routine A_bug and an "if" selector, if (PREDICATE) then A_bug(); else A();. The PREDICATE is designed on-the-fly in that way so it is always false (but it's made so it's hard to conclude that fact), and the A() routine is always selected instead of a buggy copy A_bug().
|> Data obfuscations - break the data structures used in the program and encrypt literals. This method includes modifying inheritance relations, restructuring arrays, etc. Data obfuscations thoroughly change the data structure of a program. They make the obfuscated codes so complicated that it is impossible to recreate the original source code.
Source (http://www.builderau.com.au/program/java/soa/How-obfuscation-helps-protect-Java-from-reverse-engineering/0,339024620,339280702,00.htm)
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.