[EMAIL PROTECTED] wrote:
>
> A word on relative efficiencies of the two formulae listed below... I
> ran timethese/cmpthese on the two, using a half-million iterations, ten
> times. The "folded" formula came out faster six times, at an average of
> 8.67% faster, while the long form won the race f
What, no bit-shifting?-- David L NicolI like that guy -- he once gave me a fish
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
" <[EMAIL PROTECTED]>
cc: "activeperl@listserv.ActiveState.com"
Subject: Re: Matching ip to Network
On 11/10/05, David Budd <[EMAIL PROTECTED]> wrote:
> > Raniak Robert is right.
> > I did mistake in formulation. Right one is
> &
Brian H. Oak <> wrote:
> Hi all,
>
> As a network engineer who eventually figured out how amazingly useful
> Perl could be in my work, my opinion about the correct solution to
> this problem is a little different than what I've seen offered here:
> any program written to work with network attrib
On 11/10/05, Bullock, Howard A. <[EMAIL PROTECTED]> wrote
a suite of conversion functions like ntoa and aton and so on in perl
David Nicol wrote:
How about ipv6? Where does that fit in?
[Bullock, Howard A.]
We do not use ipv6 yet. I will have to cross that bridge when we come to
it.
___
;http://acornnetsec.com/>
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of A B
Sent: Thursday, November 10, 2005 08:22
To: A B; Pierce, Glen E; activeperl@listserv.ActiveState.com
Subject: Re: Matching ip to Network
Raniak Robert is right.
I did mistak
On 11/10/05, Bullock, Howard A. <[EMAIL PROTECTED]> wrote
a suite of conversion functions like ntoa and aton and so on in perl
How about ipv6? Where does that fit in?
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http
On 11/10/05, David Budd <[EMAIL PROTECTED]> wrote:
> > Raniak Robert is right.
> > I did mistake in formulation. Right one is
> > (256*256*256*A)+(256*256*B)+(256*C)+D
>
> I've always done ((A*256+B)*256+C)*256+D
> Slightly more efficient
is not. They both have three multiplications and three add
I've always done ((A*256+B)*256+C)*256+D
Slightly more efficient
[Bullock, Howard A.]
Consider...
Where a subnet is 10.1.1.0/24
sub ConvertValToIp {
return join(".", unpack("C4", pack("N", $_[0])));
}
sub ConvertIpToVal {
return unpack("N", pack("C4", split(/\./, $_[0])));
}
sub Conv
> Raniak Robert is right.
> I did mistake in formulation. Right one is
> (256*256*256*A)+(256*256*B)+(256*C)+D
I've always done ((A*256+B)*256+C)*256+D
Slightly more efficient
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscri
Raniak Robert is right.
I did mistake in formulation. Right one is
(256*256*256*A)+(256*256*B)+(256*C)+D
Subroutine is right. You can try.
--Alex
--- A B <[EMAIL PROTECTED]> wrote:
> I think it could be easy if we will convert IP to number it will be
> enough.
> IP is A.B.C.D number could be (
I think it could be easy if we will convert IP to number it will be
enough.
IP is A.B.C.D number could be (256*256*256+A)+(256*256+B)+(256+C)+D
So, we have
sub ip_to_int {
my $inp = shift @_;
$inp = ($inp =~ /\./) ? unpack("N", pack("C4", split(/\./,$inp))) :
0;
return $inp;
}
Right now yo
Pierce, Glen E wrote:
> I’m not sure where to start here. Does anyone have any ideas or a place
> for me to begin to figure out how to see if an ip address is within an
> ip address range?
>
>
>
> Eg. If 10.20.125.16 is in either
>
>
>
> 10.2[0-4].120.* or
>
> 10.2[0-4].12[0-9].*
I’m not sure where to start here. Does anyone
have any ideas or a place for me to begin to figure out how to see if an ip
address is within an ip address range?
Eg. If 10.20.125.16 is in either
10.2[0-4].120.* or
10.2[0-4].12[0-9].* etc.
Thanks,
Glen.
The H
14 matches
Mail list logo