crypto::bcrypt +linux +x86_64

This module implements the bcrypt password hash based on Bruce Schneier's blowfish. This is a legacy algorithm which is not recommended for new users.

This is a low-level module which implements cryptographic primitives. Direct use of cryptographic primitives is not recommended for non-experts, as incorrect use of these primitives can easily lead to the introduction of security vulnerabilities. Non-experts are advised to use the high-level operations available in the top-level crypto module.

Be advised that Hare's cryptography implementations have not been audited.



const DEFAULT_COST: uint;
const MAX_COST: uint;
const MIN_COST: uint;


fn compare([]u8, []u8) (bool | errors::invalid);
fn generate([]u8, uint) []u8;


def DEFAULT_COST[link]

def DEFAULT_COST: uint;

The recommended default cost for a bcrypt hash.

def MAX_COST[link]

def MAX_COST: uint;

The maximum cost for a bcrypt hash.

def MIN_COST[link]

def MIN_COST: uint;

The minimum cost for a bcrypt hash.


fn compare[link]

fn compare(hash: []u8, password: []u8) (bool | errors::invalid);

Compares a password against a bcrypt hash, returning true if the given password matches the hash, or false otherwise. errors::invalid is returned if the provided hash is not a valid bcrypt hash.

fn generate[link]

fn generate(password: []u8, cost: uint) []u8;

Hashes a password using the bcrypt algorithm. The caller must free the return value.