View display_ip.py
#!/usr/bin/env python | |
import socket | |
from time import sleep | |
from blinkt import set_clear_on_exit, set_pixel, show | |
colors = [ | |
[ 0, 0, 0],#0 black | |
[ 32, 32, 0],#1 brown | |
[255, 0, 0],#2 red |
View DiceAnalysis.R
# Analyze dice data to establish if it is random | |
setwd("~/Development/hardware-rng/avr-hardware-random-number-generation/Entropy/examples/Dice") | |
library(foreign) | |
library(prettyR) | |
sink("analysis.prn") | |
Dice.data <- read.csv("dice.txt") | |
Dice.data$Sum <- Dice.data$Die1 + Dice.data$Die2 | |
png(filename="cumulative.png", width=800, height=600) | |
hist(Dice.data$Sum, | |
freq=FALSE, |
View TrueRandomSeed.ino
// 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. |
View due_hwrng_test.ino
// DUE's TRNG 32 bits every 84 ticks | |
#include <sam.h> | |
#include <sam3xa/include/component/component_trng.h> | |
uint32_t test_hwrng() | |
{ | |
static bool enabled = false; | |
if (!enabled) { | |
pmc_enable_periph_clk(ID_TRNG); | |
TRNG->TRNG_IDR = 0xFFFFFFFF; |
View due_hwrng_speed_test.ino
// due_hwrng_speed_test.ino | |
// by Walter Anderson | |
// April 5, 2014 | |
// | |
// This is a speed test run on an Arduino Due with an ATSAM3X8E-AU chip dated 1317, it produced the following | |
// output: | |
// Starting time test for speed of generation of hardware randrom number gebnrator. | |
// It took 262 milliseconds to generato 1,048,576 bytes of entropy! | |
// This equates to 4,002,198 bytes per second! | |
// |
View long2bin.py
#! /usr/bin/python | |
import sys | |
import struct | |
try: | |
infilename = sys.argv[1] | |
outfilename = sys.argv[2] | |
maxsize = int(sys.argv[3]) | |
except: |
View RandomCardDraw.pde
// FILE: RandomCardDraw.ino | |
// AUTHOR: Rob Tillaart and Walter Anderson | |
// VERSION: 1.0.0 | |
// PURPOSE: generate random sequence (optimized) | |
// DATE: April 24, 2014 | |
// URL: | |
// The Entropy library provides true random numbers and can be obtained from: | |
// http://code.google.com/p/avr-hardware-random-number-generation/wiki/WikiAVRentropy | |
#include <Entropy.h> |
View analyze.py
#! /usr/bin/python | |
# | |
# This program will take a file name from the command line and analyze its entropy, using many of the same algorithms | |
# as the ent program from hotbits | |
import sys | |
import struct | |
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.mlab as mlab |