|
-
Dec 18th, 2003, 06:15 PM
#1
Thread Starter
Frenzied Member
perl: Dec to Ip address
how would I do this:
Convert this number
3516293025
From dec to a IP address ??
thanks!
-
Dec 18th, 2003, 10:50 PM
#2
Lively Member
huh? Ip addy's are in decimal, there sint a conversion.
You've got Hex, Binary, and Decimal.. there isnt an "IP". Its probably just encrypted or something
or maybe i just dont understand your question

-morrowasted
-
Dec 19th, 2003, 10:13 AM
#3
Thread Starter
Frenzied Member
Sorry.. Ill be clearer.
an ip address is a 4x 4byte dec numbers.
10.10.5.3
he took the number and went to bin..
1010101001010011 (10.10.5.3)
then got a 16byte integer
I need to get it back to the 10.10.5.3 =)
-
Dec 19th, 2003, 11:55 AM
#4
Use shift (>>) and bitwise and (&) to split it up into the four bytes, then concatenate them with dots.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 19th, 2003, 11:57 AM
#5
You're mistaken about the IP btw. An IP in the xxx.xxx.xxx.xxx representation is 4 1-byte integers, and the number you have is a single 4-byte integer.
You can use modulo and division to get the original number, but bit shifting is faster.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|