C# Class BCrypt, Zetetic.Security

Afficher le fichier Open project: skradel/Zetetic.Security Class Usage Examples

Méthodes publiques

Méthode Description
CheckPassword ( string plaintext, string hashed ) : bool

Check that a plaintext password matches a previously hashed one.

GenerateSalt ( ) : string

Generate a salt for use with the BCrypt.HashPassword() method, selecting a reasonable default for the number of hashing rounds to apply.

GenerateSalt ( int logRounds ) : string

Generate a salt for use with the BCrypt.HashPassword() method.

HashPassword ( string password, string salt ) : string

Hash a password using the OpenBSD bcrypt scheme.

Méthodes protégées

Méthode Description
CryptRaw ( byte password, byte salt, int logRounds ) : byte[]

Perform the central password hashing step in the bcrypt scheme.

Private Methods

Méthode Description
Char64 ( char c ) : int

Look up the 3 bits base64-encoded by the specified character, range-checking against the conversion table.

DecodeBase64 ( string s, int maximumLength ) : byte[]

Decode a string encoded using BCrypt's Base64 scheme to a byte array. Note that this is _not_ compatible with the standard MIME-Base64 encoding.

EksKey ( byte data, byte key ) : void

Perform the "enhanced key schedule" step described by Provos and Mazieres in "A Future-Adaptable Password Scheme" (http://www.openbsd.org/papers/bcrypt-paper.ps).

Encipher ( uint block, int offset ) : void

Blowfish encipher a single 64-bit block encoded as two 32-bit halves.

EncodeBase64 ( byte d, int length ) : string

Encode a byte array using bcrypt's slightly-modified Base64 encoding scheme. Note that this is _not_ compatible with the standard MIME-Base64 encoding.

InitKey ( ) : void

Initialize the Blowfish key schedule.

Key ( byte key ) : void

Key the Blowfish cipher.

StreamToWord ( byte data, int &offset ) : uint

Cycically extract a word of key material.

Method Details

CheckPassword() public static méthode

Check that a plaintext password matches a previously hashed one.
public static CheckPassword ( string plaintext, string hashed ) : bool
plaintext string The plaintext password to verify.
hashed string The previously hashed password.
Résultat bool

CryptRaw() protected méthode

Perform the central password hashing step in the bcrypt scheme.
protected CryptRaw ( byte password, byte salt, int logRounds ) : byte[]
password byte The password to hash.
salt byte The binary salt to hash with the /// password.
logRounds int The binary logarithm of the number of /// rounds of hashing to apply.
Résultat byte[]

GenerateSalt() public static méthode

Generate a salt for use with the BCrypt.HashPassword() method, selecting a reasonable default for the number of hashing rounds to apply.
public static GenerateSalt ( ) : string
Résultat string

GenerateSalt() public static méthode

Generate a salt for use with the BCrypt.HashPassword() method.
public static GenerateSalt ( int logRounds ) : string
logRounds int The log2 of the number of rounds of /// hashing to apply. The work factor therefore increases as (2 ** /// logRounds).
Résultat string

HashPassword() public static méthode

Hash a password using the OpenBSD bcrypt scheme.
public static HashPassword ( string password, string salt ) : string
password string The password to hash.
salt string The salt to hash with (perhaps generated /// using BCrypt.GenerateSalt).
Résultat string