Added scatter plots from Cor van Wandelen
This commit is contained in:
@@ -570,11 +570,17 @@ are added to a signal already saturated with thermal noise, making it in no less
|
||||
Every cycle, a new thermal noise sample is added to the state, causing less correlation
|
||||
with previous states.
|
||||
|
||||
Cor van Wandelen was kind enough to create these scatter plots showing the non-randomness
|
||||
in the raw output.
|
||||
 Thanks, EagleWorks!
|
||||
just wasn't good enough for him :-) Thanks, EagleWorks! Cor van Wandelen created the
|
||||
color and scatter plots.
|
||||
|
||||
### Free As in Freedom
|
||||
|
||||
|
||||
12
plots/README
Normal file
12
plots/README
Normal file
@@ -0,0 +1,12 @@
|
||||
Thanks to Cor van Wandelen for writing these two programs, colormap.py and scatterplot.py.
|
||||
He used these to create these png files from his inifinite noise TRNG.
|
||||
|
||||
To recreate similar plots, you can use data in the samples directory, and these commands:
|
||||
|
||||
$ cp ../samples/infnoise_raw.bin infnoise.bin
|
||||
$ python colormap.py
|
||||
$ python scatterplot.py
|
||||
|
||||
I created the raw data files with:
|
||||
|
||||
$ sudo ../software/infnoise --debug --raw > infnoise_raw.bin
|
||||
28
plots/colormap.py
Normal file
28
plots/colormap.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib import cm
|
||||
|
||||
filename='infnoise.bin'
|
||||
|
||||
nx = 1000
|
||||
ny = 1000
|
||||
|
||||
data = np.fromfile(open(filename,'rb'), dtype=np.uint8, count=nx*nx)
|
||||
data.resize(nx,ny)
|
||||
|
||||
plt.xlim(0, nx)
|
||||
plt.ylim(0, ny)
|
||||
|
||||
plt.xlabel('samples')
|
||||
plt.ylabel('samples')
|
||||
plt.title('TRNG ' + filename)
|
||||
|
||||
#cax = plt.imshow(data, interpolation='nearest', cmap=cm.coolwarm)
|
||||
cax = plt.imshow(data, interpolation='nearest', cmap=cm.afmhot)
|
||||
cbar = plt.colorbar(cax, ticks=[255, 127, 0])
|
||||
cbar.ax.set_yticklabels(['255', '127', '0'])
|
||||
|
||||
plt.savefig(filename + '-colormap.png')
|
||||
plt.show()
|
||||
BIN
plots/infnoise-raw-notraw-scatter.gif
Normal file
BIN
plots/infnoise-raw-notraw-scatter.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
BIN
plots/infnoise-raw.bin-colormap.png
Normal file
BIN
plots/infnoise-raw.bin-colormap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 430 KiB |
BIN
plots/infnoise-raw.bin-scatter.png
Normal file
BIN
plots/infnoise-raw.bin-scatter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
BIN
plots/infnoise.bin-colormap.png
Normal file
BIN
plots/infnoise.bin-colormap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 427 KiB |
BIN
plots/infnoise.bin-scatter.png
Normal file
BIN
plots/infnoise.bin-scatter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
28
plots/scatterplot.py
Normal file
28
plots/scatterplot.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
filename='infnoise.bin'
|
||||
|
||||
bp = np.dtype([('byte1',np.uint8),('byte2',np.uint8)]) # 'struct' byte pairs
|
||||
|
||||
Z = np.fromfile(filename, dtype=bp, count=2000) # read 2000 byte pairs from binary file
|
||||
|
||||
x, y = zip(*Z) # unpack Z pairs into lists
|
||||
|
||||
plt.grid(True)
|
||||
|
||||
plt.xlim(0, 255)
|
||||
plt.ylim(0, 255)
|
||||
|
||||
plt.xlabel('bytes')
|
||||
plt.ylabel('bytes')
|
||||
plt.title('TRNG ' + filename)
|
||||
|
||||
plt.scatter(x[:1000],y[:1000])
|
||||
|
||||
plt.savefig(filename + '-scatter.png')
|
||||
plt.show()
|
||||
|
||||
|
||||
34
samples/infnoise_raw.bin
Normal file
34
samples/infnoise_raw.bin
Normal file
File diff suppressed because one or more lines are too long
BIN
samples/infnoise_whitened.bin
Normal file
BIN
samples/infnoise_whitened.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user