C# 클래스 Ru.GameSchool.Utilities.PasswordUtilities

A class handles hashing and salting passwords, and verifies them.
파일 보기 프로젝트 열기: davidein/Ru.GameSchool

공개 메소드들

메소드 설명
ComputeHash ( string plainText, string hashAlgorithm = null, byte saltBytes = null ) : string

Hashes a password and returns a string value.

VerifyHash ( string plainText, string hashValue, string hashAlgorithm = null ) : bool

Compares a hash of the specified plain text value to a given hash value. Plain text is hashed with the same salt value as the original hash.

메소드 상세

ComputeHash() 공개 정적인 메소드

Hashes a password and returns a string value.
public static ComputeHash ( string plainText, string hashAlgorithm = null, byte saltBytes = null ) : string
plainText string The password to hash.
hashAlgorithm string The algorithm to be used, if null MD5 will be used.
saltBytes byte Salt bytes. This parameter can be null, in which case a random salt value will be generated.
리턴 string

VerifyHash() 공개 정적인 메소드

Compares a hash of the specified plain text value to a given hash value. Plain text is hashed with the same salt value as the original hash.
public static VerifyHash ( string plainText, string hashValue, string hashAlgorithm = null ) : bool
plainText string Plain text to be verified against the specified hash. The function does not check whether this parameter is null.
hashValue string Base64-encoded hash value produced by ComputeHash function. This value includes the original salt appended to it.
hashAlgorithm string Name of the hash algorithm. Allowed values are: "MD5", "SHA1", "SHA256", "SHA384", and "SHA512" (if any other value is specified, MD5 hashing algorithm will be used). This value is case-insensitive.
리턴 bool