Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Coding Problem (http://www.go4expert.com/forums/coding-problem-t12465/)

bharatwalia 26Jul2008 22:13

Coding Problem
 
Hi to all
how can i decode a text in c/c++

exmaple:
// Coded text is "127.0.0.1"
char g_szServerName[] = {(char)121,(char)80,(char)114,(char)101,(char)54,( char)122,(char)67,(char)87,(char)122,(char)112,(ch ar)80,(char)83,(char)85,(char)84,(char)47,(char)90 ,(char)87,(char)103,(char)102,(char)90,(char)111,( char)65,(char)61,(char)61,0};

i will be verry thankfull if any body could tell me this
thanks a lot.

bharat

xpi0t0s 27Jul2008 03:18

Re: Coding Problem
 
I've no idea what you mean. What input would such a program have? What output? How far have you got in writing such a program and where are you stuck? Is the program not behaving as you expect, if so how (what is it doing that you don't expect, or vice versa)?

bharatwalia 27Jul2008 13:43

Re: Coding Problem
 
hi thanks for ur reply..i mean as u can see written over ther coded text 127.0.0.1 it the ip address of localhost which is coded in (char) form


i.e

127.0.0.1 = {(char)121,(char)80,(char)114,(char)101,(char)54,( char)122,(char)67,(char)87,(char)122,(char)112,(ch ar)80,(char)83,(char)85,(char)84,(char)47,(char)90 ,(char)87,(char)103,(char)102,(char)90,(char)111,( char)65,(char)61,(char)61,0};


which is further stored into a array char g_szServerName[]
further in a layman language 127.0.0.1 is coded in above form and then stored in array
char g_szServerName[]

i hope know must have got a clear picture.
thanks

xpi0t0s 28Jul2008 03:49

Re: Coding Problem
 
Nope, it's still rather opaque, I still haven't got a clue what you're talking about, probably because there's a whole load of context you haven't mentioned.

121,80,114,101... in ASCII is yPre... and looks nothing like "127.0.0.1". What exactly does "127.0.0.1 = {(char)121..." mean? How is the left side "equal" to the right side?

Can you give any more example data? For example what would "0.0.0.0" and "255.255.255.255" be "equal" to? Expressing the same question slightly differently, if the coded text were 0.0.0.0 instead of 127.0.0.1, or 255.255.255.255, what would g_szServerName contain?

Why is the string called g_szServerName when it doesn't resemble anything any sane sysadmin would call a computer? (Yep, I'm aware of the irony of "sane sysadmin".)

Is some kind of cryptography relevant to this discussion?

sofprog66 1Aug2008 06:01

Re: Coding Problem
 
This is what I got after some quick decoding of the char's. " yPre6zCWzpPSUT/ZWgfZoA=="

xpi0t0s 1Aug2008 16:21

Re: Coding Problem
 
Yep, that looks like some kind of ciphertext to me. Hence my question about cryptography and my comment about missing context; if the OP is on a course and they've recently been discussing, say, MD5, then the original question MIGHT mean something like "how do I reverse MD5 to get the text that MD5'd to yPre...?" However that's just a guess and what we really need is for the OP to give us some more clues.

sofprog66 2Aug2008 00:07

Re: Coding Problem
 
Hopefully he is being taught this in a course and not using this to get access to a server which isin't his.


All times are GMT +5.5. The time now is 01:32.