Aether Utilities Aether Utilities
Aether Utilities Aether Utilities
DocFX + Singulink = ♥

Search Results for

    Edit this page

    Class HashService

    Namespace
    AetherUtils.Core.Security.Hashing
    Assembly
    AetherUtils.Core.dll
    Provides a service for creating cryptographically strong hashes of strings and comparing plain-text strings against them for equality.

    This class hashes strings based on the provided HashOptions.

    public sealed class HashService
    Inheritance
    object
    HashService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Extension Methods
    TypeExtensions.CanSerializeJson<T>(T)
    TypeExtensions.CanSerializeXml<T>(T)
    TypeExtensions.SerializeJson<T>(T)
    TypeExtensions.SerializeXml<T>(T)

    Constructors

    HashService(HashOptions)

    Create a new service with the specified HashOptions.
    public HashService(HashOptions options)

    Parameters

    options HashOptions
    The options that should be used for hashing.

    Properties

    HashedString

    Get the hashed string for this HashService.
    public string HashedString { get; }

    Property Value

    string

    Methods

    CompareHash(string)

    Compare a non-hashed input string against the last hashed string for this HashService .
    public bool CompareHash(string input)

    Parameters

    input string

    Returns

    bool
    true if the two strings are equivalent; false otherwise.

    Exceptions

    ArgumentException
    Thrown if input is null or empty.

    CompareHash(string, string)

    Compare a non-hashed input string against a hashed string.
    public static bool CompareHash(string input, string hashString)

    Parameters

    input string
    The non-hashed string.
    hashString string
    A hash string to compare against.

    Returns

    bool
    true if the two strings are equivalent; false otherwise.

    Exceptions

    ArgumentException
    Thrown if input or hashString are null or empty.

    HashString(string)

    Generate a hash string for the specified plain-text string according to this object's HashOptions.
    public string HashString(string value)

    Parameters

    value string
    The plain text string to hash.

    Returns

    string
    A cryptographically strong hashed string.

    Exceptions

    CryptographicException
    If HashAlgorithm is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512
    (c) 2024 Ethan Hann. All rights reserved.