Friday, November 28, 2008

How Easily Convert Binary - Decimal - Hexa

IP is very important for network engineers, especially in the much-needed Binary to decimal conversion or Hexa or vice versa. How easy enough, that is,
1. Consists of a decimal number, or a combination of: 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9
2. Binary consists of a number: 0 and 1
3. HEXA consists of 16 fruit number (combination): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

paint: Hexa usually given a leading 0x, for example, the D4 written 0xD4

Case
IP: 192.168.0.212
How Brinary and Hexa form the IP?

For an answer we must have a separate segment, which is a, 192 b. 168 c.0 and d.212

Please note that:
----------------
Decimal I Bin I HEXA
----------------
0 I 0000 I 0
1 I 0001 I 1
2 I 0010 I 2
3 I 0011 I 3
4 I 0100 I 4
5 I 0101 I 5
6 I 0110 I 6
7 I 0111 I 7
8 I 1000 I 8
9 I 1001 I 9
10 I 1010 I A
11 I 1011 I B
12 I 1100 I C
13 I 1101 I D
14 I 1110 I E
15 I 1111 I M

--------------------
Answer:

Numbers for the Hexa consists of 2 x 4 bits of binary. Numbers in other words the results form the binary decimal we separate into each of 4 bits.

IP: 192.168.0.212
192 = 1100 I 0000 to become -> C and 0 is written C0 or 0xC0
168 = 1010 I 1000 to become -> A and 8 is written A8 or 0xA8
0 = 0000 I 0000 to become -> 0 and 0 is written 00 or 0x00
212 = 1101 I 0100 to become -> D and 4 is written D4 or 0xD8

so that created the IP Hexa we can write:
C0.A8.00.D8 or equal to 192.168.0.212

Vice versa if we will mengkoneversi form HEXA to decimal:
for instance, the C0, C and 0 separated, and in such a binary (see table above)
C=1100 and 0 = 0000 for a decimal we merge these two binary into 1100 I 0000 or 11000000. or can be in the detail
11000000 = 128 +64 +0 +0 +0 +0 +0 +0= 192

No comments: