<commit_before>Compiling the Driver for Windows
--------------------------------

I compiled infnoise-win.exe using VisualStudio 2013 using Windows 7.  I downloaded the
FTD2xx drivers from FTDI.  Pipes seem almost entirely broken in Windows, so the Windows
version requires out output file to be specified on the command line.  In a cmd window,
you can type

    infnoise-win foo

and let it run for a while until you have as much random data in foo as you need.

The VisualStudio project for infnoise is in the infnoise/software/VisualStudio directory.

Using prebuilt packages for Linux
---------------------------------

Precompiled binaries can be downloaded from the releases section of the 13-37-org fork:
https://github.com/13-37-org/infnoise/releases

All packages are signed with the same PGP-Key (Key-ID: 0x4E730A3C) used for the repositories below. 
Full Fingerprint: 71AE 099B 262D C0B4 93E6 EE71 975D C25C 4E73 0A3C. You can also check the 
fingerprints at 13-37.org/pgp-keys and in the Crowd Supply campaign.

Repositories for Ubuntu, Debian and Raspbian are also available. To add them follow this procedure:

    $ wget -O 13-37.org-code.asc https://13-37.org/files/pubkey.gpg 
    
    Verify the keys fingerprint:
    
    # GPG1
    $ gpg --with-fingerprints 13-37.org-code.asc
    # GPG2:
    $ gpg2 --import-options import-show --dry-run --import < 13-37.org-code.asc
    
    $ sudo apt-key add 13-37.org-code.asc
    
Available for Ubuntu and Debian (x86, x64 and armhf):

    $ echo "deb http://repo.13-37.org/ stable main" | sudo tee /etc/apt/sources.list.d/infnoise.list
    $ sudo apt-get update
    $ sudo apt-get install infnoise

Connect the Infinite Noise TRNG (if not already) and the service will be started via a udev rule.
Check status of driver:
    $ systemctl status infnoise

Compiling the Driver for Linux
------------------------------

The infnoise application reads random data from the Infinite Noise USB key and writes
binary data to stdout.  To compile it, you will need to install the libftdi and libusb
development libraries to compile infnoise.  In Ubuntu (probably also Debian), you can use
this command:

    $ sudo apt-get install libftdi-dev libusb-dev

These include an open source drivers for the FT240X USB chip used on the Infinite Noise
TRNG.  Once this is done, to compile the infnoise program, simply make it:

    $ make

To run the infnoise application, make sure the Infinite Noise USB stick is
plugged in, and from a shell, type:

    $ sudo ./infnoise > randbytes

The Infinite Noise USB driver uses the open source FTDI driver documented at:

    http://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html

Note that there is a newer alpha version of the next release of the libftdi library.  I
found it runs much slower than the current libftdi1 library in Ubuntu, so I am sticking
with the stable release for now.

Usage
-----

Usage: infnoise [options]
Options are:
    --debug - turn on some debug output
    --dev-random - write entropy to /dev/random instead of stdout
    --raw - do not whiten the output
    --multiplier <value> - write 256 bits * value for each 512 bits written to the Keccak sponge
    --no-output - do not write random output data
    --daemon - run in the background. Output should be redirected to a file or
    the options should be used with --dev-random. To reduce CPU-usage addition
    af entropy is only forced after a minute rather than a second.
    --pidfile <filename> - write the process ID to a file. If --daemon is used, it is the ID of the background process.
    --serial <serial> - use Infinite Noise TRNG/FT240 with the given serial number (see --list-devices)
    --list-devices - list available devices

Note: The options --daemon and --pidfile are only implemented in the Linux version.

Examples
--------

This will fill the file randbytes with random data endlessly, so hit Ctrl+C to kill it
after a while.  If all you want to do is verify the output using the dieharder tests, you
can use:

    $ sudo ./infnoise | dieharder -g 200 -a

The program "infnoise" talks to the FT240X USB 2.0 interface chip on the USB stick.  It
uses "bitbang" mode to drive the clock signals of the Infinite Noise Multiplier, and
receives one random bit of output per byte written to the device.  These bits are
collected into bytes, and sent through a "health checker", which verifies that the bits
look basically like INM output, with about the expected level of entropy.

If the measured level of entropy deviates from the theoretical value by more than 2%, then
the infnoise application stops generating outputdata.  If it sees too many 0's or 1's in a
row, it will exit with an error code.

You can see the raw data from the INM for yourself by running

    $ sudo infnoise --raw > randbytes

Kill it after a while, and check it out with with a program like hexdump.  In general,
there should be random 0's and 1's, but rarely more than 3 1's or 0's in a row.  You can
get some good debug info using:<commit_msg>fix formatting of usage output<commit_after>Compiling the Driver for Windows
--------------------------------

I compiled infnoise-win.exe using VisualStudio 2013 using Windows 7.  I downloaded the
FTD2xx drivers from FTDI.  Pipes seem almost entirely broken in Windows, so the Windows
version requires out output file to be specified on the command line.  In a cmd window,
you can type

    infnoise-win foo

and let it run for a while until you have as much random data in foo as you need.

The VisualStudio project for infnoise is in the infnoise/software/VisualStudio directory.

Using prebuilt packages for Linux
---------------------------------

Precompiled binaries can be downloaded from the releases section of the 13-37-org fork:
https://github.com/13-37-org/infnoise/releases

All packages are signed with the same PGP-Key (Key-ID: 0x4E730A3C) used for the repositories below. 
Full Fingerprint: 71AE 099B 262D C0B4 93E6 EE71 975D C25C 4E73 0A3C. You can also check the 
fingerprints at 13-37.org/pgp-keys and in the Crowd Supply campaign.

Repositories for Ubuntu, Debian and Raspbian are also available. To add them follow this procedure:

    $ wget -O 13-37.org-code.asc https://13-37.org/files/pubkey.gpg 
    
    Verify the keys fingerprint:
    
    # GPG1
    $ gpg --with-fingerprints 13-37.org-code.asc
    # GPG2:
    $ gpg2 --import-options import-show --dry-run --import < 13-37.org-code.asc
    
    $ sudo apt-key add 13-37.org-code.asc
    
Available for Ubuntu and Debian (x86, x64 and armhf):

    $ echo "deb http://repo.13-37.org/ stable main" | sudo tee /etc/apt/sources.list.d/infnoise.list
    $ sudo apt-get update
    $ sudo apt-get install infnoise

Connect the Infinite Noise TRNG (if not already) and the service will be started via a udev rule.
Check status of driver:
    $ systemctl status infnoise

Compiling the Driver for Linux
------------------------------

The infnoise application reads random data from the Infinite Noise USB key and writes
binary data to stdout.  To compile it, you will need to install the libftdi and libusb
development libraries to compile infnoise.  In Ubuntu (probably also Debian), you can use
this command:

    $ sudo apt-get install libftdi-dev libusb-dev

These include an open source drivers for the FT240X USB chip used on the Infinite Noise
TRNG.  Once this is done, to compile the infnoise program, simply make it:

    $ make

To run the infnoise application, make sure the Infinite Noise USB stick is
plugged in, and from a shell, type:

    $ sudo ./infnoise > randbytes

The Infinite Noise USB driver uses the open source FTDI driver documented at:

    http://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html

Note that there is a newer alpha version of the next release of the libftdi library.  I
found it runs much slower than the current libftdi1 library in Ubuntu, so I am sticking
with the stable release for now.

Usage
-----

    Usage: infnoise [options]
    Options are:
        --debug - turn on some debug output
        --dev-random - write entropy to /dev/random instead of stdout
        --raw - do not whiten the output
        --multiplier <value> - write 256 bits * value for each 512 bits written to the Keccak sponge
        --no-output - do not write random output data
        --daemon - run in the background. Output should be redirected to a file or
        the options should be used with --dev-random. To reduce CPU-usage addition
        af entropy is only forced after a minute rather than a second.
        --pidfile <filename> - write the process ID to a file. If --daemon is used, it is the ID of the background process.
        --serial <serial> - use Infinite Noise TRNG/FT240 with the given serial number (see --list-devices)
        --list-devices - list available devices

Note: The options --daemon and --pidfile are only implemented in the Linux version.

Examples
--------

This will fill the file randbytes with random data endlessly, so hit Ctrl+C to kill it
after a while.  If all you want to do is verify the output using the dieharder tests, you
can use:

    $ sudo ./infnoise | dieharder -g 200 -a

The program "infnoise" talks to the FT240X USB 2.0 interface chip on the USB stick.  It
uses "bitbang" mode to drive the clock signals of the Infinite Noise Multiplier, and
receives one random bit of output per byte written to the device.  These bits are
collected into bytes, and sent through a "health checker", which verifies that the bits
look basically like INM output, with about the expected level of entropy.

If the measured level of entropy deviates from the theoretical value by more than 2%, then
the infnoise application stops generating outputdata.  If it sees too many 0's or 1's in a
row, it will exit with an error code.

You can see the raw data from the INM for yourself by running

    $ sudo infnoise --raw > randbytes

Kill it after a while, and check it out with with a program like hexdump.  In general,
there should be random 0's and 1's, but rarely more than 3 1's or 0's in a row.  You can
get some good debug info using:
{'fraction_non_alphanumeric': 0.07514051868652007, 'fraction_numerical': 0.021694113006606845, 'mean_word_length': 3.0166336633663366, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6843089', 'n_tokens_mistral': 3107, 'n_tokens_neox': 2787, 'n_words': 1479}