HashHelper Class

Namespace:
Weavy.Core.Helpers
Assembly:
Weavy.Core.dll

Helper methods for calculating and verifying hash values.

public static class HashHelper
Inheritance:
System.Object → HashHelper

Methods

GenerateNumericCode(Int32) Generates a cryptographically strong sequence of random digits.
GenerateSalt(Int32) Generates a cryptographically strong sequence of random byte values.
GenerateToken(DateTime) Generates a base64url encoded validation token that expires at the specified time.
GetTokenExpiryDate(String) Gets the expiration time (UTC) for the specified token.
HashPassword(String, Nullable) Generates a PBKDF2 hash for the given plain text password and returns a base64 encoded result.
IsPasswordHash(String) Check if the supplied string looks like a hashed password.
IsTokenValid(String) Verifies that the supplied token has not expired.
MD5(Byte[]) Calculates an MD5 hash.
MD5(String) Calculates an MD5 hash.
SHA1(Byte[]) Calculates a SHA1 hash.
SHA1(String) Calculates a SHA1 hash.
SHA256(Byte[]) Calculates a SHA256 hash.
SHA256(String) Calculates a SHA256 hash.
VerifyPassword(String, String) Compares a hash of the specified plain text password to a given hash value. Plain text is hashed with the same salt value as the original hash.