[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A better entropy estimation method for random.c/noise.sys?




I've been hacking with the hashing method used in noise.sys and 
decided to throw it away, since it did more to overestimate the 
entropy.

Until I find something better an xor-checksum of the ast N samples 
seems to do fine. Alternating samples generate no entropy and samples 
with periods <= N seem to generate less than 1 bit per sample.

The method (in pseudo-code) is as follows:

  delta = abs( LastSample - sample )
  LastSample = sample

  hash ^= delta  /* until I can think of a better hashing algorithm */
  swap delta, lastNtable[ indexNtable ]
  indexNtable = (indexNtable+1) mod N
  hash ^= delta

  t = counter /* counts the number of samples so far */
  counter++
  swap t, lastseen[ hash & (TABLESIZE-1) ]
  diff = lastseen[ hash & (TABLESIZE-1) ] - t

  if diff<=N, assume no entropy (or fractional entropy?)
  otherwise return log2(diff)


Comments?
Rob. 

---
Send a blank message with the subject "send pgp-key"
to <[email protected]> for a copy of my PGP key.