Can anyone figure out this C Code?

Status
Not open for further replies.

purifier

Broken In
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
 
OP
P

purifier

Broken In
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

s,b+..u cn..
u may get answer 4m www.programmersheaven.com .....i dnt know certainly u wil b getting it or not but try.....i wil also look 4 it.....
 

tuxfan

Technomancer
QwertyManiac said:
I saw this here 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

In the zone
ya such programs can create graphical outputs... but i think u may need to include graphics.h header file
 

sachin_kothari

Ambassador of Buzz
purifier said:
#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 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

D i s t i n c t l y Ahead
sachin_kothari said:
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki 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
 

fun2sh

Pawned!... Beyond GODLIKE
how do get such ideas :shock: :shock: :shock: :shock: :shock: :shock:

cant any1 explain that india map program. also first for[\B] loop in that prog contains only two expression instead of for(exp1;exp2;exp3)
 

QwertyManiac

Commander in Chief
^^
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

Ambassador of Buzz
@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

Pawned!... Beyond GODLIKE
yeah i know that.we can even use like for(;;) but first for[\B] loop contains only one ;[\b] there.
 

ayush_chh

Ambassador of Buzz
sachin_kothari said:
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki 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????
 
Last edited:

sachin_kothari

Ambassador of Buzz
^^ Check this link for more obfuscated codes.
This link is of International Obfuscated C code contest.
Enjoy :)

deepak.krishnan said:
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.
 
Last edited:

sachin_kothari

Ambassador of Buzz
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
 
Status
Not open for further replies.
Top Bottom