1
$\begingroup$

I created my random numbers and I saved them into a txt file. My input file includes just 0 and 1. Here is the link of my file

And I of course read some answer before asking that question but I could not understand how can I create an input file for diehard. Do diehard have some prepared comment for converting our input file for itself or we should do it by hand? If we should do it how? I see too many parameters like generator see type count numbit ... Could you please help me?


Update: I actually answered this question but I have some troubles related my account so the answer is just lost so I am writing again

  1. Many thanks for your answe rI think it finally worked with that enter image description here

  2. just to be sure: what is d? when I looked other example I sometimes saw b instead of d

  3. I have just 0 and 1 so numbit should be 1 I guess, right?

  4. and you wrote some numbers and they are actually random numbers right? (In my case it is jut 0 and 1 instead of 3129711816 85411969 2545911541)

  5. And I want to test how much my numbers are random with this file and this code script right?

  6. Also When I tried without changing my file as a header file, it worked with this code script: dieharder -a-f your-file.txt and what does thos script mean? OK it worked but I couldnt change my file like header file and I dont know what it means

Update-------------------------------------------------------------

Hello, I still have some troubles regarding matching of accounts so I am updating here

1)Happy Christtmas to you too!

I have not a bin file! Why do you think that. I am trying to produce quantum random numbes and my numbers will be either 1 or 0 and after producing them, I save it a txt file! WHat is the problem with txt file. I really dont understand your point. And studyong with diehard how many numbers should I have at least? 2000000 is not enough?? What are the other techniques

2)And can you please explain my questions, if you have seen them like what is d or is my header file correct?...

3)How can I convert my txt file as a binary file???

4)What is the other techniques for testing how much my numbers are random? Can NIST be ok?

5)For instance I used this line for converting bin file perl -ne 'print pack("B32", $_)' < instructions.txt > instructions.bin is that ok? And I used 10000000 data and I convert it as binary file and it was extremely fast. I think it should has been slow?

Important note: I am using dieharder 3.31.1 version

$\endgroup$
6
  • 1
    $\begingroup$ Bad news. Irrespective of your file format, 9.77kB of data won't cut it. See crypto.stackexchange.com/a/61546/23115. Randomness = f(sample size) and you'll need a lot lot more. At this stage I suggest ent $\endgroup$
    – Paul Uszak
    Dec 23 '20 at 4:42
  • $\begingroup$ hello, thanks for the answer but I have a file which includes 2500000 character, I put the file as a link just giving you an example. Can you please explain me how can I prepare input file and what is the parameters? $\endgroup$
    – quest
    Dec 23 '20 at 11:21
  • $\begingroup$ Okay. Happy Christmas. I'm pretty drunk and getting confused. dieharder is not difficult. Is there any particular reason this data has to be ASCII? ASCII sucks bad. I''m 99.9% certain that your raw data was internally generated as binary ( I have some experience). Please explain why we can't go binary and test your generator with one simple command line? Hic. $\endgroup$
    – Paul Uszak
    Dec 26 '20 at 2:26
  • $\begingroup$ Okay2. Short circuit. Just amend your original link to the proper file. It will fail dieharder as it's too small. But there are alternative techniques. Analysis within 24 hrs. $\endgroup$
    – Paul Uszak
    Dec 26 '20 at 2:35
  • $\begingroup$ Gosh, a lot of stuff. diehard $\ne$ dieharder. ~10 MB is indicated for diehard. crypto.stackexchange.com/a/61546/23115 relates to the newer dieharder. $\endgroup$
    – Paul Uszak
    Dec 26 '20 at 14:41
2
$\begingroup$

Personally I never bother with ASCII and just go binary as it's easier, but so be it. There's a lot of good stuff on this page, but in essence what you need to do is...

One.

To use it with an ascii formatted file:

     dieharder -g 202 -f your-file.txt -a

   (your-file.txt should consist of a header such as:

    #==================================================================
    # generator I did it myself
    #==================================================================
    type: d
    count: 100000
    numbit: 32
    3129711816
      85411969
    2545911541
    etc...

Two.

Please read https://crypto.stackexchange.com/a/61546/23115. This is important. Dieharder is a glutton and craves loads and loads of data. 2,500,000 ASCII characters is way too low and the result will be absolutely meaningless other than just failing. The example in the linked answer sucked up 246 GB of binary bits so as not to rewind the data sample. That's more than a terabyte of ASCII.

Tip.

Randomness is a function of sample size. The size of your data set indicates alternative tests, such as the original diehard, or NIST's randomness test suite. The latter is pretty common in the literature for modern RNG designs, and I prefer it.


dieharder -a -g 201 -f your-file.bin to do it in binary without all that header nonsense.

$\endgroup$
3
  • $\begingroup$ "That's more than a terabyte of ASCII" ... um, using which encoding? Times 4 would give you the size in hexadecimals, but then it's still below 1 TB... $\endgroup$
    – Maarten Bodewes
    Dec 25 '20 at 22:08
  • $\begingroup$ @MaartenBodewes Include CR/LF as appropriate, but it's just a rough order of magnitude to suggest that 2.5 MB of ASCII won't be meaningful with dieharder. The question is a little in flux, what do you recommend please? Shall I edit this answer or continue with comments? $\endgroup$
    – Paul Uszak
    Dec 26 '20 at 15:17
  • 1
    $\begingroup$ Ah, never mind, I just took the answer on it's own, I guess it is more clear when the entire question is read with the binary in ASCII - just ones and zeros I suppose. As you've indicated: just go with binary, especially for the sizeable input that's required for dieharder. $\endgroup$
    – Maarten Bodewes
    Dec 26 '20 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.