Hello,

Can anybody give me a code or advise me how can I convert IP address from decimal to hexadecimal..

Example, the hexadecimal of “1.2.3.4??? will be, “01020304??? in hexadecimal; decimal “202.28.1.80??? will be
“CA1C0150???.. as you can see when converted it change the address into hexadecimal notation by ignoring the dot...

Thanks in advanced!
Posted on 2006-08-19 01:58:40 by boonmai
Plug it in and move on  :)
.code
; IN:  pointer to string "x.y.z.w"
; OUT: eax holds IP dword
IPStrToDw proc uses esi, pIPString:PTR BYTE
mov esi,pIPString
xor eax,eax
xor ecx,ecx
jmp @F
.repeat
.if edx == '.'
or ecx,eax
shl ecx,8
xor eax,eax
.else
lea eax,
lea eax,
.endif
@@:
movzx edx,byte ptr
inc esi
.until !edx
or eax,ecx
ret
IPStrToDw endp

;;;;;;;;;;;;;;;;;;;; Test
.data
ipString db "202.28.1.80",0
.code
start:
invoke IPStrToDw,addr ipString
Posted on 2006-08-19 11:13:58 by drizz
Thank you very much!!!
Posted on 2006-08-19 11:46:27 by boonmai