RE: [AVR-Chat] Multimaster network
2005-03-09 by Chuck Hackett
> From: Brian Dean > > > .... given two devices containing identical hardware, > > software and reset at the same time (i.e.: has the same "life > > history") how does it generate a random number with a high > > probability of being different from other devices? > > One thing I had played with was letting one of the A/D lines float, > and use it's value for the seed. I like this one if the configuration has an open A/D line, or, one might even be able to use a used A/D line if the signal being sampled is not also being fed to another device you don't want to conflict with ... although you probably would get a different A/D result in different devices even if they were connected to the same power, clock, Vref and input signal so that might even work due to noise, chip temp, etc.. > Another alternative is to set one of the timers to free-run, then when > the first uart receive interrupt occurs, use the timer value at that > time for the seed. Due to variations in the crystals, chances are > those counters won't be the same for any two boards except for very > high precision clock sources. That would be worth experimenting withy ... > If one wanted to get really really good random number sequences, like > cryptographic quality randomness, another method would be to use a > radioactive source and detector. Between any three detector hits, if > the time between the first to the second is greater than the second to > the third, call that a "1" bit, otherwise call it a "0" bit. You'll > get some very seriously high quality random data that way, though the > effort might not be worth it in this application :-) I don't know about you, but my projects don't have radioactive sources in them :-) I maintained Crypto equipment in the Air Force and IIRC they used "noisy" diodes as a source for random data. > > .... Are there register/memory > > contents of an AVR that are truly "random" at power-up/reset and not > > dependent on the device's past history? > > Not that I'm aware of. I think you'd have to use some environmental > entity that you can measure, or use small variations in crystals, etc, > to provide different seed values for the pseudo random number > generator. Amazing how much work we have to go through to get truly "random" numbers out of a powerful computer/microcontroller. Thankfully there aren't many applications that require truly random number sequences. Thanks for the info ... Cheers, Chuck Hackett "Good judgment comes from experience, experience comes from bad judgment" 7.5" gauge Union Pacific Northern (4-8-4) 844 http://www.whitetrout.net/Chuck