in reply to Re: Re**3: Eek! goto?
in thread Eek! goto?

while($len){ $H{(('a')x4,('b')x4,('c')x3)[--$len]} += $k[$len] << (8* ( ($len > 7 ? $len +1 : $len)%4 ) ); }
This seems to match the output of pfaut's code. If benchmarking you could eek out some more throughput by storing the hash key indexes in an array (as opposed to forcing three x per iteration of the loop.

--
I'm not belgian but I play one on TV.

Replies are listed 'Best First'.
Re: Re**5: Eek! goto?
by pfaut (Priest) on Feb 12, 2003 at 18:27 UTC

    Might be a bit faster if you throw out the hash and use an array. BTW, I think one of BrowserUK's later posts added back the originally missing low byte of $c so the check for $len > 7 can go, too.

    while ($len--) { $H[int($len/4)] += $k[$len] << (8 * ($len % 4)); }
    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';