Skip to content

Password

Taiizor edited this page Mar 1, 2023 · 2 revisions

PasswordExtension Class

Namespace: Skylark.Standard.Extension.Password
Assembly: Skylark.Standard.dll

This class contains extension methods for password management.

Methods

Meter(string Password = MPPM.Password): EMPT

Measures the strength of a password by calculating its entropy and returns the password type. If the password is empty, it returns an error message.

Parameters

  • Password (optional): The password to be measured. Default value is MPPM.Password.

Returns

The password type. See EMPT for possible values.

Exceptions

  • Skylark.Exception: Thrown when an error occurs during the calculation.

MeterAsync(string Password = MPPM.Password): Task<EMPT>

Asynchronously measures the strength of a password by calculating its entropy and returns the password type. If the password is empty, it returns an error message.

Parameters

  • Password (optional): The password to be measured. Default value is MPPM.Password.

Returns

The password type as a Task. See EMPT for possible values.

Generate(int Length = MPPM.Length, string Alphabetic = MPPM.DefaultType, string Special = MPPM.DefaultType, string Prefix = MPPM.Prefix, string Suffix = MPPM.Suffix): string

Generates a new password with the specified length and character types and returns the generated password. If no character types are specified, it returns an error message.

Parameters

  • Length (optional): The length of the password. Default value is MPPM.Length.
  • Alphabetic (optional): The type of alphabetic characters to be used. Default value is MPPM.DefaultType. See EAPT for possible values.
  • Special (optional): The type of special characters to be used. Default value is MPPM.DefaultType. See ESLPT for possible values.
  • Prefix (optional): The prefix to be added to the generated password. Default value is MPPM.Prefix.
  • Suffix (optional): The suffix to be added to the generated password. Default value is MPPM.Suffix.

Returns

The generated password as a string.

Exceptions

  • Skylark.Exception: Thrown when no character types are specified.

GenerateAsync(int Length = MPPM.Length, string Alphabetic = MPPM.DefaultType, string Special = MPPM.DefaultType, string Prefix = MPPM.Prefix, string Suffix =

Clone this wiki locally