The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // TrueRandomSeed.ino | |
| // This example sketch shows how to provide a truly random seed value to the built in | |
| // library pseudo random number generator. This ensures that your sketch will be | |
| // using a different sequence of random numbers every time it runs. Unlike the | |
| // usually suggested randomSeed(analogRead(0)) this method will provide a much more | |
| // uniform and varied seed value. For more information about the basic technique used | |
| // here to produce a random number or if you need more than one such number you can | |
| // find a library, Entropy from the following web site along with documentation of how | |
| // the library has been tested to provide TRUE random numbers on a variety of AVR | |
| // chips and arduino environments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * tiny_IRremote | |
| * Version 0.2 July, 2016 | |
| * Christian D'Abrera | |
| * Fixed what was originally rather broken code from http://www.gammon.com.au/Arduino/ | |
| * ...itself based on work by Ken Shirriff. | |
| * | |
| * This code was tested for both sending and receiving IR on an ATtiny85 DIP-8 chip. | |
| * IMPORTANT: IRsend only works from PB4 ("pin 4" according to Arduino). You will need to | |
| * determine which physical pin this corresponds to for your chip, and connect your transmitter |