-
Notifications
You must be signed in to change notification settings - Fork 9
PRNGs
This part of project is not finished yet. This is just a preparation for future work.
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 sizetv_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
PRNGS stream contains, for now, 2 different source of PRNGs. PRNGs from TestU01 (source and more information here) and PRNGs from std library.
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:
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.
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
Getting started
Building notes
Running notes
Recommended scenarios
Configuration file structure
Developer notes
Framework components
Submodules
Third party libraries
Coding guide
Testing
Known bugs
User notes
List of streams
Block ciphers
Stream ciphers
Hash functions
PRNGs
WIP CAESAR
Useful links