-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better random number generation from RSSI #150
base: master
Are you sure you want to change the base?
Conversation
FYI, here is Semtech implementation on SX1276 driver (no Von Neumann Extractor, but maybe the 1ms delay between samples is useful):
|
Aye - the extractor just helps to normalise the probabilities (P(0)=P(1)=0.5 under this scheme of output). It's not critical, but it's recommended to do some sort of whitening of this kind. :) Many thanks! M. |
In testing this PR it just hangs for me. Presumably |
Any updates on the hanging? |
I'm messing with random this weekend and I found https://gist.github.com/endolith/2568571 |
There is another PR #395 where is added the seed necessary to have better random numbers |
Hello,
The API call LoRa.random() gave users really bad random numbers. They need some level of whitening in order to be useful, so I've added some rather dirty (sorry!) code to implement a von Neumann Extractor. It's normally implemented in three functions, but I didn't want to bloat the class - feel free to edit it to make it more stylistic if you like :) See here for more information: https://en.wikipedia.org/wiki/Randomness_extractor#Von_Neumann_extractor
I tested the code that was originally there, and the random numbers were disappointing - I can send samples if you would like. This code will generate better random numbers. I also added a warning that these are not cryptographically secure, as I haven't proven that they are otherwise yet. :P
The speed is slightly slower, but very fast in the grander scheme of things (other entropy pools take a long time to generate entropy). I'm happy to answer any questions.
Many thanks! M.