Excellence.PasswordGenerators
4.0.0
Prefix Reserved
dotnet add package Excellence.PasswordGenerators --version 4.0.0
NuGet\Install-Package Excellence.PasswordGenerators -Version 4.0.0
<PackageReference Include="Excellence.PasswordGenerators" Version="4.0.0" />
<PackageVersion Include="Excellence.PasswordGenerators" Version="4.0.0" />
<PackageReference Include="Excellence.PasswordGenerators" />
paket add Excellence.PasswordGenerators --version 4.0.0
#r "nuget: Excellence.PasswordGenerators, 4.0.0"
#:package Excellence.PasswordGenerators@4.0.0
#addin nuget:?package=Excellence.PasswordGenerators&version=4.0.0
#tool nuget:?package=Excellence.PasswordGenerators&version=4.0.0
Password generators
Table of contents
<br/>
Overview
Password generators are used to create passwords be defined rules.
Every password generator use configurations that define the rules that are used during password generation.
<br />
Configurations
Configurations are created using default constructor. Then configuration methods define the rules.
Example:
var configuration = new PasswordConfiguration();
configuration.UseItems("ABC");
configuration.UseItems('D', 'E', 'F');
configuration.UseDigits();
configuration.UseMinCount(4);
configuration.UseMaxCount(8);
configuration.UseUnique(false);
// or
var configuration2 = new PasswordConfiguration()
.UseItems("GHIJ")
.UseItems('K', 'L')
.UseDigits()
.UseMinCount(4)
.UseMaxCount(8)
.UseUnique(true);
// or
var configuration3 = new PasswordConfiguration()
.UseFromJson
(
"{ "
+ "\"Items\": \"@#$%\", "
+ "\"MinCount\": 4, "
+ "\"MaxCount\": 8, "
+ "\"UniqueOnly\": false"
+ " }"
);
<br/>
Default methods
PasswordConfiguration
has methods to add predefined characters.
Example:
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
configuration.UseUpperCaseLetters();
// abcdefghijklmnopqrstuvwxyz
configuration.UseLowerCaseLetters();
// 0123456789
configuration.UseDigits();
// ()[]{}<>+-*/=&|^!~`@#$%_\\|;:'\"?,.
configuration.UseDefaultSpecialCharacters();
<br/>
Password generators
When configurations are ready a password generator can create passwords.
<br/>
Create a password generator
Password generators can be created using the IPasswordGeneratorFactory
.
Example:
var randomGenerator = new DefaultRandomGenerator();
var shuffler = new KnuthShuffler(randomGenerator);
var passwordGeneratorFactory = new PasswordGeneratorFactory(randomGenerator, shuffler);
var passwordGenerator = passwordGeneratorFactory.CreatePasswordGenerator();
<br/>
Add configurations
Configurations are added using Use
methods.
Every configuration defines its own rules so the password generator generates the passwords that match the rules of every configuration.
Example:
passwordGenerator.Use(configuration);
// or
passwordGenerator.Use(new List<IPasswordConfiguration>() { configuration2, configuration3 });
<br/>
Generate passwords
Next
methods generate the passwords.
Example:
// one password
var password = passwordGenerator.Next();
// 5 passwords
var passwords = passwordGenerator.Next(5);
<br/>
Copy
Copy
copies the password generator with all configurations and returns a new password generator instance. Instances are independent and adding configuration to one password
generator does not affect another one.
Example:
var passwordGeneratorCopy = passwordGenerator.Copy()
.Use(configuration3.Copy());
var anotherPassword = passwordGeneratorCopy.Next();
var anotherPasswords = passwordGeneratorCopy.Next(5);
<br/>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Excellence.Randomizers (>= 4.0.0)
-
net7.0
- Excellence.Randomizers (>= 4.0.0)
-
net8.0
- Excellence.Randomizers (>= 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.