C# Class Candor.Security.Cryptography.SHA2HashProvider

A cryptographic hash provider based on the SHA256Managed algorithm.
Inheritance: HashProvider
Show file Open project: michael-lang/candor-common Class Usage Examples

Public Methods

Method Description
GetSalt ( int length ) : string

Creates a true random salt.

Hash ( string salt, string originalValue, int iterations ) : string

Creates a non-reversible hashed value consistently given the same input.

SHA2HashProvider ( ) : System

Constructor for xml file configuration (web.config, app.config).

SHA2HashProvider ( string name ) : System

Constructor for code configuration.

Private Methods

Method Description
BytesToHex ( Byte toConvert ) : String
Sha256Hex ( String stringToHash ) : String

Method Details

GetSalt() public method

Creates a true random salt.
public GetSalt ( int length ) : string
length int length of the salt to return
return string

Hash() public method

Creates a non-reversible hashed value consistently given the same input.
public Hash ( string salt, string originalValue, int iterations ) : string
salt string Another semi-secret value paired with the secret to /// make it more difficult to dictionary attack a collection of hashed values.
originalValue string The original value to keep secret.
iterations int The iterations to hash the originalValue and salt.
return string

SHA2HashProvider() public method

Constructor for xml file configuration (web.config, app.config).
public SHA2HashProvider ( ) : System
return System

SHA2HashProvider() public method

Constructor for code configuration.
public SHA2HashProvider ( string name ) : System
name string
return System