On Thu, Dec 04, 2014 at 17:32, Dimitris Papastamos wrote:
> Hi,
> 
> This is my attempt at converting bgpd to use siphash.  This does
> *not* link as is because the userland implementation of siphash
> is currently missing.

Indeed. That should be coming in a few days. I have a diff ready.

> 
> +     arc4random_buf(&key, sizeof(key));
> +
> flags &= ~ATTR_DEFMASK;       /* normalize mask */
> a->flags = flags;
> -     a->hash = hash32_buf(&flags, sizeof(flags), HASHINIT);
> +     a->hash = SipHash24(&key, &flags, sizeof(flags));

Ah, so this won't work. That's not how siphash works.

The key needs to last as long as the hash table does, which is
generally as long as the program. Different keys result in different
hashes, which makes it hard to look things up later.

Good start, though perhaps we should wait a bit until libc is ready to
go. It slipped my mind that siphash needs to be available before it
can be used when I sent that email about hash.h.

Reply via email to