Utilities.PasswordGenerator
6.0.902
See the version list below for details.
dotnet add package Utilities.PasswordGenerator --version 6.0.902
NuGet\Install-Package Utilities.PasswordGenerator -Version 6.0.902
<PackageReference Include="Utilities.PasswordGenerator" Version="6.0.902" />
paket add Utilities.PasswordGenerator --version 6.0.902
#r "nuget: Utilities.PasswordGenerator, 6.0.902"
// Install Utilities.PasswordGenerator as a Cake Addin #addin nuget:?package=Utilities.PasswordGenerator&version=6.0.902 // Install Utilities.PasswordGenerator as a Cake Tool #tool nuget:?package=Utilities.PasswordGenerator&version=6.0.902
Utilities.PasswordGenerator
Ambiguous avoid, generated password will not contain 0
O
1
I
l
Installation
dotnet add package Utilities.PasswordGenerator
Add services(optional)
You can add the service to the DI container.
using Utilities.PasswordGenerator.Interfaces;
using Utilities.PasswordGenerator.Services;
ConfigureServices(IServiceCollection services)
{
// this injects as SINGLETON
services.AddSingleton<IPasswordGeneratorService, PasswordGeneratorService>();
}
Using service
Simple usage
using Utilities.PasswordGenerator.Services;
public class MyProcess
{
public string Generate()
{
var passwordGeneratorService = new PasswordGeneratorService();
// generate 8 characters password with at least 1 uppercase, 1 lowercase, 1 numeric and 1 special character
return passwordGeneratorService.Generate();
}
}
Generate with specific length
You can generate 8~32 characters password by specifying the length. (default: 8)
using Utilities.PasswordGenerator.Services;
public class MyProcess
{
public string Generate()
{
var passwordGeneratorService = new PasswordGeneratorService();
// generate 16 characters password with at least 1 uppercase, 1 lowercase, 1 numeric and 1 special character
return passwordGeneratorService.Generate(16);
}
}
Generate with required characters options
You can generate 8~32 characters password with specific options, i.e. at least 3 uppercase, 3 lowercase, 2 numeric and 1 special character.
using Utilities.PasswordGenerator.Services;
public class MyProcess
{
public string Generate()
{
var passwordGeneratorService = new PasswordGeneratorService();
// generate 16 characters password with at least 3 uppercase, 3 lowercase, 2 numeric and 1 special character
return passwordGeneratorService.Generate(16, 3, 3, 2, 1);
}
}
Custom special characters
Default special characters are !
@
#
$
%
^
*
(
)
-
_
=
+
?
. You can setup your own special characters by giving specialChars
parameter.
using Utilities.PasswordGenerator.Services;
public class MyProcess
{
public string Generate()
{
var passwordGeneratorService = new PasswordGeneratorService();
// generate 16 characters password with at least 1 uppercase, 1 lowercase, 1 numeric and 1 special character (~!@#<>)
return passwordGeneratorService.Generate(16, specialChars: "~!@#<>");
}
}
In case you don't want any special characters, you can set specialChars
to empty string.
using Utilities.PasswordGenerator.Services;
public class MyProcess
{
public string Generate()
{
var passwordGeneratorService = new PasswordGeneratorService();
// generate 16 characters password with at least 1 uppercase, 1 lowercase, 1 numeric and no special character
return passwordGeneratorService.Generate(16, specialChars: "");
}
}
Use dependency injection
using Utilities.PasswordGenerator.Interfaces;
public class MyProcess
{
private readonly IPasswordGeneratorService _passwordGeneratorService;
public MyProcess(IPasswordGeneratorService passwordGeneratorService) =>
_passwordGeneratorService = _passwordGeneratorService;
public string Generate() =>
_passwordGeneratorService.Generate();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.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
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.