C# 클래스 Core.Framework.Permissions.Helpers.PasswordHelper

Provides helper methods for password encryption and veryfication.
파일 보기 프로젝트 열기: coreframework/Core-Framework

공개 메소드들

메소드 설명
Encrypt ( String plainText, PasswordMode mode ) : PasswordHash

Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.

Encrypt ( String plainText, PasswordMode mode, String salt ) : PasswordHash

Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.

Verify ( String plainText, PasswordHash expected, PasswordMode mode ) : 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.

비공개 메소드들

메소드 설명
Encrypt ( byte passwordBytes, byte saltBytes, HashAlgorithm algorithm ) : byte[]

메소드 상세

Encrypt() 공개 정적인 메소드

Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.
public static Encrypt ( String plainText, PasswordMode mode ) : PasswordHash
plainText String Plaintext value to be hashed. The function does not check whether this parameter is null.
mode PasswordMode Password encryption mode.
리턴 PasswordHash

Encrypt() 공개 정적인 메소드

Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.
public static Encrypt ( String plainText, PasswordMode mode, String salt ) : PasswordHash
plainText String Plaintext value to be hashed. The function does not check whether this parameter is null.
mode PasswordMode Password encryption mode.
salt String Random bits that are used as one of the inputs to a key derivation function (formatted as a base64-encoded string).
리턴 PasswordHash

Verify() 공개 정적인 메소드

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 Verify ( String plainText, PasswordHash expected, PasswordMode mode ) : bool
plainText String Plain text to be verified against the specified hash. The function does not check whether this parameter is null.
expected PasswordHash Password expected hash.
mode PasswordMode Password encryption mode.
리턴 bool