I was wondering how to manually convert an IP address to a hex value on an x86 machine. For example, the book I was reading gives the hex representation of 192.168.42.72 as:
0x482aa8c0
but never explains how the conversion works. So, how does it?
When you convert an IP to a long integer, you take each octet in reverse order and multiply it by
256^nwhere n is the zero-based reverse index of the octetSo for this ip you’re doing
It looks like the book is doing it backwards, but you get the idea.