This project has moved. For the latest updates, please go here.

PasswordGenerator

NuGet Package ID: CodeBits.PasswordGenerator

// Create a 12 characters long password, containing letters, numbers, punctuations and spaces
string password = PasswordGenerator.Generate(12);
// or
string password = PasswordGenerator.Generate(12, PasswordCharacters.All);

// Create a 8 character long password, containing lower-case letters and numbers only
string password = PasswordGenerator.Generate(8,
    PasswordCharacters.LowercaseLetters | PasswordCharacters.Numbers);

// Create a 10 character long secure password containing alpha-numeric characters
SecureString password = PasswordGenerator.GenerateSecure(10,
    PasswordCharacters.AlphaNumeric);

PasswordCharacters enum:
[Flags]
public enum PasswordCharacters
{
    LowercaseLetters = 0x01,
    UppercaseLetters = 0x02,
    Numbers = 0x04,
    Punctuations = 0x08,
    Space = 0x10,
    AllLetters = LowercaseLetters | UppercaseLetters,
    AlphaNumeric = AllLetters | Numbers,
    All = AllLetters | Numbers | Punctuations | Space,
}

Last edited Jul 27, 2012 at 10:57 AM by jeevanjj, version 8

Comments

No comments yet.