You don't search a lot and we are not a scripter for you.
I find a text to explain how convert dec to hex. So, with reflexion, you can make in other sense.
Example 3: Primenet identifies its outgoing email server by the name: smtp.primenet.com, and by
the decimal IP address: 206.165.6.132. Convert the decimal address 206.165.6.132 to its
hexadecimal equivalent.
Treat each set of digits delimited by decimal points as a unique 3 digit decimal number. Convert each 3
digit decimal number into an equivalent 2 digit hexadecimal number.
Use the decimal to hexadecimal algorithm above to convert 206 decimal to its hexadecimal equivalent.
Step 1: 206/16=12.875. Keep the whole number, 12, and ignore the remainder.
Step 2: Convert decimal 12 to hexadecimal using Table 1.
DEC: 12
HEX: C
Step 3: 12x16=192.
Step 4: 206-192=14.
Step 5: Convert decimal 14 to hexadecimal using Table 1.
DEC: 14
HEX: E
The equivalent hexadecimal is CE.
Using the same procedure defined above, the remaining segments of the email address are converted as
follows:
DEC: 165
HEX: A5
DEC: 6
HEX: 06
DEC: 132
HEX: 84
The equivalent hexadecimal address is CE.A5.06.84.