C# Класс Recognos.Core.SaltedHash

Implementation for hashing a salted password and verifying the hash.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Generate ( string password ) : string

Generates the hash.

SaltedHash ( ) : System.Linq

Initializes a new instance of the SaltedHash class.

Default constructor which initializes the SaltedHash with the SHA256Managed algorithm and a Salt of 4 bytes ( or 4*8 = 32 bits)

SaltedHash ( HashAlgorithm hashAlgorithm, int saltLength ) : System.Linq

Initializes a new instance of the SaltedHash class.

Verify ( string password, string hash ) : bool

Verifies the hash.

VerifyHash ( string password, string hash ) : bool

Verifies the hash.

Приватные методы

Метод Описание
ComputeHash ( byte password, byte salt ) : byte[]

The actual hash calculation is shared by both GetHashAndSalt and the VerifyHash functions

GenerateHash ( string password ) : string
GenerateSalt ( ) : byte[]

Generates the salt.

Описание методов

Generate() публичный статический Метод

Generates the hash.
public static Generate ( string password ) : string
password string The password.
Результат string

SaltedHash() публичный Метод

Initializes a new instance of the SaltedHash class.
Default constructor which initializes the SaltedHash with the SHA256Managed algorithm and a Salt of 4 bytes ( or 4*8 = 32 bits)
public SaltedHash ( ) : System.Linq
Результат System.Linq

SaltedHash() публичный Метод

Initializes a new instance of the SaltedHash class.
public SaltedHash ( HashAlgorithm hashAlgorithm, int saltLength ) : System.Linq
hashAlgorithm System.Security.Cryptography.HashAlgorithm A HashAlgorihm which is derived from HashAlgorithm. C# provides /// the following classes: SHA1Managed,SHA256Managed, SHA384Managed, SHA512Managed and MD5CryptoServiceProvider
saltLength int Length of the salt.
Результат System.Linq

Verify() публичный статический Метод

Verifies the hash.
public static Verify ( string password, string hash ) : bool
password string The password.
hash string The hash.
Результат bool

VerifyHash() публичный Метод

Verifies the hash.
public VerifyHash ( string password, string hash ) : bool
password string The password.
hash string The hash.
Результат bool