Skip to content

Instantly share code, notes, and snippets.

View jasonnyland's full-sized avatar

Jason Nyland jasonnyland

  • Sacramento, CA
View GitHub Profile
@bloc97
bloc97 / TwoMethods.md
Last active March 2, 2025 10:14
Two Fast Methods of Generating True Random Numbers on the Arduino

Two Fast Methods of Generating True Random Numbers on the Arduino

Arduino true random number generator

B. Peng

December 2017

Abstract

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

@cleure
cleure / teensy-nes-gamepad.c
Last active March 21, 2025 20:08
More advanced NES / SNES to USB adapter, using a Teensy 2.0 board. Controller type can now be auto-detected, and there's an option to translate button presses to either USB Joystick or USB Keyboard events.
#include <stdint.h>
// GPIO pins used for connected gamepad
#define CLOCK 21
#define LATCH 20
#define DATA 19
#define DEVICE_TYPE_AUTO 0
#define DEVICE_TYPE_NES 1
#define DEVICE_TYPE_SNES 2