mk-pass
Generate a password comprehensively
Loading...
Searching...
No Matches
mk_pass Namespace Reference

Data Structures

struct  PasswordRequirements
 A structure to describe the requirements of a password's contents. More...

Functions

uint16_t generatePassword (char *string, PasswordRequirements config)
void runMain ()
 The function used as a native entrypoint for an executable.
PasswordRequirements validateRequirements (const PasswordRequirements *config)

Function Documentation

◆ generatePassword()

uint16_t mk_pass::generatePassword ( char * string,
PasswordRequirements config )

Generate a password given the constraints specified by config.

This function will invoke validateRequirements(config) to ensure basic password requirements are met.

◆ runMain()

void mk_pass::runMain ( )

The function used as a native entrypoint for an executable.

◆ validateRequirements()

PasswordRequirements mk_pass::validateRequirements ( const PasswordRequirements * config)

Validates the instance's values.

This returns a mutated copy of the instance where the values satisfy "sane minimum requirements" suitable for any password.

The phrase "sane minimum requirements" implies

  1. length is not less than 10
  2. To avoid repetitions, length is not more than
    • 52 if only letters (no decimal integers or special characters) are used
    • 62 if only letters and decimal integers are used
    • 68 if only letters and special characters are used
    • 78 if letters, decimal integers, and special characters are used
    • 65535 if repeated characters are allowed
  3. specials character count does not overrule the required number of
    • letters (2; 1 uppercase and 1 lowercase)
    • decimal integers (if decimal is specified as non-zero value)
  4. decimal character count does not overrule the required number of
    • letters (2; 1 uppercase and 1 lowercase)
    • special characters (if specials is specified as non-zero value)

About resolving conflicts

If this function finds a conflict between the specified number of specials characters and decimal, then decimal integers takes precedence.

For example:

#include <mk_pass.hpp>
16, // length
16, // specials
16, // decimal
true, // firstIsLetter
false, // allowRepeats
};
PasswordRequirements expected = {
16, // length
1, // specials
13, // decimal
true, // firstIsLetter
false, // allowRepeats
};
assert(validateRequirements(&req) == expected);
PasswordRequirements validateRequirements(const PasswordRequirements *config)
A structure to describe the requirements of a password's contents.
Definition mk_pass.hpp:11