### converting IP adresses

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,

.

11 posts
• Page **1** of **1**

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 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,

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1

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?

Dutchie wrote:

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 340590649 340590949 is expressed in decimal (dotless long format), if you then convert that address to hex you should get: CB020405

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

Convert HEX to Decimal: C6B6C438 = 3333866552 (decimal, dotless address)

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

Last edited by Data_Raid on Fri Jun 18, 2010 2:23 pm, edited 1 time in total.

All men by nature desire knowledge.

Aristotle

Aristotle

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?

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?

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1

Dutchie wrote: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?

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.

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

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

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

--

Ziggy

eCPPT - GSEC - GCIH - GWAPT - GCUX - RHCE - SCSecA - Security+ - Network+

Ziggy

eCPPT - GSEC - GCIH - GWAPT - GCUX - RHCE - SCSecA - Security+ - Network+

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!

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!

Last edited by Dutchie on Fri Jun 18, 2010 9:46 am, edited 1 time in total.

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1

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.

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.

Last edited by Ignatius on Fri Jun 18, 2010 12:51 pm, edited 1 time in total.

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!!

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!!

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1

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

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

Last edited by Data_Raid on Fri Jun 18, 2010 2:25 pm, edited 1 time in total.

All men by nature desire knowledge.

Aristotle

Aristotle

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

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

--

Ziggy

eCPPT - GSEC - GCIH - GWAPT - GCUX - RHCE - SCSecA - Security+ - Network+

Ziggy

eCPPT - GSEC - GCIH - GWAPT - GCUX - RHCE - SCSecA - Security+ - Network+

11 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest