PasswordGenerator 2.0.1

A .NET Standard library which generates random passwords with different settings to meet the OWASP requirements

Install-Package PasswordGenerator -Version 2.0.1
dotnet add package PasswordGenerator --version 2.0.1
<PackageReference Include="PasswordGenerator" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PasswordGenerator --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Password Generator

A .NET Standard library which generates random passwords with different settings to meet the OWASP requirements

It is Compatible with .NET Core, .NET Framework and more. See the chart on the project readme.

Basic usage

See examples below or try them out now in your browser using Dotnetfiddle

// By default, all characters available for use and a length of 16
// Will return a random password with the default settings 
var pwd = new Password();
var password = pwd.Next();
// Same as above but you can set the length. Must be between 8 and 128
// Will return a password which is 32 characters long
var pwd = new Password(32);
var password = pwd.Next();
// Same as above but you can set the length. Must be between 8 and 128
// Will return a password which only contains lowercase and uppercase characters and is 21 characters long.
var pwd = new Password(includeLowercase: true, includeUppercase: true, includeNumeric: false, includeSpecial: false, passwordLength: 21);
var password = pwd.Next();

Fluent usage

// You can build up your reqirements by adding things to the end, like .IncludeNumeric()
// This will return a password which is just numbers and has a default length of 16
var pwd = new Password().IncludeNumeric();
var password = pwd.Next();
// As above, here is how to get lower, upper and special characters using this approach
var pwd = new Password().IncludeLowercase().IncludeUppercase().IncludeSpecial();
var password = pwd.Next();
// This is the same as the above, but with a length of 128
var pwd = new Password(128).IncludeLowercase().IncludeUppercase().IncludeSpecial();
var password = pwd.Next();
// This is the same as the above, but with passes the length in using the method LengthRequired()
var pwd = new Password().IncludeLowercase().IncludeUppercase().IncludeSpecial().LengthRequired(128);
var password = pwd.Next();

Password Generator

A .NET Standard library which generates random passwords with different settings to meet the OWASP requirements

It is Compatible with .NET Core, .NET Framework and more. See the chart on the project readme.

Basic usage

See examples below or try them out now in your browser using Dotnetfiddle

// By default, all characters available for use and a length of 16
// Will return a random password with the default settings 
var pwd = new Password();
var password = pwd.Next();
// Same as above but you can set the length. Must be between 8 and 128
// Will return a password which is 32 characters long
var pwd = new Password(32);
var password = pwd.Next();
// Same as above but you can set the length. Must be between 8 and 128
// Will return a password which only contains lowercase and uppercase characters and is 21 characters long.
var pwd = new Password(includeLowercase: true, includeUppercase: true, includeNumeric: false, includeSpecial: false, passwordLength: 21);
var password = pwd.Next();

Fluent usage

// You can build up your reqirements by adding things to the end, like .IncludeNumeric()
// This will return a password which is just numbers and has a default length of 16
var pwd = new Password().IncludeNumeric();
var password = pwd.Next();
// As above, here is how to get lower, upper and special characters using this approach
var pwd = new Password().IncludeLowercase().IncludeUppercase().IncludeSpecial();
var password = pwd.Next();
// This is the same as the above, but with a length of 128
var pwd = new Password(128).IncludeLowercase().IncludeUppercase().IncludeSpecial();
var password = pwd.Next();
// This is the same as the above, but with passes the length in using the method LengthRequired()
var pwd = new Password().IncludeLowercase().IncludeUppercase().IncludeSpecial().LengthRequired(128);
var password = pwd.Next();

Release Notes

Compatible with .NET Core, .NET Framework and .NET Standard
Added ability to get a group of passwords in one call

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.1 1,347 9/20/2019
2.0.0 807 9/4/2019
1.1.3 7,958 6/9/2019
1.1.2 28,231 11/16/2016
1.1.1 479 11/13/2016
1.1.0 391 11/13/2016
1.0.0 576 11/12/2016