Watchdog RNG questions

Go To Last Post
43 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've got a project where I want to use the watchdog timer vs. the main oscillator (internal 8MHz) as an RNG.  I've done this before a few times while playing with RNG's.  This is on a mega1284p.  The quickest I can set the watchdog to fire its interrupt is 128000/2048 or 62.5 times a second.  I have another timer (TIMER2) clocked 1:1 with the main clock which is at 8 MHz.

 

Obviously the safest thing to do is to capture a single LSB from TIMER2 in the watchdog interrupt, but I'd rather grab 2, 3, or 4 bits to make the RNG produce data a bit more quickly.  The question is, for any of you with math skills, how many bits will be decent for doing this?  In the 16 milliseconds it takes for the watchdog to fire, around 128000 main oscillator cycles have occurred.  How much jitter is there between the two clocks and in this 16ms period,

 

I suppose maybe I should switch to using a 16 bit timer and let it run and see what type of range I get by letting it run...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's a 20-year-old paper on the subject.

 

You need a good mixing algorithm, a function that

has an "entropy pool" and accepts some input and

somehow mixes it all together.  Never reveal the

contents of the entropy pool, but use it to create

one or several pseudo-random sequences.

 

Put in the entire TCNT at each watchdog interrupt

to maximize the amount of entropy added.  Also

throw in any other unpredictable events: external

interrupts, ADC values, flags register, PIN reads,

UART character receive times and maybe even the

character values....

 

Trying to determine how much entropy is actually

being collected could be your PhD thesis.

 

--Mike

 

EDIT: removed google from pdf link

 

Last Edited: Sat. Jan 5, 2019 - 01:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I’ve read some where just reading the ADC with a floating input makes a decent RNG on an AVR.

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been trying out some ADC stuff Jim.  I've got a few questions - using a 1284P in a DIP:

 

Q#1 - I noticed that it has some differential input modes, but a note says :

 

Note: 1. The differential input channels are not tested for devices in PDIP Package. This feature is only ensured to work
for devices in TQFP and VQFN/QFN/MLF Packages.

 

Any idea why this is?  My breadboard testing is in a PDIP, but I will be using a TQFP in my final project.

 

Q#2 - Why do some show the same pin for positive and negative?  What sense does this make?  01010 = ADC0 ADC0 for example.

 

Q#3 - Would the gain of 10X or 200X compared to 1X provide any additional benefit if trying to use disconnected pins as a possible entropy source.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does your project do?

 

If you only need pseudo-random bits, and not real entropy

then take a look at linear feedback shift registers (LFSR).

 

These produce a completely deterministic, but random-

looking stream of bits.  The output eventually repeats, but

you can make the sequence as long as you like.  A 23-bit

LFSR repeats after 8 million bits, for example.

 

To achieve a different random sequence every time you

run your code, keep a seed value in EEPROM and increment

it at startup.

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
Q#2 - Why do some show the same pin for positive and negative? What sense does this make? 01010 = ADC0 ADC0 for example.
Offset calibration.  It's mentioned in the datasheet.

 

I don't expect you'll get much true entropy from the ADC, unless you're sampling the output of an opamp using a diode or other semi as a noise source.  The predominant noise from an unconnected ADC input will be your local mains frequency and its harmonics.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I seem to remember that Colin O'Flynn wrote some notes about all this stuff about 15 years ago. Might be worth looking out. Also I'm pretty sure the Tutorial forum has an article about RNG too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh deep joy, I cannot edit that post because of the security certificate issue so let's try this.

 

Remarkably Search found the Tutorial article I was thinking of:

 

https://www.avrfreaks.net/forum/...

 

the PDF that had been in #1 is now duplicated in #20

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am hoping OP is not trying to create a hardware RNG for

security purposes!

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avr-mike wrote:

I am hoping OP is not trying to create a hardware RNG for
security purposes!

 

Only for my own entertainment.  I am trying to get some real entropy to seed a PRNG.  I'd love to play around with some white noise generation circuits, but only if they aren't massive complicated and would consistently work through a voltage range of 2.5V-5V.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:

... and would consistently work ...

 

This is the hard part.  If you really need the entropy

then you have to monitor the output of the RNG and

test whether it's working as designed, not stuck at a

rail, or whatever.  Temperature might affect operation

or external noise, etc.

 

They used to sell noise diodes, not sure if they're still

available.  Wikipedia has some info which might be

helpful: Hardware random number generator

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You wouldn't like to add a network interface to your device (maybe EPS wifi),. While Linux etc feed things like mouse and key events into their /dev/rnd entropy pool the thing that really makes it random is just sniffing certain details of network packets. Consider the modern household and the 15+ devices all having regular chats with your router and the outside world - Plenty of entropy there!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a (poorly written) library which uses jitter between the wdt and the system clock to generate entropy. One bit per 15ms. Sounds like you've got the same or similar, but are hoping to get more throughout? Not sure it's possible. As suggested. You'll need to do some statistical analysis. Generate a data set and feed it to dieharder. I recall doing that some years ago with the 64bps library. Results were good but it took a while ;-)

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

More throughput would be nice, 62.5 bits per second is workable, but could be faster.  I've been using a command prompt tool I found (ENT) to evaluate random streams various things produce.  I was thinking if there was anything to be had from the ADC that it could be combined with the watchdog perhaps...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that at least one member here has observed that the RC oscillator will phase lock with the wdt oscillator reducing the amount of entropy available. So you really should be using a crystal, or a resonator, or an external clock. I haven't confirmed these findings.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't like the sound of that though I haven't seen it the few times I've tested the watchdog for this purpose.  I want it to have a super low power mode with inactivity, but I think power down shuts the crystal down too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It does.  The startup sequence is longer, thus if you go in and out of sleep often this will add to consumption, and you must account for it with the very lowest power applications.

 

I expect the phase-locking issue will differ from device to device, and process to process.  Older devices devoted massively more silicon real estate to the oscillator, resulting in better stability than later devices and die revisions.  Newer oscillator versions exhibit more jitter, but I've never seen the propensity of the two on-chip RC oscillators to phase lock characterised.  I wouldn't* expect to see that from the manufacturer, since a jitter-based RNG is a fairly niche application.  Most would just go for a digital noise source like the RPi has.  Its /dev/random is a veritable firehose.

 

EDIT: *  oops, would was supposed to be wouldn't

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Thu. Jan 10, 2019 - 02:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The sleep is only for inactivity, so after an hour to do as deep a shutdown as possible as to not drain batteries because someone (like me) forgot to turn it off.  I can usually get less than 1mA.

 

Playing around with the ADC, I disconnected ADC0 and ADC1 and am using:

 

differential mode, ADC1 pos, ADC0 neg, 200X mode, reference AVCC, free running, 8MHz clock with clk/64 adc clock.  **EDIT it looks like I was doing clk/4**

 

Anything less than the 200X gain doesn't do very well...  Changing the ADC speed didn't seem to make much difference.

 

I am adding up 64 ADC results and then outputting the bottom 4 bits to the uart in hex.  I then convert that to a binary file and run it through ENT.EXE.  The chi square is usually the toughest thing it does and it usually hits one of the rails as the samples pile up.

 

380K + samples and doing ok.

 

#include <avr/io.h>
#include <avr/interrupt.h>
#include "avr/pgmspace.h"
#include "avr/sleep.h"

#define F_CPU 8000000

#include "cdelay.h"
#include "ddrpin.h"

void tx(uint8_t AByte)
  {
    while ((UCSR1A & _BV(UDRE1))==0)
      ;

    UCSR1A|=_BV(TXC1);

    UDR1=AByte;

    while ((UCSR1A & _BV(TXC1))==0)
      ;
  }

void txs(char *AString)
  {
    while (*AString)
      {
        tx(*AString);
        AString++;
      }
  }

const uint8_t HEX[] PROGMEM = "0123456789ABCDEF";

void tx12b(uint16_t ui1)
{
  uint8_t c1,c2,c3,c4;

  c4=ui1&15;
  /*ui1>>=4;
  c3=ui1&15;
  ui1>>=4;
  c2=ui1&15;
  ui1>>=4;
  c1=ui1&15;

  tx(pgm_read_byte(HEX+c1));
  tx(pgm_read_byte(HEX+c2));
  tx(pgm_read_byte(HEX+c3));*/
  tx(pgm_read_byte(HEX+c4));
//  tx(' ');
}

int main(void)
{
  //debug
  Delay_ms(100);

  //setup debug uart
  UBRR1=1; //250k baud
  UCSR1B=_BV(TXEN1); //tx only
  txs("INIT\r\n");

  sei();

  ADMUX=
        //0          |                 //AREF
        _BV(REFS0) |                 //AVCC
        //_BV(REFS1) |                 //1.1V
        //_BV(REFS0) | _BV(REFS1) |   //2.56V

        //0b00000 ; //ADC0 se
        //0b01001 ; //ADC1-ADC0 (10X)
        0b01011 ; //ADC1-ADC0 (200x)
        //0b10000 ; //ADC0-ADC1 (1x)

  ADCSRA=_BV(ADEN) | _BV(ADSC) | _BV(ADATE) | _BV(ADIE) |
         0b010 ; //clk/64
         //0b000 ;

  ADCSRB=0; //free running

  for(;;)
    {

//      tx12b(0x123);

//      Delay_s(1);
    }

  for(;;);
}

ISR(ADC_vect)
{
  static uint8_t count;
  static uint16_t z;

  z+=ADC;
  count++;
  if (count==64)
    {
      tx12b(z);
      z=0;
      count=0;
    }
}

 

Last Edited: Thu. Jan 10, 2019 - 02:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
D:\Temp\7\a>hex2byte n2 n2.bin

D:\Temp\7\a>ent n2.bin
Entropy = 7.999708 bits per byte.

Optimum compression would reduce the size
of this 640440 byte file by 0 percent.

Chi square distribution for 640440 samples is 259.17, and randomly
would exceed this value 41.57 percent of the times.

Arithmetic mean value of data bytes is 127.5216 (127.5 = random).
Monte Carlo value for Pi is 3.139591531 (error 0.06 percent).
Serial correlation coefficient is 0.003616 (totally uncorrelated = 0.0).

 

even better:

 

Entropy = 7.999914 bits per byte.

Optimum compression would reduce the size
of this 2138455 byte file by 0 percent.

Chi square distribution for 2138455 samples is 254.70, and randomly
would exceed this value 49.35 percent of the times.

Arithmetic mean value of data bytes is 127.4522 (127.5 = random).
Monte Carlo value for Pi is 3.145352671 (error 0.12 percent).
Serial correlation coefficient is 0.001160 (totally uncorrelated = 0.0).

 

Last Edited: Thu. Jan 10, 2019 - 01:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
've been using a command prompt tool I found (ENT) to evaluate random streams various things produce.
I don't know it.  I guess it's this?:

http://www.fourmilab.ch/random/

 

joeymorin wrote:
Generate a data set and feed it to dieharder.
I'd be interested to see the results.  I don't know if there are Windows binaries for it, but you can always boot up a Linux VM.  Or, post your dataset here and I'll run it for you.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, that is it.  I'll see about collecting a large data set.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've got a 2.2M data set taken with the clk/4 ADC running way too fast at 2M.  How do you want it?  PM me an email address if you'd like it emailed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can just attach it to a post here.  Or is it confidential? ;-)

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It isn't, but I didn't think the forum would let me attach a large binary file.  I'll try it.

 

n2.bin was with the incorrect clk/4 (ADC running at 2MHz by mistake, but seemed to work)

 

n3.bin was what I got last night running clk/64 (ADC at 125kHz).  It would be larger except MS decided to install updates, restart my system, and screw up the teraterm capturing I was doing...

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Size limit for attachments is 10 MB.

 

Larger data sets would be better for testing with dieharder.  Some of the tests required your n2 and n3 sets be read many times (some tests many thousands of times), so the results aren't particularly valid due to the repetition.

 

n2.bin:

$ dieharder -a -g 201 -f n2.bin
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |           filename             |rands/second|
 file_input_raw|                          n2.bin|  2.86e+07  |
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
# The file file_input_raw was rewound 24 times
   diehard_birthdays|   0|       100|     100|0.17760433|  PASSED
# The file file_input_raw was rewound 198 times
      diehard_operm5|   0|   1000000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 422 times
  diehard_rank_32x32|   0|     40000|     100|0.00145706|   WEAK
# The file file_input_raw was rewound 527 times
    diehard_rank_6x8|   0|    100000|     100|0.00001278|   WEAK
# The file file_input_raw was rewound 573 times
   diehard_bitstream|   0|   2097152|     100|0.30675058|  PASSED
# The file file_input_raw was rewound 939 times
        diehard_opso|   0|   2097152|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 1183 times
        diehard_oqso|   0|   2097152|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 1298 times
         diehard_dna|   0|   2097152|     100|0.10536991|  PASSED
# The file file_input_raw was rewound 1309 times
diehard_count_1s_str|   0|    256000|     100|0.00001036|   WEAK
# The file file_input_raw was rewound 1533 times
diehard_count_1s_byt|   0|    256000|     100|0.04113572|  PASSED
# The file file_input_raw was rewound 1537 times
 diehard_parking_lot|   0|     12000|     100|0.80220017|  PASSED
# The file file_input_raw was rewound 1540 times
    diehard_2dsphere|   2|      8000|     100|0.28542399|  PASSED
# The file file_input_raw was rewound 1542 times
    diehard_3dsphere|   3|      4000|     100|0.25262950|  PASSED
# The file file_input_raw was rewound 1944 times
     diehard_squeeze|   0|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 1944 times
        diehard_sums|   0|       100|     100|0.41340554|  PASSED
# The file file_input_raw was rewound 1962 times
        diehard_runs|   0|    100000|     100|0.10074179|  PASSED
        diehard_runs|   0|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 2198 times
       diehard_craps|   0|    200000|     100|0.00000000|  FAILED
       diehard_craps|   0|    200000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 5692 times
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00000000|  FAILED
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 5709 times
         sts_monobit|   1|    100000|     100|0.00000762|   WEAK
# The file file_input_raw was rewound 5727 times
            sts_runs|   2|    100000|     100|0.00001967|   WEAK
# The file file_input_raw was rewound 5744 times
          sts_serial|   1|    100000|     100|0.00000270|   WEAK
          sts_serial|   2|    100000|     100|0.03348506|  PASSED
          sts_serial|   3|    100000|     100|0.22462665|  PASSED
          sts_serial|   3|    100000|     100|0.21282007|  PASSED
          sts_serial|   4|    100000|     100|0.03363716|  PASSED
          sts_serial|   4|    100000|     100|0.15168815|  PASSED
          sts_serial|   5|    100000|     100|0.01014690|  PASSED
          sts_serial|   5|    100000|     100|0.00788496|  PASSED
          sts_serial|   6|    100000|     100|0.00199017|   WEAK
          sts_serial|   6|    100000|     100|0.00097324|   WEAK
          sts_serial|   7|    100000|     100|0.09006322|  PASSED
          sts_serial|   7|    100000|     100|0.00197890|   WEAK
          sts_serial|   8|    100000|     100|0.00000001|  FAILED
          sts_serial|   8|    100000|     100|0.00000000|  FAILED
          sts_serial|   9|    100000|     100|0.00159188|   WEAK
          sts_serial|   9|    100000|     100|0.11616008|  PASSED
          sts_serial|  10|    100000|     100|0.41293142|  PASSED
          sts_serial|  10|    100000|     100|0.00059069|   WEAK
          sts_serial|  11|    100000|     100|0.00150671|   WEAK
          sts_serial|  11|    100000|     100|0.00000000|  FAILED
          sts_serial|  12|    100000|     100|0.00163491|   WEAK
          sts_serial|  12|    100000|     100|0.11459676|  PASSED
          sts_serial|  13|    100000|     100|0.18262577|  PASSED
          sts_serial|  13|    100000|     100|0.02928495|  PASSED
          sts_serial|  14|    100000|     100|0.06659271|  PASSED
          sts_serial|  14|    100000|     100|0.04015395|  PASSED
          sts_serial|  15|    100000|     100|0.07401015|  PASSED
          sts_serial|  15|    100000|     100|0.17795678|  PASSED
          sts_serial|  16|    100000|     100|0.01367970|  PASSED
          sts_serial|  16|    100000|     100|0.07074597|  PASSED
# The file file_input_raw was rewound 5779 times
         rgb_bitdist|   1|    100000|     100|0.00000093|  FAILED
# The file file_input_raw was rewound 5849 times
         rgb_bitdist|   2|    100000|     100|0.00420261|   WEAK
# The file file_input_raw was rewound 5954 times
         rgb_bitdist|   3|    100000|     100|0.00002559|   WEAK
# The file file_input_raw was rewound 6093 times
         rgb_bitdist|   4|    100000|     100|0.00095538|   WEAK
# The file file_input_raw was rewound 6268 times
         rgb_bitdist|   5|    100000|     100|0.45453186|  PASSED
# The file file_input_raw was rewound 6478 times
         rgb_bitdist|   6|    100000|     100|0.38116608|  PASSED
# The file file_input_raw was rewound 6722 times
         rgb_bitdist|   7|    100000|     100|0.45165481|  PASSED
# The file file_input_raw was rewound 7002 times
         rgb_bitdist|   8|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 7316 times
         rgb_bitdist|   9|    100000|     100|0.72221217|  PASSED
# The file file_input_raw was rewound 7666 times
         rgb_bitdist|  10|    100000|     100|0.80753540|  PASSED
# The file file_input_raw was rewound 8050 times
         rgb_bitdist|  11|    100000|     100|0.60878936|  PASSED
# The file file_input_raw was rewound 13279 times
         rgb_bitdist|  12|    100000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 13333 times
rgb_minimum_distance|   2|     10000|    1000|0.00000000|  FAILED  
# The file file_input_raw was rewound 13416 times
rgb_minimum_distance|   3|     10000|    1000|0.00000000|  FAILED  
# The file file_input_raw was rewound 13525 times
rgb_minimum_distance|   4|     10000|    1000|0.00000000|  FAILED  
# The file file_input_raw was rewound 13662 times
rgb_minimum_distance|   5|     10000|    1000|0.00000000|  FAILED  
# The file file_input_raw was rewound 13717 times
    rgb_permutations|   2|    100000|     100|0.19765034|  PASSED  
# The file file_input_raw was rewound 13799 times
    rgb_permutations|   3|    100000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 13909 times
    rgb_permutations|   4|    100000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 14045 times
    rgb_permutations|   5|    100000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 14319 times
      rgb_lagged_sum|   0|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 14867 times
      rgb_lagged_sum|   1|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 15689 times
      rgb_lagged_sum|   2|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 16784 times
      rgb_lagged_sum|   3|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 18153 times
      rgb_lagged_sum|   4|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 19796 times
      rgb_lagged_sum|   5|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 21713 times
      rgb_lagged_sum|   6|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 23904 times
      rgb_lagged_sum|   7|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 26369 times
      rgb_lagged_sum|   8|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 29107 times
      rgb_lagged_sum|   9|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 32120 times
      rgb_lagged_sum|  10|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 35406 times
      rgb_lagged_sum|  11|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 38966 times
      rgb_lagged_sum|  12|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 42800 times
      rgb_lagged_sum|  13|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 46908 times
      rgb_lagged_sum|  14|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 51289 times
      rgb_lagged_sum|  15|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 55945 times
      rgb_lagged_sum|  16|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 60874 times
      rgb_lagged_sum|  17|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 66077 times
      rgb_lagged_sum|  18|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 71555 times
      rgb_lagged_sum|  19|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 77305 times
      rgb_lagged_sum|  20|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 83330 times
      rgb_lagged_sum|  21|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 89629 times
      rgb_lagged_sum|  22|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 96201 times
      rgb_lagged_sum|  23|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 103048 times
      rgb_lagged_sum|  24|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 110168 times
      rgb_lagged_sum|  25|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 117562 times
      rgb_lagged_sum|  26|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 125230 times
      rgb_lagged_sum|  27|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 133171 times
      rgb_lagged_sum|  28|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 141387 times
      rgb_lagged_sum|  29|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 149876 times
      rgb_lagged_sum|  30|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 158640 times
      rgb_lagged_sum|  31|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 167677 times
      rgb_lagged_sum|  32|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 167704 times
     rgb_kstest_test|   0|     10000|    1000|0.01408788|  PASSED  
# The file file_input_raw was rewound 168125 times
     dab_bytedistrib|   0|  51200000|       1|0.00000000|  FAILED  
# The file file_input_raw was rewound 168160 times
             dab_dct| 256|     50000|       1|0.00000056|  FAILED  
Preparing to run test 207.  ntuple = 0
# The file file_input_raw was rewound 168469 times
        dab_filltree|  32|  15000000|       1|0.00000000|  FAILED  
        dab_filltree|  32|  15000000|       1|0.00000000|  FAILED  
Preparing to run test 208.  ntuple = 0
# The file file_input_raw was rewound 168549 times
       dab_filltree2|   0|   5000000|       1|0.00000000|  FAILED  
       dab_filltree2|   1|   5000000|       1|0.00000000|  FAILED  
Preparing to run test 209.  ntuple = 0
# The file file_input_raw was rewound 168727 times
        dab_monobit2|  12|  65000000|       1|1.00000000|  FAILED  

n3.bin:

$ dieharder -a -g 201 -f n3.bin
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |           filename             |rands/second|
 file_input_raw|                          n3.bin|  1.76e+07  |
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
# The file file_input_raw was rewound 37 times
   diehard_birthdays|   0|       100|     100|0.35042274|  PASSED
# The file file_input_raw was rewound 311 times
      diehard_operm5|   0|   1000000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 662 times
  diehard_rank_32x32|   0|     40000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 826 times
    diehard_rank_6x8|   0|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 898 times
   diehard_bitstream|   0|   2097152|     100|0.00000005|  FAILED
# The file file_input_raw was rewound 1472 times
        diehard_opso|   0|   2097152|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 1855 times
        diehard_oqso|   0|   2097152|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 2035 times
         diehard_dna|   0|   2097152|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 2052 times
diehard_count_1s_str|   0|    256000|     100|0.08351294|  PASSED
# The file file_input_raw was rewound 2403 times
diehard_count_1s_byt|   0|    256000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 2409 times
 diehard_parking_lot|   0|     12000|     100|0.90162649|  PASSED
# The file file_input_raw was rewound 2414 times
    diehard_2dsphere|   2|      8000|     100|0.01223478|  PASSED
# The file file_input_raw was rewound 2417 times
    diehard_3dsphere|   3|      4000|     100|0.00123054|   WEAK
# The file file_input_raw was rewound 3050 times
     diehard_squeeze|   0|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 3050 times
        diehard_sums|   0|       100|     100|0.84905123|  PASSED
# The file file_input_raw was rewound 3077 times
        diehard_runs|   0|    100000|     100|0.26376145|  PASSED
        diehard_runs|   0|    100000|     100|0.87557846|  PASSED
# The file file_input_raw was rewound 3447 times
       diehard_craps|   0|    200000|     100|0.00000000|  FAILED
       diehard_craps|   0|    200000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 8924 times
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00000000|  FAILED
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 8952 times
         sts_monobit|   1|    100000|     100|0.01661300|  PASSED
# The file file_input_raw was rewound 8979 times
            sts_runs|   2|    100000|     100|0.95709219|  PASSED
# The file file_input_raw was rewound 9007 times
          sts_serial|   1|    100000|     100|0.02014215|  PASSED
          sts_serial|   2|    100000|     100|0.01823285|  PASSED
          sts_serial|   3|    100000|     100|0.01515966|  PASSED
          sts_serial|   3|    100000|     100|0.00270443|   WEAK
          sts_serial|   4|    100000|     100|0.00000007|  FAILED
          sts_serial|   4|    100000|     100|0.00000075|  FAILED
          sts_serial|   5|    100000|     100|0.07474125|  PASSED
          sts_serial|   5|    100000|     100|0.00000009|  FAILED
          sts_serial|   6|    100000|     100|0.03245611|  PASSED
          sts_serial|   6|    100000|     100|0.00052900|   WEAK
          sts_serial|   7|    100000|     100|0.00382004|   WEAK
          sts_serial|   7|    100000|     100|0.00024188|   WEAK
          sts_serial|   8|    100000|     100|0.00000020|  FAILED
          sts_serial|   8|    100000|     100|0.04954297|  PASSED
          sts_serial|   9|    100000|     100|0.00000000|  FAILED
          sts_serial|   9|    100000|     100|0.00000000|  FAILED
          sts_serial|  10|    100000|     100|0.01535212|  PASSED
          sts_serial|  10|    100000|     100|0.00000000|  FAILED
          sts_serial|  11|    100000|     100|0.03253391|  PASSED
          sts_serial|  11|    100000|     100|0.07121989|  PASSED
          sts_serial|  12|    100000|     100|0.20427642|  PASSED
          sts_serial|  12|    100000|     100|0.14101261|  PASSED
          sts_serial|  13|    100000|     100|0.00257475|   WEAK
          sts_serial|  13|    100000|     100|0.00005354|   WEAK
          sts_serial|  14|    100000|     100|0.01127633|  PASSED
          sts_serial|  14|    100000|     100|0.00312810|   WEAK
          sts_serial|  15|    100000|     100|0.05264950|  PASSED
          sts_serial|  15|    100000|     100|0.86832872|  PASSED
          sts_serial|  16|    100000|     100|0.03302878|  PASSED
          sts_serial|  16|    100000|     100|0.13705721|  PASSED
# The file file_input_raw was rewound 9061 times
         rgb_bitdist|   1|    100000|     100|0.86058045|  PASSED
# The file file_input_raw was rewound 9171 times
         rgb_bitdist|   2|    100000|     100|0.01903193|  PASSED
# The file file_input_raw was rewound 9335 times
         rgb_bitdist|   3|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 9554 times
         rgb_bitdist|   4|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 9828 times
         rgb_bitdist|   5|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 10157 times
         rgb_bitdist|   6|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 10540 times
         rgb_bitdist|   7|    100000|     100|0.73832490|  PASSED
# The file file_input_raw was rewound 10978 times
         rgb_bitdist|   8|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 11471 times
         rgb_bitdist|   9|    100000|     100|0.00000267|   WEAK
# The file file_input_raw was rewound 12019 times
         rgb_bitdist|  10|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 12621 times
         rgb_bitdist|  11|    100000|     100|0.93192310|  PASSED
# The file file_input_raw was rewound 13279 times
         rgb_bitdist|  12|    100000|     100|0.00000000|  FAILED
# The file file_input_raw was rewound 8504 times
rgb_minimum_distance|   2|     10000|    1000|0.00001222|   WEAK   
# The file file_input_raw was rewound 8557 times
rgb_minimum_distance|   3|     10000|    1000|0.00839229|  PASSED  
# The file file_input_raw was rewound 8627 times
rgb_minimum_distance|   4|     10000|    1000|0.00000001|  FAILED  
# The file file_input_raw was rewound 8714 times
rgb_minimum_distance|   5|     10000|    1000|0.00201063|   WEAK   
# The file file_input_raw was rewound 8749 times
    rgb_permutations|   2|    100000|     100|0.32693539|  PASSED  
# The file file_input_raw was rewound 8801 times
    rgb_permutations|   3|    100000|     100|0.00706375|  PASSED  
# The file file_input_raw was rewound 8871 times
    rgb_permutations|   4|    100000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 8959 times
    rgb_permutations|   5|    100000|     100|0.00161800|   WEAK   
# The file file_input_raw was rewound 9133 times
      rgb_lagged_sum|   0|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 9483 times
      rgb_lagged_sum|   1|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 10007 times
      rgb_lagged_sum|   2|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 10706 times
      rgb_lagged_sum|   3|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 11579 times
      rgb_lagged_sum|   4|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 12627 times
      rgb_lagged_sum|   5|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 13850 times
      rgb_lagged_sum|   6|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 15248 times
      rgb_lagged_sum|   7|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 16820 times
      rgb_lagged_sum|   8|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 18567 times
      rgb_lagged_sum|   9|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 20489 times
      rgb_lagged_sum|  10|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 22585 times
      rgb_lagged_sum|  11|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 24856 times
      rgb_lagged_sum|  12|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 27302 times
      rgb_lagged_sum|  13|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 29922 times
      rgb_lagged_sum|  14|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 32718 times
      rgb_lagged_sum|  15|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 35687 times
      rgb_lagged_sum|  16|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 38832 times
      rgb_lagged_sum|  17|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 42151 times
      rgb_lagged_sum|  18|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 45645 times
      rgb_lagged_sum|  19|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 49314 times
      rgb_lagged_sum|  20|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 53157 times
      rgb_lagged_sum|  21|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 57175 times
      rgb_lagged_sum|  22|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 61368 times
      rgb_lagged_sum|  23|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 65736 times
      rgb_lagged_sum|  24|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 70278 times
      rgb_lagged_sum|  25|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 74995 times
      rgb_lagged_sum|  26|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 79886 times
      rgb_lagged_sum|  27|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 84953 times
      rgb_lagged_sum|  28|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 90193 times
      rgb_lagged_sum|  29|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 95609 times
      rgb_lagged_sum|  30|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 101199 times
      rgb_lagged_sum|  31|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 106965 times
      rgb_lagged_sum|  32|   1000000|     100|0.00000000|  FAILED  
# The file file_input_raw was rewound 106982 times
     rgb_kstest_test|   0|     10000|    1000|0.04883713|  PASSED  
# The file file_input_raw was rewound 107250 times
     dab_bytedistrib|   0|  51200000|       1|0.00000000|  FAILED  
# The file file_input_raw was rewound 107273 times
             dab_dct| 256|     50000|       1|0.00000000|  FAILED  
Preparing to run test 207.  ntuple = 0
# The file file_input_raw was rewound 107470 times
        dab_filltree|  32|  15000000|       1|0.00000000|  FAILED  
        dab_filltree|  32|  15000000|       1|0.00000000|  FAILED  
Preparing to run test 208.  ntuple = 0
# The file file_input_raw was rewound 107521 times
       dab_filltree2|   0|   5000000|       1|0.00000000|  FAILED  
       dab_filltree2|   1|   5000000|       1|0.00000000|  FAILED  
Preparing to run test 209.  ntuple = 0
# The file file_input_raw was rewound 107635 times
        dab_monobit2|  12|  65000000|       1|1.00000000|  FAILED  

There are many more test results in the full suite (it's still running), but I have to head off to work.  I'll edit this post with the full results when I get home tonight, but most of them will fail due to the small size of the data set.

 

If you're up to producing a larger data set (In the GB rang would be good, but anything larger than n2.bin or n3.bin would be an improvement), and putting it somewhere, I'll give it a go.  However it might be easier for you to download, say, Ubuntu-Mate 18.04, booting up a VM (no need to install the OS), installing dieharder into the VM (still no need to install the OS), and running the tests yourself.

 

However, since:

alank2 wrote:
Only for my own entertainment. I am trying to get some real entropy to seed a PRNG.
It would really be for our entertainment ;-)

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Fri. Jan 11, 2019 - 02:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for running it Joey - I suppose I should grab a linux VM and see what I can do with it.  They call is dieharder for a reason, it looks pretty brutal!  At 8000000/13/64/64*4/8 bytes per second it will take quite a long time to get a huge sample set. (clk/adccyc/adcdiv/samples*acquiredbits/converttobytes).

 

>It would really be for our entertainment ;-)

 

Indeed so!

 

p.s. I like your location: location, location! :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
... but only if they aren't massive complicated and would consistently work through a voltage range of 2.5V-5V.
are simple, meet the required power voltage range, and current is a match for LSD NiMH cells (though more bandwidth means probably an order of magnitude more current)

Microchip has ZD op amps if have trouble sourcing the same from Linear Technology nee Analog Devices.

Pocket-Sized White-Noise Generator Quickly Tests Circuit’s Response

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avr-mike wrote:
They used to sell noise diodes, not sure if they're still

available.  Wikipedia has some info which might be

helpful: ...

Likewise in the current edition of AofE (avalanche a bipolar transistor); that design's digital electronics might be implementable in recent MCU that have "glue" logic blocks (XMEGA XCL, megaAVR 0-series CCL, PSoC, etc)

Art electronics 3rd edition | Electronics for physicists | Cambridge University Press

pages 982-984

13.14.7 "True" random noise generators

...

[multiple passes through DES to convert bit-stream to a random data stream copied to mass storage of about 250MB on the "Numerical Recipes" CD-ROM]

...

Figure 13.121. Using a physical process (base-emitter avalanche breakdown) to generate random bytes.

[current-limited reverse-biased B-E junction, RC HPF, two op amps to amplify (not jellybean though not expensive), RC HPF, fast analog comparator or an XMEGA-class analog comparator, PAL for sampler and UART, RS-232 level converter, BRG, power supply]

XMEGA AU has DES.

 


Numerical RecipesTM : The Art of Scientific Computing

MAX903 High-Speed, Low-Power Voltage Comparators - Maxim

MAX909 Dual/Quad/Single, High-Speed, Ultra-Low-Power, Single-Supply TTL Comparators - Maxim

 

edit: summary of AofE pages, Numerical Recipes URL, analog comparator URLs

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Jan 12, 2019 - 04:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:
I'll edit this post with the full results when I get home tonight
I've edited the post with the final results.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is another package under Linux called rng test.  Your n2 and n3 data sets perform well against FIPS  140-2:

$ rngtest < n2.bin 
rngtest 5
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: entropy source drained
rngtest: bits received from input: 18317264
rngtest: FIPS 140-2 successes: 915
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=235.475; avg=4838.436; max=19073.486)Mibits/s
rngtest: FIPS tests speed: (min=2.367; avg=44.760; max=64.437)Mibits/s
rngtest: Program run time: 393807 microseconds

$ rngtest < n3.bin                                                                                                                                                                                                                         
rngtest 5
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: entropy source drained
rngtest: bits received from input: 11685144
rngtest: FIPS 140-2 successes: 584
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=232.603; avg=4992.791; max=19073.486)Mibits/s
rngtest: FIPS tests speed: (min=3.391; avg=56.205; max=64.656)Mibits/s
rngtest: Program run time: 203242 microseconds

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Joey.  If only windows would stop &*^@^&*^&*# updating itself each night and killing my test...  I've got a 4.8M sample that I am attaching:

 

Entropy = 7.999960 bits per byte.

Optimum compression would reduce the size
of this 4818612 byte file by 0 percent.

Chi square distribution for 4818612 samples is 269.49, and randomly
would exceed this value 25.49 percent of the times.

Arithmetic mean value of data bytes is 127.5149 (127.5 = random).
Monte Carlo value for Pi is 3.141578529 (error 0.00 percent).
Serial correlation coefficient is 0.000105 (totally uncorrelated = 0.0).

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what are the downsides/issues/risks to running an ADC too fast?  I was by mistake running it at clk/4 (2MHz) and it seemed to do well too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If only windows would stop &*^@^&*^&*# updating itself each night and killing my test...

I confess, I can't comprehend why Windows users allow themselves to be held hostage like that ;-)

 

I've got a 4.8M sample that I am attaching:

I'm running dieharder against it now.  For comparison, I'm also running dieharder against an identically sized sample of randomness generated by the RPi hardware RNG (via /dev/random on Ubuntu-Mate).  I'll do the same with /dev/zero, and with a a sample of text.  I'll post the results when they're ready, but you'll see that they perform similarly.  The issue is that most of the tests (with defaults) require a much larger dataset to yield useful results.  I'm currently gathering a multi-GB dataset from the RPi hardware RNG (at 32KB/s) that I'll feed to dieharder, so we can see what a reasonable result should be for a nearly true-random dataset.  I started running such a test directly from /dev/random a few days ago, but at 32KB/s it was taking quite a long time.  Even with a >4GB dataset, some tests will rewind, so the results won't be 100% accurate.  However, they should give a pretty good indication of what to expect.  I'll accumulate for a few days, then run the tests.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:

I confess, I can't comprehend why Windows users allow themselves to be held hostage like that ;-)

 

Tell me about it!  I've really wanted to love linux, but can't get warmed up to it.  Decades of windows experience working against me here.

 

joeymorin wrote:
I'm running dieharder against it now.  For comparison, I'm also running dieharder against an identically sized sample of randomness generated by the RPi hardware RNG (via /dev/random on Ubuntu-Mate).  I'll do the same with /dev/zero, and with a a sample of text.  I'll post the results when they're ready, but you'll see that they perform similarly.  The issue is that most of the tests (with defaults) require a much larger dataset to yield useful results.  I'm currently gathering a multi-GB dataset from the RPi hardware RNG (at 32KB/s) that I'll feed to dieharder, so we can see what a reasonable result should be for a nearly true-random dataset.  I started running such a test directly from /dev/random a few days ago, but at 32KB/s it was taking quite a long time.  Even with a >4GB dataset, some tests will rewind, so the results won't be 100% accurate.  However, they should give a pretty good indication of what to expect.  I'll accumulate for a few days, then run the tests.

 

Looking forward to the results.  I can get larger sample files faster by speeding up the ADC, which may be worth trying.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
I can get larger sample files faster by speeding up the ADC, which may be worth trying.
That may result in less entropy per sample.  Since you're using the gain amplifier, remember that the input is low-pass filtered before the comparator stage.  I think the cutoff is 4kHz.  Depending on the amplitude of the noise signal being sampled, sampling faster may reduce the number of bits in each sample that carry entropy.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The test against an all-zero file seems to have hung during an early test (diehard_2dsphere), probably because that test requires a certain amount of entropy to proceed.  I've included the results so far (but have left it running for now), and the results of the other tests.

 

Attachment(s): 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is a 38M dataset from running the ADC at clk/8 or 1MHz.  It tests well with ENT.  I split it into 4 pieces to upload.

 

Entropy = 7.999995 bits per byte.

Optimum compression would reduce the size
of this 38451402 byte file by 0 percent.

Chi square distribution for 38451402 samples is 243.77, and randomly
would exceed this value 68.27 percent of the times.

Arithmetic mean value of data bytes is 127.5044 (127.5 = random).
Monte Carlo value for Pi is 3.141137793 (error 0.01 percent).
Serial correlation coefficient is -0.000023 (totally uncorrelated = 0.0).

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attached are some results:

  • n4.bin.log                (your dataset)
  • devrandom.bin.log         (a +4GB dataset from RPI hardware RNG)
  • devrandom_shorter.bin.log (+3GB subset of RPI hardware RNG dataset)
  • FourmilabHotBits.32.log   (Fourmilab HotBits test dataset mentioned below)
  • deverandom.log            (results of tests against /dev/erandom discussed below)

 

Incidentally, I recall some years ago comparing the results of my WDT-based RNG library against Hotbits (Genuine random numbers, generated by radioactive decay) from the same site where you found ENT.EXE, but I don't recall the results.

 

Note that Walker (the creator of Hotbits) published some tests of his own, against both ENT.EXE and dieharder:

https://www.fourmilab.ch/hotbits/statistical_testing/stattest.html

I ran that same 11MB dataset through the dieharder command line used in this thread, and the results weren't especially good.  I imagine this is either because the dataset isn't large enough, or the command line (taken from examples in the man page) is suboptimal.

 

Even more interesting are the results against /dev/erandom (see http://billauer.co.il/frandom.html), which is a deterministic PRNG.  It faired about as well as the large dataset generated from the RPi's hardware fed /dev/random.

 

 

Attachment(s): 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Joey - will look those over.  My last test has a small 8cm lead plugged in and just hanging in the air.  I wonder if on a pcb if this method (200X noise) would need some bit of trace/lead on one of the pins, or if it would fare ok without anything but pads going nowhere.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd expect that the shorter the 'antenna', the more of the sampled noise will be non-'random', since more of the signal will be coupled to deterministic switching events within the AVR itself.

 

I'd suggest a simple high-pass filter between your 'antenna' and ADC input, in order filter out as much mains frequency and harmonics as possible... but remembering that the x200 gain stage has a cut-off of about 4kHz.

 

Shooting for a 2nd order RC highpass  with a cut-off at, say 500 Hz (leaving a pass-band of 500 Hz - 4 kHz), a 1M5 resistor and a 220pF capacitor for each stage will get you a -3dB cut-off of 482 Hz.

 

Whether this will improve or worsen the situation will depend on a great many things.  First thing I would do is attempt to characterise the actual noise you're sampling.  Gather a large number of raw samples and plot them, then do an FFT analysis of them.  For this you may want to use x10 gain, as at x200 the ADC might saturate.  You'll know when you've plotted the dataset.

 

If you ever do capture such a dataset, I could possibly help you make sense of it.

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:

My last test has a small 8cm lead plugged in and just hanging in the air....

 

For kicks, try to find the frequency of this antenna

and broadcast a known signal to it.  Then see how

much different your randomness tests look.

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, my 30.5M sample set fails the chi sqaure with a .01 percent result.  I split it into 4 and the first 25% does ok, but 2nd/3rd/4th also fail with a .01 percent result.  I'm going to put the red 8cm wire antenna back on it and try a 30M sample and see how it does.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the following has an impressive bandwidth and a boost converter to reach the 5V requirement.

Microchip - Signal & Noise Generator

(Features tab)

...

  • Boost to 5.25V for powering on-board microcontrollers (MCUs) and analog circuit
  • [level converters for TWI and clock sync signal]

...

  • On board ATtiny416 to act as the white noise generator

...

  • White noise: ~ 1 MHz bandwidth, 0.05 - 2V VPP

...

 

"Dare to be naïve." - Buckminster Fuller