Skip to content

blowdart/idunno.PasswordGenerator

Repository files navigation

C# Password Generator

Build Status

This library is a password generator which implements generation of random passwords with provided requirements as described by AgileBits 1Password in C#. The algorithm is commonly used when generating website passwords.

Randomness is provided by the RandomNumberGenerator class, which is a cryptographic random number generator.

This was inspired by a tweet asking how to generate safe passwords in .NET and a Google search which ended up finding Seth Vargo's Golang Password Generator.

Usage

using idunno.Password;

// Generate a password that is 64 characters long with 10 digits, 10 symbols,
// allowing upper and lower case letters, disallowing repeat characters.
var passwordGenerator = new PasswordGenerator();
var generatedPassword = passwordGenerator.Generate(64, 10, 10, false, false);

nuget packages

A nuget package is available at https://www.nuget.org/packages/idunno.Password.Generator.

License

This code is licensed under the Apache license.