On Sun, 1 Oct 2000, Chad W. Skinner wrote:
> Someone posted a simple formula to convert ip addresses to decimal
> numbers, but I can not remember it. If you know this formula could you
> repost it please.
I think you want:
( A * 2^24 ) + ( B * 2^16 ) + ( C * 2^8 ) + ( D )
The octets can be reversed using:
IP = DECIMAL (like 3232235777)
IP / 2^24
(IP % 2^24) / 2^16
(IP % 2^16) / 2^8
(IP % 2^8)
There might be an easier way...
> Also, I have received spam in the past with the ips encoded this way to
> bypass older smut filters, but does anyone know other reasons why this
> conversion is possible or useful. I believe reasons were given the last time
> this came up, but I have misplaced my notes.
Offhand, I'd say it's because if you interpret an IP address as a long
integer (32 bits), that's the value you'd get. An IP address is four
octets, so when stored as such, and not as a character representation,
it's the same size as an integer (or a long number) on some platforms.
MSG
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list