Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2000 18:48:05 -0700 (PDT)
From:      Kris Kennaway <kris@FreeBSD.org>
To:        arch@freebsd.org
Subject:   Quantifying entropy
Message-ID:  <Pine.BSF.4.21.0007211831540.68809-200000@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1437619991-964230485=:68809
Content-Type: TEXT/PLAIN; charset=US-ASCII

I've been playing around with measuring the entropy of sound card
microphone inputs when they have no microphone attached (i.e. intrinsic
noise in the sound card). I've tested on two systems: my SB16 and a
CS423x, and found quite different results:

My SB16 in 8bit mode has about 0.06 bits of entropy per sample
The CS423x has about 5.8 bits per sample (!).

SB16 in 16bit mode recording seems to be broken at the moment.
CS423x in 16bit mode has about 8.5 bits per sample.

The noise spectra look mostly gaussian (except for the SB16 which gives a
weird quantized spectrum of only 5 possible return values and a strongly
correlated output pattern ;-, though I've not plotted them, but only
inspected the frequency distribution table. I haven't performed any
statistical tests for signal correlation beyond calculating the Shannon
entropy in the probability distribution. I'd be interested to see results
from other people (test program attached)

What this seems to suggest is that in the wider picture of gathering
entropy, the amount of noise in a given (logical) source is going to be
very hardware and system-specific, and trying to assign a fixed weight to
it may either grossly overestimate or underestimate the amount of true
entropy in the sample.

It would seem to make sense then to provide a way for a userland tool to
attach to a specific entropy provider in the kernel, which would be fed
the raw measurements from the source for analysis over some representative
sample period. Using some tool or set of tools the entropy of the signal
can be calculated and then the weighting of the source tuned in the
kernel, using sysctl or something (although making it persistent might be
a problem).

We can still try and provide a set of resonable defaults by gathering and
averaging measurements from a lot of different systems, but an interested
administrator can tune things more efficiently for his local system.

Kris

--
In God we Trust -- all others must submit an X.509 certificate.
    -- Charles Forsythe <forsythe@alum.mit.edu>

--0-1437619991-964230485=:68809
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="entropy.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.21.0007211848050.68809@freefall.freebsd.org>
Content-Description: 
Content-Disposition: attachment; filename="entropy.c"

I2luY2x1ZGUgPHN5cy90aW1lLmg+DQojaW5jbHVkZSA8c3lzL3R5cGVzLmg+
DQojaW5jbHVkZSA8c3lzL2lvY3RsLmg+DQojaW5jbHVkZSA8c3lzL3NvdW5k
Y2FyZC5oPg0KDQojaW5jbHVkZSA8ZXJyLmg+DQojaW5jbHVkZSA8ZmNudGwu
aD4NCiNpbmNsdWRlIDxtYXRoLmg+DQojaW5jbHVkZSA8c3RkaW8uaD4NCiNp
bmNsdWRlIDxzdHJpbmcuaD4NCiNpbmNsdWRlIDx1bmlzdGQuaD4NCg0KI2Rl
ZmluZSBERVYgIi9kZXYvZHNwIg0KDQppbnQgbWFpbigpIHsNCiAgaW50IGks
IGosIGZkOw0KICB1aW50MTZfdCBidWZbODE5Ml07IA0KICB1bnNpZ25lZCBs
b25nIG49MCwgbT0wOw0KICB1aW50MzJfdCBwWzY1NTM2XTsNCiAgZmxvYXQg
cywgcHIsIGxuMjsNCiAgc3RydWN0IHRpbWV2YWwgdHYxLCB0djI7DQogIHN0
cnVjdCBfc25kX2NhcGFiaWxpdGllcyBzbmRjYXA7DQogIHN0cnVjdCBfc25k
X2NoYW5fcGFyYW0gc25kcGFyOw0KICANCiAgbG4yID0gbG9nZigyKTsNCg0K
ICBpZiAoKGZkID0gb3BlbihERVYsIE9fUkRXUnxPX05PTkJMT0NLKSkgPT0g
TlVMTCkNCiAgICBlcnIoMSwgIm9wZW4iKTsNCiAgDQogIGlmIChpb2N0bChm
ZCwgQUlPR0NBUCwgJnNuZGNhcCkgPT0gLTEpDQogICAgZXJyKDEsICJBSU9H
Q0FQIik7DQoNCiAgcHJpbnRmKCJtaW49JWQgbWF4PSVkXG4iLCBzbmRjYXAu
cmF0ZV9taW4sIHNuZGNhcC5yYXRlX21heCk7DQoNCiAgc25kcGFyLnBsYXlf
cmF0ZT1zbmRjYXAucmF0ZV9tYXg7DQogIHNuZHBhci5yZWNfcmF0ZT1zbmRj
YXAucmF0ZV9tYXg7DQogIHNuZHBhci5wbGF5X2Zvcm1hdD1BRk1UX1MxNl9M
RTsNCiAgc25kcGFyLnJlY19mb3JtYXQ9QUZNVF9TMTZfTEU7DQoNCiAgaWYg
KChpb2N0bChmZCwgQUlPU0ZNVCwgJnNuZHBhcikpID09IC0xKQ0KICAgIGVy
cigxLCAiQUlPU0ZNVCIpOw0KICANCiAgYnplcm8ocCwgc2l6ZW9mKHApKTsN
CiAgDQogIGdldHRpbWVvZmRheSgmdHYxLCBOVUxMKTsNCiAgDQogIHdoaWxl
KDEpIHsNCiAgICBpID0gcmVhZChmZCwgJmJ1Ziwgc2l6ZW9mKGJ1ZikpOw0K
ICAgIGZvcihqPTA7ajwoaS8yKTtqKyspIHsNCiAgICAgIHBbYnVmW2pdXSsr
Ow0KICAgICAgbisrOw0KICAgIH0NCiAgICBtKys7DQogICAgaWYgKG0gJSA1
MDAwMDAgPT0gMCkgew0KICAgICAgcz0wLjsNCiAgICAgIGdldHRpbWVvZmRh
eSgmdHYyLCBOVUxMKTsNCiAgICAgIGZvcihpPTA7aTw2NTUzNjtpKyspIHsN
CiNpZmRlZiBERUJVRw0KCWlmIChwW2ldKSBwcmludGYoIiVkPSVkICIsaSxw
W2ldKTsNCiNlbmRpZg0KCXByID0gKChmbG9hdClwW2ldLyhmbG9hdCluKTsN
CglpZiAocHIgIT0gMC4pIHsNCgkgIHMgLT0gcHIgKiBsb2dmKHByKS8gbG4y
Ow0KCX0NCiAgICAgIH0NCiAgICAgIHByaW50ZigibiA9ICVkLCByYXRlID0g
JWYsIHMgPSAlZlxuIiwgbiwgKGZsb2F0KShuKS8odHYyLnR2X3NlYyAtIHR2
MS50dl9zZWMpLCBzKTsNCiAgICB9DQogIH0NCn0NCg==
--0-1437619991-964230485=:68809--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0007211831540.68809-200000>