Protocol++® (Protocolpp®)
v5.6.2
|
#include "include/jrand.h"
This class is the randomization class for all of ProtocolPP® (Protocol++®) and supports generating random char, bytes, words, longs, strings, and integers
The core of the randomizer is the Merseene-Twister. The randomizer object can be created with one of three constructors. The default constructor creates a randomizer that is seeded with the default seed of 1234567890
To improve the entropy of the randomizer, it can also be created using a long integer or by using an array of long integers
Additional entropy may be added by using the seed() methods to reseed the object
The getname() and getstring() functions allow the user to obtain a randomly generated name or to choose a string from a list of colon separated values Names are generated from a-zA-Z0-9, no special characters are used
The functions that return an array of values can be called in two different ways, either by asking for an amount of random data or by asking for a range of data. For example to ask for 200 bytes of the random data, the user would try
To obtain a random amount of data from 500 to 1000 bytes, the user would call
This second call would first randomly select the length of bytes between 500 and 1000, they it would generate and return the bytes for that length as an array
The randomization class also allows the user to ask for a single object of the the type requested. To obtain a uint64_t the call would be
To generate cryptographically secure keys and data, jrand provides access to the hardware random number generator on the device being use. The can be accomplished by use the function
Finally, a tokenizer is provided with a static interface to allow the user to parse strings and obtain the delimited result. In jrand this is mainly used to parse ranges but can be used for any string. Use is
This randomizer also supports a special mode that allows a large number of SIMD generated data to be obtained from the process. It requires that this class be compiled with the define SFMT_MODE
SFMT_MODE periodically generates a large pool of random data from the processor that can be used by the random object. If the next request depletes the current store of random data, the random object will ask the process to refill it's "well". The randomization object will get a "bucket" from the "well" to fill it's array. Data in these large amounts are generated with SIMD commands
See the header file SFMT.h for additional information
For API Documentation:
For Additional Documentation:
The source code contained or described herein and all documents related to the source code (herein called "Material") are owned by John Peter Greninger and Sheila Rocha Greninger. Title to the Material remains with John Peter Greninger and Sheila Rocha Greninger. The Material contains trade secrets and proprietary and confidential information of John Peter Greninger and Sheila Rocha Greninger. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without prior express written consent of John Peter Greninger and Sheila Rocha Greninger (both are required)
No license under any patent, copyright, trade secret, or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel, or otherwise. Any license under such intellectual property rights must be express and approved by John Peter Greninger and Sheila Rocha Greninger in writing
Licensing information can be found at www.protocolpp.com/license with use of the binary forms permitted provided that the following conditions are met:
Use of the source code requires purchase of the source code. Source code can be purchased at www.protocolpp.com/shop
The name of its contributor may not be used to endorse or promote products derived from this software without specific prior written permission and licensing
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE