What is this?

I recently got interested in contributing to open-source projects after my first pull request was accepted. I enjoyed it so much that I decided to make an open-source library for my password generator. It is a C# .NET project.

I have a password generator tool on my site which anyone can use for free. It generates random, strong passwords for you which are compliant with the OWASP guidelines for password security.

Interesting. How can I use it in my code?

It's great having a tool to go to online and get a random password, but what if you want to generate the password within an application you are building. That is why I created this NuGet package PasswordGenerator.

You can simply add it to your project by using the NuGet Package Manager wizard style user interface, or by typing into Package Manager Console:

Install-Package PasswordGenerator

You will the be able to use it in your project.

You can create passwords between 8 and 128 characters long. They can include uppercase, lowercase, numeric and special characters.

It's really easy to use. Here are some examples:

Basic usage

// By default, all characters available for use and a length of 16
// Will return a random password with the default settings
PasswordGenerator pwdGen = new PasswordGenerator();
string password = pwdGen.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
PasswordGenerator pwdGen = new PasswordGenerator().IncludeNumeric();
string password = pwdGen.Next();

Find out more in this video

How do I contribute?

If you find a bug or you would like to contribute to the project in any way, please get in touch with me or raise an issue on the GitHub project, before submitting a pull request.

Want to thank me?

If I've helped you out and you want to thank me, why not buy me a coffee?

Buy me a coffee

About the author

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Related Posts

How to solve the error assets file project.assets.json not found in Visual Studio

This post tells you how to solve the error assets file project.assets.json not found in Visual Studi…

Read Post

Code to help you debug an umbraco issue on a remote site

This post gives you some razor code to help you see the values of the IPublishedContent item's prope…

Read Post

How to set the default page base type to UmbracoViewPage in Umbraco

In this post I share with you what Ronald Barendse taught us about setting the pageBaseType in Umbra…

Read Post

How to fix corrupt accented characters in Excel for a C# export as CSV

This post will help you fix the issue where you csv export has corrupt characters when opening it in…

Read Post