C# Класс BCrypt, Zetetic.Security

Показать файл Открыть проект Примеры использования класса

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

Метод Описание
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.

Защищенные методы

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

Perform the central password hashing step in the bcrypt scheme.

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

Метод Описание
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.

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

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

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.
Результат bool

CryptRaw() защищенный Метод

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.
Результат byte[]

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

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
Результат string

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

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).
Результат string

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

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).
Результат string