Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class PasswordHelper

    Provides utility methods for handling password hashing and validation.

    Inheritance
    object
    PasswordHelper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Innovt.Core.Utilities
    Assembly: Innovt.Core.dll
    Syntax
    public static class PasswordHelper

    Methods

    | Edit this page View Source

    GeneratePassword(int)

    Generates a random password of specified length using cryptographic randomness to ensure security.

    Declaration
    public static string GeneratePassword(int passwordLength)
    Parameters
    Type Name Description
    int passwordLength

    (int): The desired length of the generated password. If the specified length is less than 6, the method defaults to a minimum length of 6 to ensure a reasonable level of security.

    Returns
    Type Description
    string

    (string) A randomly generated password consisting of characters chosen from a predefined set.

    | Edit this page View Source

    HashPassword(string)

    Hashes a plain text password using a randomly generated salt and returns both the hashed password and the salt.

    Declaration
    public static (string password, string salt) HashPassword(string plainPassword)
    Parameters
    Type Name Description
    string plainPassword

    The plain text password to hash.

    Returns
    Type Description
    (string bucket, string fileKey)

    A tuple containing the hashed password and the salt used.

    | Edit this page View Source

    HashPassword(string, string)

    Hashes a plain text password using the provided salt.

    Declaration
    public static string HashPassword(string plainPassword, string salt)
    Parameters
    Type Name Description
    string plainPassword

    The plain text password to hash.

    string salt

    The salt used for hashing the password.

    Returns
    Type Description
    string

    The hashed password as a string.

    | Edit this page View Source

    IsValid(string, string, string)

    Checks if a decoded password matches its hashed representation using the provided salt.

    Declaration
    public static bool IsValid(string decodedPassword, string hashedPassword, string salt)
    Parameters
    Type Name Description
    string decodedPassword

    The plain text password to validate.

    string hashedPassword

    The hashed password to compare against.

    string salt

    The salt used for hashing the password.

    Returns
    Type Description
    bool

    True if the decoded password matches the hashed password; otherwise, false.

    | Edit this page View Source

    RandomSalt()

    Generates a random salt and returns it as a Base64-encoded string.

    Declaration
    public static string RandomSalt()
    Returns
    Type Description
    string

    A Base64-encoded salt.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX