Decrypting Encrypting FAQS index Links TRNG

 

TRUE RANDOM NUMBER GENERATOR

Tru.  Ran.  Num.  Gen.  menu

TRNG 

 

 

 

 

General definition

How to create  a  TRNG  file 

How to apply Diehard and Entropy tests 

Entropy and Diequick tests  for prepared Large hexadecimal  files

Iteration for TRNG section 

 

 

 

 

 

 


GENERAL DEFINITION

 

        The purpose of this menu is to generate true random numbers, for testing and system studies. Random set consists of hexadecimal  numbers.  ( 0123456789ABCDEF ).  There is no difference from the other two menu, except, no  ISN  is involved in this menu.  ISN is only required for encrypting/decrypting purposes. The number sets generated in TRNG section can be  tested  for randomness,  by  Prof. Marsaglia's  Diehard  program and  its CD  (may click to download). There is one more program which tests the entropy of the random sets,  it is the Fourmilab entropy test program. 

        There are countless numbers of some other programs in the net,  but we didn't mention them here. You have to find and apply them for randomness tests.    

        What to do with these kind of files: The extension of the files is .rnd, but they are actually text files and when  you make the necessary attribution on windows,  may read them with a suitable text editor. The contents of  these  files may be used for the following studies. 

 

1- OTP encryption  ( That's what we are doing ! ) 

2- Creation  of  lottery  numbers     

3- Give random index numbers to systems

4- Make Economical, Mathematical, Scientific model studies

5- Password  assigning

6- A source for Prof. Marsaglia's  Diehard  tests

 

 

 


HOW  TO  CREATE  A  TRNG  FILE

 

TRNG   files carry the extension (.rnd). This extension is given automatically by the program. Do the following  step by step for creation of a TRNG file.

 

Open the  PracticalOTP  program by double clicking its icon on the desktop.

1_   Click tru ran num gen  menu. 

 

2_   Click key1.txt,  pass to related directory where the keysets  are prepared,  double click  key1.txt  to enter the related first  key.

3_   Click key2.txt,  double click  key2.txt  to enter the related second key.

4_   Click key3.txt,  double click  key3.txt  to enter the related third key.

5_   Click key4.txt,  double click  key4.txt  to enter the related fourth key.

 

6_   Click  Append  button,  give the name of the main random file to append ( example: give the  name random1

random1.rnd will be generated automatically.

7_   Click  Compute button. 

 

The steps stated above  accomplishes first cycle of entering keyset one.  

 

8_   After the computation is terminated return to step  two  for a  new  cycle of keyset.

9_   When you are finished entering second keyset click Append button,  this time don't give any new name for the TRNG file,  instead  click the old  random1 file for appending onto this file.

10_  Continue like this and always append the generated values onto the random1.rnd  file as told above. Never use a keyset or a key twice, this will  breach the general security condition for the One Time Pads.      


 HOW TO APPLY DIEHARD AND ENTROPY  TESTS

 

        The hexadecimal character file that had been created in this section is an  asc/text  file and may be scrutinized with a text editor. This asc file is NOT suitable to be used in Diehard and Entropy tests. FIRST You have to convert it to a binary format with a program which may be found in  Diehard zip. The name of the converting program is  asc2bin.exe. The  explanation of  usage of  the converter may be examined while the program is executed.

        The original asc/hexadecimal  file may be compressed to a certain extent with WinZip program; but after being converted to binary by asc2bin.exe, you'll see that it can no more be compressed by any zipping software.

        After being converted to a binary file,  it may be observed that the size of the  asc/text  file is approximately halved, then  diehard tests may be applied by Diehard.exe OR Diequick.exe .  To be a subject of  Diehard tests,  the  size of  the  random1.rnd  file, has to be at  least 21 Mb. When converted to binary, the size is reduced to approximately 10.5 Mb. This is quite a large file, the time for reaching such a  size, depends on  your rate of working. 

        The Entropy test program may be applied by Ent.exe  which is downloadable  from Fourmilab . This is a  DOS prompt program, the explanation of  which,  may be examined while the program is executed.

 

 

 

 

 

 


ENTROPY AND DIEQUICK TESTS FOR SOME PREPARED  LARGE  HEXADECIMAL  FILES

 

We have prepared some TRNG files, you can see the Diequick test an Ent reports 

               results  in the following  and/or  download them in zipped  form            

 Name of rnd file 

  Diequick Tests   

 size Kb.  

  Ent reports

 Download zip file 

otphex1.rnd Test 1  20508.0  Ent report 1 Download from site
otphex2.rnd Test 2 20936.0 Ent report 2 Download from site
otphex3.rnd Test 3  20659.0  Ent report 3 Download from site
otphex4.rnd Test 4 21570.0 Ent report 4 Download from site

The standard values of Ent reports for comparison purposes  may be seen at  Fourmilab  site

 

After downloading the otphex1.zip, otphex2.zip, otphex3.zip, otphex4.zip;  unzip

 them with WinZip and apply asc2bin.exe to convert them to binary file, then apply

 diequick.exe to obtain Diequick Tests and Ent.exe program to obtain Ent reports.

 They passed all the tests !

 

        As  additional tests, we melded the files   (#1,  #2,  #3,  #4)   as   (#12,  #13,  #14,  #23,  #24,  #34)  using  Prof. Marsaglia's meld.exe  program  (by  +  operator),  after converting them to binary files.  Applied diequick tests on these melded files. They passed all the tests !

        Passing  all  the  tests does not imply that the generated random sets are perfectly random. The name of the software implies that the system is practical to apply. But it may not be perfectly random at this stage                 (see the following section).

 

 

 

 


ITERATION FOR TRNG SECTION 

 

        otphex1.rnd, otphex2.rnd, otphex3.rnd, otphex4.rnd all pass entropy and diehard tests. Keeping in mind that passing all tests doesn't mean that the sets are cryptographically random; we do the following  iteration to approach  better approximation to random condition. 

 

Iteration_1-We take otphex1.rnd, otphex2.rnd, otphex3.rnd, otphex4.rnd  and  rename  them as following.

                    otphex1.rnd ---> key1.txt             

                    otphex2.rnd ---> key2.txt  

                    otphex3.rnd ---> key3.txt  

                    otphex4.rnd ---> key4.txt          

        Input these values as key1, key2, key3, key4 in  Tru Ran Num Gen  (TRNG)  menu.  Since we are entering some non-linguistic text documents this time, we should have less patterns. We'll call this new output as iterated1.rnd, the size of the output file will be one fourth of the smallest entered keyfiles. 

 

 Name of rnd file 

  Diequick Tests   

 size Kb.  

 Prepared by the program 

 Download zip file 

iterated1.rnd NOT available, since the size of file is insufficient 5127.0

practicalOTP (TRNG) menu

Download from site

 

        Diehard battery test for   iteration_1  cannot be performed,  because  the size of the related file is  not enough to carry such a test.

        If we can use our imagination and creativeness we can further improve this iteration; for example, pass to encrypt menu and find  sets of five addresses; every time  encrypting one of them with the other four using  random ISN's  and saving them as  new2.enc, new3.enc, new4.enc, then rename them as new2.txt, new3.txt, new4.txt.  Rename the last found iterated1.rnd as iterated1.txt  and then  use all of them in  TRNG  menu to iterate  a second subset,  iterated2.rnd  (This time of course, approaching to a better randomness level then the first). etc, etc.......