Excellence.PasswordGenerators
2.0.2
Prefix Reserved
See the version list below for details.
dotnet add package Excellence.PasswordGenerators --version 2.0.2
NuGet\Install-Package Excellence.PasswordGenerators -Version 2.0.2
<PackageReference Include="Excellence.PasswordGenerators" Version="2.0.2" />
<PackageVersion Include="Excellence.PasswordGenerators" Version="2.0.2" />
<PackageReference Include="Excellence.PasswordGenerators" />
paket add Excellence.PasswordGenerators --version 2.0.2
#r "nuget: Excellence.PasswordGenerators, 2.0.2"
#:package Excellence.PasswordGenerators@2.0.2
#addin nuget:?package=Excellence.PasswordGenerators&version=2.0.2
#tool nuget:?package=Excellence.PasswordGenerators&version=2.0.2
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 | net5.0 is compatible. net5.0-windows was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Excellence.Randomizers (>= 2.0.2)
-
net5.0
- Excellence.Randomizers (>= 2.0.2)
-
net6.0
- Excellence.Randomizers (>= 2.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.