On Sun, Nov 05, 2000 at 08:46:05PM +1100, Damien wrote:
> >
> > a.b.c.d
> >
> > n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3
>
> after reading the previous mail, this is what i was thinking. i went to test
> it in perl afterwards, but got the wrong result. could anyone tell me what's
> wrong with
> IP networks use big-endian notation and PCs use little-endian; you
> need to convert the value before splitting it back into octets:
>
>
> ($a, $b, $c, $d) = split(/\./, "50.55.48.52");
> $n = $d + ($c << 8) + ($b << 16) + ($a << 24);
> print "$n = ", join(".", unpack("C4", pack("N", $n))), "\
There are those who would have you believe that Damien wrote:
> > > I can tell you an easier way to decipher them, but I too would like to
> > > know how they are contructed, i.e what's the algorithm.
> >
> > a.b.c.d
> >
> > n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3
>
> after reading the previ
> > I can tell you an easier way to decipher them, but I too would like to
> > know how they are contructed, i.e what's the algorithm.
>
> a.b.c.d
>
> n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3
after reading the previous mail, this is what i was thinking. i went to test
it in perl afterwards, b
4 matches
Mail list logo