MySQL 8.4.0
Source Code Documentation
mysql_harness::RandomGenerator Class Reference

#include <random_generator.h>

Inheritance diagram for mysql_harness::RandomGenerator:
[legend]

Public Member Functions

 RandomGenerator ()
 
std::string generate_identifier (unsigned length, unsigned alphabet_mask=AlphabetAll) override
 Generates a random string out of selected alphabet. More...
 
std::string generate_strong_password (unsigned length) override
 Generates a random password that adheres to the STRONG password requirements: More...
 
- Public Member Functions inherited from mysql_harness::RandomGeneratorInterface
 RandomGeneratorInterface ()=default
 
 RandomGeneratorInterface (const RandomGeneratorInterface &)=default
 
RandomGeneratorInterfaceoperator= (const RandomGeneratorInterface &)=default
 
virtual ~RandomGeneratorInterface ()
 

Private Attributes

std::mt19937 urng
 

Additional Inherited Members

- Public Types inherited from mysql_harness::RandomGeneratorInterface
enum  AlphabetContent : unsigned {
  AlphabetDigits = 0x1 , AlphabetLowercase = 0x2 , AlphabetUppercase = 0x4 , AlphabetSpecial = 0x8 ,
  AlphabetAll = 0xFF
}
 

Constructor & Destructor Documentation

◆ RandomGenerator()

mysql_harness::RandomGenerator::RandomGenerator ( )
inline

Member Function Documentation

◆ generate_identifier()

std::string mysql_harness::RandomGenerator::generate_identifier ( unsigned  length,
unsigned  alphabet_mask = AlphabetAll 
)
overridevirtual

Generates a random string out of selected alphabet.

Parameters
lengthlength of string requested
alphabet_maskbitmasmask indicating which alphabet symbol groups should be used for identifier generation (see AlphabetContent enum for possible values that can be or-ed)
Returns
string with the generated random chars
Exceptions
std::invalid_argumentwhen the alphabet_mask is empty or invalid

Implements mysql_harness::RandomGeneratorInterface.

◆ generate_strong_password()

std::string mysql_harness::RandomGenerator::generate_strong_password ( unsigned  length)
overridevirtual

Generates a random password that adheres to the STRONG password requirements:

  • contains at least 1 digit
  • contains at least 1 uppercase letter
  • contains at least 1 lowercase letter
  • contains at least 1 special character
Parameters
lengthlength of requested password (should be at least 8)
Returns
string with the generated password
Exceptions
std::invalid_argumentwhen the requested length is less than 8

Implements mysql_harness::RandomGeneratorInterface.

Member Data Documentation

◆ urng

std::mt19937 mysql_harness::RandomGenerator::urng
private

The documentation for this class was generated from the following files: