NOBODY can solve this - Generating random numbers on an ATmega328p
Вставка
- Опубліковано 22 лис 2022
- Creating random numbers is easy right? Just call the rand() function... but how does that actually work? With so much of modern security and cryptography relying on these random numbers, it's important that the numbers actually are random. Find out how these numbers are randomly created.
-- Links --
My Website: sinelab.net
ENT: www.fourmilab.ch/random/
AVR Crypto Library (SHA-256): github.com/cantora/avr-crypto...
LCG Algorithm: en.wikipedia.org/wiki/Linear_...
Microcontroller Code: sinelab.net/code/RNG/main.c
PC LCG Code: sinelab.net/code/RNG/LCG.c
-- - Наука та технологія
just a small correction: at 9:43, the miners don't "reverse" a hash, they try to append random garbage to the end of each block so that the hashes match a certain number of 0 at the beginning. you might know that already, since 2 seconds ago you had an image with those 0s there, tongue slips happen, but just wanted to make sure that to someone else hearing this to not get fooled into thinking SHA2 is reversible for anything other than rainbow tables (we havent even found the 256 0s or 1s pattern as far as i am aware)
edit: this does not change the validity of the method shown in the video, it basically empowers it even further
This is super good and so cool that you showed a practical example of an entropy source. My favorite example is the Cloudflare lava lamps 💡.
The way GPU shaders generate "random" numbers is also very interesting.
Reading floating analog pins is a great way to get entropy on micro boards. I'm going to have to keep that in my back pocket.
I'm sure you'll use it sooner or later
Somebody help this kid out.
Here is an example of how to generate a random number between 0 and 10:
int randomNumber = random(10);
If you need truly random numbers, you can use the "noise()" function in conjunction with an analog input, such as a photoresistor, to generate random numbers based on environmental noise. Here is an example of how to generate a random number between 0 and 10 using the "noise()" function:
int randomNumber = noise(analogRead(A0)) % 10;
Keep in mind that the quality of random numbers generated using this method depends on the quality of the analog input used.
'If you need truly random numbers', advises to use a 10 bit ADC input which is very predictable with only 1024 possible states, with a photoresistor tied to it predicting the number becomes quite easy, even easier than when leaving the input floating.
I used A0 input which was floating in the air and read the last digit on that port ADC value to be the random number for electronic dice with large led strips to create the 7 segment display with slow down feature :)
Used 2 Adc inputs and the selection between them was pseudo random.
Great video. An improvement would be to drive a diode or transistor in reverse breakdown mode and amplify the signal to the ADC-s voltage range. That way you get a good entropy signal from thermal noise.
That's an interesting way to generate entropy.
Well made as always!
Glad you enjoyed!
The problem with the readout of open analog pins is that they are sensitive to EM. And a lot of the environmental EM is predictable. Another important point is to use noise source which is evenly distributed. Noise of semiconductor sources is often "colored". So I prefer metal film resistors as noise source in combination with a low noise opamp, whos input referred noise is considerably lower than the noise of the resistive noise source (100 kOhm resistor) in order to do signal conditioning for the analog input by use of amplification and offset.
Thanks for sharing! I didn't really think much about the predictability of environmental EM, so it's definitely something to consider. The inclusion of a metal film resistor is definitely intriguing to say the least :)
awesomesauce!
Another excellent video!
Thank you!
"Why else would we create coins?" No reason, other than to flip them. Coins aren't used for anything else.
Why didn’t you use the random and noise functions? Generating a random number on micros is actually easier than a pc if you’re willing to add some hardware. It’s pretty easy to come up with a seed that’s impossible to guess if you leverage inputs with high entropy. For example, a well calibrated photo resistor in front of a lava lamp.
Attached to a 10 bit ADC... If you at least add a high precision ADC this becomes useful but with just 10 bits it's a joke for RnG.
"Anyone who considers arithmetic methods of generating random digits is, of course, in a state of sin"
John Von Neumann
Everytime u get to say something, u breath, it is not an issue but as a suggestion, u should look out for that. (Sounds kinda weird, but my point is that for each sentence, we get to hear u taking a fast breath)
Also, what’s an algithim?
honestly i like itb feels more real
🤎💙💚💜❤️