OpenBSD cvs log

created 2020-07-31T12:14:16Z
begin 2020-07-17T08:57:39Z
end 2020-07-17T13:13:36Z
path src/sys
commits 1

date 2020-07-17T13:13:36Z
author tb
files src/sys/net/toeplitz.c log diff annotate
message Randomize the system stoeplitz key

One can prove that the Toeplitz matrix generated from a 16-bit seed is
invertible if and only if the seed has odd Boolean parity. Invertibility
is necessary and sufficient for the stoeplitz hash to take all 65536
possible values.

Generate a system stoeplitz seed of odd parity uniformly at random. This
is done by generating a random 16-bit number and then flipping its last
bit if it's of even parity. This works since flipping the last bit swaps
the numbers of even and odd parity, so we obtain a 2:1 mapping from all
16-bit numbers onto those with odd parity.

Implementation of parity via popcount provided by naddy; input from miod,
David Higgs, Matthew Martin, Martin Vahlensieck and others.

ok dlg