[Click] Little element, random dropper...

Nicholas Weaver nweaver at ICSI.Berkeley.EDU
Tue Jul 26 14:17:05 EDT 2005


On Tue, Jul 26, 2005 at 10:47:02AM -0700, Eddie Kohler composed:
> Check out elements/test/randomseed.{cc,hh}.
> 
> If you think Click should use something other than random(), tell us  
> why!

IMO: every element should be able to have its own random number
generator, rather than a common seed.  That way, scheduling of
elements does not affect the outcome.  But this is orthoginal to the
choice of pRNG.

For most of what people are doing in click, however, random() is "good
enough" as a pRNG.  

I use rc5/3/32 not because of its quality (although RC5 does have
cryptographically good quality when you up the # of rounds and go with
64 bit rather than 32 bit), but because having a 32 bit permutation
generator is useful for other things like IPv4 address caching, and
I'm slighly paranoid about pRNGs.

But the permutation is the big reason why I compulsively use it.  

EG, rather than doing a cache based on

IP-> Index / Tag

i use

E(IP,K) -> Index / Tag

This makes the cache "random" (based on the key seeding) and attacker
unpredictable, but still very efficient and deterministic.  RC5/32 is
reasonably fast for this, needing 2 adds, 2 XORs, 2 memory lookups and
4 shifts per round (and I'm using just 3 rounds), but random is
undoubtedly faster.

-- 
Nicholas C. Weaver                               nweaver at icsi.berkeley.edu
     This message has been ROT-13 encrypted twice for higher security.


More information about the click mailing list