Skip to content
mhajas edited this page Aug 17, 2018 · 1 revision

This part of project is not finished yet. This is just a preparation for future work.

Project configuration

JSON for LCG generator with hw_counter seed

{
  "notes": "Reseed experiment",
  "seed": "1fe40505e131963c",
  "file_name": "LCG_low_hw_reseed_10.bin",
  "stdout": false,
  "tv_size": 70,
  "tv_count": 114285715,
  "stream": {
    "type": "prng",
    "algorithm": "testu01-ulcg",
    "reseed_for_each_test_vector": true,
    "seeder": {
      "type": "hw_counter"
    }
  }
}
  • algorithm selects used PRNG. See the list of implemented PRNGs for more information.
  • reseed_for_each_test_vector use new seed for each test vector of size tv_size
    • For JSON example above holds. One output from testu01-ulcg is 7B. This means one test vector is 10 outputs. Every 10 calls to PRNG will mean reseeding.
  • seeder definition of seeding stream, can be any other stream in CryptoStreams

Sub-projects

PRNGS stream contains, for now, 2 different source of PRNGs. PRNGs from TestU01 (source and more information here) and PRNGs from std library.

Developer notes

TestU01 PRNG

Every testU01 generator which is included in CryptoStreams is extending uniform_generator_interface class. This interface takes as a template number of bytes which is returned by generator. For example LCG generator:

class ulcg_generator : public uniform_generator_interface<7>

is defined with number 7, because each run of generator returns 7 Bytes of data.

Computing how many bytes function returns is little bit more complicated. Again as an example we can consider LCG. It returns 64 bit of data which is based on formula:

$$x_i = [a * x_(i - 1) + c] mod m$$

where x_(i-1) is previous value or seed for the first iteration. This means that output is never higher than modulo, and if modulo has 4B, the result will never have 8 Bytes. Thats why we needed to somehow cut the number so that there will be correct number of bytes without leading zeroes. It requires investigation of each generator in order to set this up correctly.

STD PRNGS

In STD library there are only three PRNGs. Each of them extend interface std_prng_interface. For example LCG from STD:

class lcg_generator : public std_prng_interface<std::minstd_rand, uint32_t, uint32_t>
  • std::minstd_rand is generator type
  • uint32_t is input type
  • uint32_t is output type