crypto::bcrypt+x86_64 +linux

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.

Index

Constants

def DEFAULT_COST: uint = 10;
def MAX_COST: uint = 32;
def MIN_COST: uint = 4;

Functions

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

Constants

def DEFAULT_COST[link]

def DEFAULT_COST: uint = 10;

The recommended default cost for a bcrypt hash.

def MAX_COST[link]

def MAX_COST: uint = 32;

The maximum cost for a bcrypt hash.

def MIN_COST[link]

def MIN_COST: uint = 4;

The minimum cost for a bcrypt hash.

Functions

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.