Coding Problem

bharatwalia's Avatar, Join Date: Jul 2008
Newbie Member
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
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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)?
0
bharatwalia's Avatar, Join Date: Jul 2008
Newbie Member
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
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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?
0
sofprog66's Avatar
Go4Expert Member
This is what I got after some quick decoding of the char's. " yPre6zCWzpPSUT/ZWgfZoA=="
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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.
0
sofprog66's Avatar
Go4Expert Member
Hopefully he is being taught this in a course and not using this to get access to a server which isin't his.