Method | Description | |
---|---|---|
GenerateSalt ( ) : string |
Generate a salt for use with the BCrypt.HashPassword(string,string) method selecting a reasonable default for the number of hashing rounds to apply.
|
|
GenerateSalt ( int workFactor ) : string |
Generate a salt for use with the BCrypt.HashPassword(string,string) method.
|
|
HashPassword ( string input ) : string |
Hash a password using the OpenBSD bcrypt scheme and a salt generated by
|
|
HashPassword ( string input, int workFactor ) : string |
Hash a password using the OpenBSD bcrypt scheme and a salt generated by
|
|
HashPassword ( string input, string salt ) : string |
Hash a password using the OpenBSD bcrypt scheme.
|
|
HashString ( string source ) : string |
Hash a string using the OpenBSD bcrypt scheme and a salt generated by Just an alias for HashPassword. |
|
HashString ( string source, int workFactor ) : string |
Hash a string using the OpenBSD bcrypt scheme and a salt generated by Just an alias for HashPassword. |
|
HashUsingOpensshBCryptPbkdf ( char pass, byte salt, byte &key, uint rounds ) : void |
Compute hash using bcrypt_pdkdf function from Openssh. pkcs #5 pbkdf2 implementation using the "bcrypt" hash The bcrypt hash function is derived from the bcrypt password hashing function with the following modifications: 1. The input password and salt are preprocessed with SHA512. 2. The output length is expanded to 256 bits. 3. Subsequently the magic string to be encrypted is lengthened and modifed to "OxychromaticBlowfishSwatDynamite" 4. The hash function is defined to perform 64 rounds of initial state expansion. (More rounds are performed by iterating the hash.) One modification from official pbkdf2. Instead of outputting key material linearly, we mix it. pbkdf2 has a known weakness where if one uses it to generate (e.g.) 512 bits of key material for use as two 256 bit keys, an attacker can merely run once through the outer loop, but the user always runs it twice. Shuffling output bytes requires computing the entirety of the key material to assemble any subkey. This is something a wise caller could do; we just do it for you. |
|
Verify ( string text, string hash ) : bool |
Verifies that the hash of the given text matches the provided hash
|
Method | Description | |
---|---|---|
Char64 ( char character ) : int |
Look up the 3 bits base64-encoded by the specified character, range-checking against conversion table.
|
|
CryptRaw ( byte inputBytes, byte saltBytes, int logRounds ) : byte[] |
Perform the central hashing step in the bcrypt scheme.
|
|
CryptUsingOpensshBcryptHash ( byte sha2pass, byte sha2salt ) : byte[] |
Encyrypt password using openssh bcrypt_hash function. Similar to CryptRaw.
|
|
DecodeBase64 ( string encodedstring, int maximumBytes ) : 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 saltBytes, byte inputBytes ) : 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 blockArray, int offset ) : void |
Blowfish encipher a single 64-bit block encoded as two 32-bit halves.
|
|
EncodeBase64 ( byte byteArray, 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.
|
|
InitializeKey ( ) : void |
Initializes the Blowfish key schedule.
|
|
Key ( byte keyBytes ) : void |
Key the Blowfish cipher.
|
|
StreamToWord ( byte data, int &offset ) : uint |
Cycically extract a word of key material.
|
public static GenerateSalt ( int workFactor ) : string | ||
workFactor | int | The log2 of the number of rounds of hashing to apply - the work /// factor therefore increases as 2**workFactor. |
return | string |
public static HashPassword ( string input ) : string | ||
input | string | The password to hash. |
return | string |
public static HashPassword ( string input, int workFactor ) : string | ||
input | string | The password to hash. |
workFactor | int | The log2 of the number of rounds of hashing to apply - the work /// factor therefore increases as 2^workFactor. |
return | string |
public static HashPassword ( string input, string salt ) : string | ||
input | string | The password to hash. |
salt | string | the salt to hash with (perhaps generated using BCrypt.gensalt). |
return | string |
public static HashString ( string source ) : string | ||
source | string | The string to hash. |
return | string |
public static HashString ( string source, int workFactor ) : string | ||
source | string | The string to hash. |
workFactor | int | The log2 of the number of rounds of hashing to apply - the work /// factor therefore increases as 2^workFactor. |
return | string |
public static HashUsingOpensshBCryptPbkdf ( char pass, byte salt, byte &key, uint rounds ) : void | ||
pass | char | The passphrase. |
salt | byte | The salt. |
key | byte | The key. Must be initalized to the size needed. |
rounds | uint | The number of rounds. |
return | void |
public static Verify ( string text, string hash ) : bool | ||
text | string | The text to verify. |
hash | string | The previously-hashed password. |
return | bool |