Excellence.PasswordGenerators 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Excellence.PasswordGenerators --version 2.0.0
                    
NuGet\Install-Package Excellence.PasswordGenerators -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Excellence.PasswordGenerators" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Excellence.PasswordGenerators" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Excellence.PasswordGenerators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Excellence.PasswordGenerators --version 2.0.0
                    
#r "nuget: Excellence.PasswordGenerators, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Excellence.PasswordGenerators@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Excellence.PasswordGenerators&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Excellence.PasswordGenerators&version=2.0.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 1,232 12/9/2023
3.0.0 478 11/12/2022
2.0.2 571 9/18/2022
2.0.1 558 9/18/2022
2.0.0 574 6/21/2022
1.0.0 567 5/21/2022