C# Class Aqueduct.Utils.HashService

Hash a plain string with given salt and compare the hashed strings with plain text.
显示文件 Open project: aqueduct/Aqueduct.SitecoreLib

Public Methods

Method Description
ComputeBase64Hash ( string plainText, string salt ) : string

hashes the given string with given salt to base 64 string

ComputeHash ( string plainText, string salt ) : string

hashes the given string with given salt to base 64 string

ComputeHexadecimalStringHash ( string plainText, string salt ) : string

hashes the given string with given salt to hexadecimal string

HashService ( ) : System

Default constructor that creates defaul hash algorithm to use

HashService ( HashAlgorithm hashAlgorithm ) : System

Constractor to pass a hash algorithm to using in hashing process

VerifyHash ( string plainText, string hashValue, string salt ) : bool

Verifies if the hashValue is hashed form of plainText with given salt

Private Methods

Method Description
GetHashBytes ( string plainText, string salt ) : byte[]

Method Details

ComputeBase64Hash() public method

hashes the given string with given salt to base 64 string
public ComputeBase64Hash ( string plainText, string salt ) : string
plainText string plain text to be hashed
salt string Salt that will be used in hashing
return string

ComputeHash() public method

hashes the given string with given salt to base 64 string
public ComputeHash ( string plainText, string salt ) : string
plainText string plain text to be hashed
salt string Salt that will be used in hashing
return string

ComputeHexadecimalStringHash() public method

hashes the given string with given salt to hexadecimal string
public ComputeHexadecimalStringHash ( string plainText, string salt ) : string
plainText string plain text to be hashed
salt string Salt that will be used in hashing
return string

HashService() public method

Default constructor that creates defaul hash algorithm to use
public HashService ( ) : System
return System

HashService() public method

Constractor to pass a hash algorithm to using in hashing process
public HashService ( HashAlgorithm hashAlgorithm ) : System
hashAlgorithm System.Security.Cryptography.HashAlgorithm
return System

VerifyHash() public method

Verifies if the hashValue is hashed form of plainText with given salt
public VerifyHash ( string plainText, string hashValue, string salt ) : bool
plainText string Plain text to be verified
hashValue string Hash value to be verified
salt string Salt that will be used in hashing
return bool