|
Title: converting IP adresses Post by: Dutchie on June 18, 2010, 04:30:12 AM Next week I will sit for my CEH examen. I'm still struggling with converting IP adresses from decimal to normal expression of the IP-adress, for instance the decimal IP = 340590649 converted to normal expression should give: 203.2.4.5 How is this been calculated with a normal calculator? What's the scientific method for converting? Thanks for feedback, Title: Re: converting IP adresses Post by: UNIX on June 18, 2010, 04:55:48 AM Did you already search for tutorials/ explanations? You'll find quite a few explanations when googling for it. Is there a specific part or step where you have difficulties in understanding?
Title: Re: converting IP adresses Post by: Data_Raid on June 18, 2010, 06:51:19 AM Next week I will sit for my CEH examen. I'm still struggling with converting IP adresses from decimal to normal expression of the IP-adress, for instance the decimal IP = 340590649 converted to normal expression should give: 203.2.4.5 How is this been calculated with a normal calculator? What's the scientific method for converting? Thanks for feedback, The address Since the IP address consists of 4 octets each part of the address is represented as: CB (203) 02 (2) 04 (4) 5 (5) If you want to convert to the long decimal URL: linux.org= 198.182.196.56 Convert to HEX: 198 (C6) 182 (B6) 196 (C4) 56 (38) http://0xC6B6C438 (http://0xC6B6C438) Convert HEX to Decimal: C6B6C438 = 3333866552 (decimal, dotless address) http://3333866552 (http://3333866552) *Note: this only works with some browsers like IE, and this won't work with Firefox. Your results may vary though. HTH *edit: modified dotless address Title: Re: converting IP adresses Post by: Dutchie on June 18, 2010, 08:34:53 AM Thanks Data_Raid for your constructive reply. But as this is a valid question from the exam, they're expecting that we know all the Hex-notations by head? Can't be true! Isn't there another method? Title: Re: converting IP adresses Post by: jimbob on June 18, 2010, 09:32:35 AM But as this is a valid question from the exam, they're expecting that we know all the Hex-notations by head? Can't be true! This is still by far the easiest way to do it. If you have a good scientific calculator it should support hexadecimal, which makes converting to hex and back again easy.Isn't there another method? Knowing how to do hex arithmetic is a useful skill. If you're only covering 8-bit numbers you only need work with numbers in the rannge of 0x00-0xFF or 0-255 in decimal. Don't beat yourself up over it though, it does not come naturally to most and taking a minute doing a simple sum in your head can be time well spent. Jim Title: Re: converting IP adresses Post by: ziggy_567 on June 18, 2010, 09:37:50 AM Converting hex to decimal is fairly simple multiplication. In the previous example CB represents 203. Here's how you get that:
Dec Hex 0 0 1 1 2 2 3 3 4 4 5 5 ... A 10 B 11 C 12 D 13 E 14 F 15 Hex is base 16, which means that each digit is a multiple of 16 rather than 10 (decimal). In other words, 203 is equal to (2*10*10) + (0*10) + (3*1). In Hex you say (C*16) + (B*1). C represents 12 so C*16 is 12*16 which equals 192. B represents 11, so 192+11=203. HTH Title: Re: converting IP adresses Post by: Dutchie on June 18, 2010, 09:39:49 AM With the help of Data_Raid and the advice from Awesec to google, it seems that I got the method to convert. But my outcome is not what I expect. I do not seem to discover where I got wrong. It's for sure in the stage of converting decimal to hex!
So I will detail my outcome, maybe someone can review it and point me to my mistake: decimal 340590649 340590649/16 21.286.915 rest 9 this is in hex 9 21286915/16 1.330.432 rest 3 hex 3 1330432/16 83.152 rest 0 hex 0 83152/16 5.197 rest 0 hex 0 5197/16 324 rest 13 hex D 324/16 20 rest 4 hex 4 20/16 1 rest 4 hex 4 1/16 0 rest 1 hex 1 so in hex this gives: 144D0039 but the correct answer is: CB020405 Pls can someone review this and give me feedback! Title: Re: converting IP adresses Post by: Ignatius on June 18, 2010, 12:49:26 PM I thought I was going crazy when I started to work through this myself. I *thought* I knew how to do it ... but the maths just didn't work out.
The problem is that the decimal IP quoted (340590649) converts to 0x144D0039. However, 3405906949 converts to 0xCB020405. I confirmed this by using calc.exe in Scientific mode, rather than manually. Title: Re: converting IP adresses Post by: Dutchie on June 18, 2010, 12:56:03 PM Chapeau Ignatius, Now I can be sure that my calculations were right. The fault is within the question and it came from an official and recommended instance!! Great you solve the "bug" completely!! Thanks!! Now doubt any more over here concerning converting IP adresses!! Title: Re: converting IP adresses Post by: Data_Raid on June 18, 2010, 02:21:19 PM I just checked my calculations again:
144D0039 is 340590649 and CB020405 is 3405906949 which is the correct address. I can't recall my steps but 3405906649 never worked out in binary and I was scratching my head, and I tried another method, I possibly worked back from the IP address to binary and then to HEX hence my original HEX value was correct :) with a simple conversion 3405906949 works out fine in binary: 11001011 00000010 00000100 00000101 Title: Re: converting IP adresses Post by: ziggy_567 on June 18, 2010, 03:20:37 PM Here's another tip.
The C|EH is multiple choice, so you don't necessarily have to be able to go both ways to pass the test. (I understand that this doesn't help you learn for the sake of learning) But, the easiest (for me at least) solution is to work from the IP address to hex to binary to decimal. So no matter which way they ask the question, since I have all the possible answers, I can get to the correct answer fairly quickly by a process of elimination if they ask me to go from decimal to IP. HTH
Powered by SMF 1.1.18 |
SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com |