<commit_before># bcrypt

[![Build Status](https://travis-ci.org/Keats/rust-bcrypt.svg)](https://travis-ci.org/Keats/rust-bcrypt)

## Installation
Add the following to Cargo.toml:

```toml
bcrypt = "0.1"
```

## Usage
The crate makes 3 things public: `DEFAULT_COST`, `hash`, `verify`.

```rust
extern crate bcrypt;

use bcrypt::{DEFAULT_COST, hash, verify};

let hashed = match hash("hunter2", DEFAULT_COST) {
    Ok(h) => h,
    Err(_) => panic!()
};

let valid = match verify("hunter2", &hashed) {
    Ok(valid) => valid,
    Err(_) => panic!()
};
```

The cost needs to be an integer between 4 and 31 (see benchmarks to have an idea of the speed for each), the `DEFAULT_COST` is 12.

## Benchmarks
Speed depends on the cost used: the highest the slowest.
Here are some benchmarks to give you some ideas on the cost/speed ratio. Note that I don't go above 14 as it takes too long.

```
test bench_cost_4       ... bench:   1,312,762 ns/iter (+/- 155,397)
test bench_cost_10      ... bench:  80,696,053 ns/iter (+/- 8,290,601)
test bench_cost_default ... bench: 322,494,673 ns/iter (+/- 19,445,864)
test bench_cost_14      ... bench: 1,295,103,136 ns/iter (+/- 83,242,618)
```

## Acknowledgments
This [gist](https://gist.github.com/rgdmarshall/ae3dc072445ed88b357a) for the hash splitting and the null termination.


## Changelog

0.1.3: Fix panic when password > 72 chars
0.1.1: make BcryptResult, BcryptError public and update dependencies
0.1.0: initial release<commit_msg>readme: make changelog a markdown list<commit_after># bcrypt

[![Build Status](https://travis-ci.org/Keats/rust-bcrypt.svg)](https://travis-ci.org/Keats/rust-bcrypt)

## Installation
Add the following to Cargo.toml:

```toml
bcrypt = "0.1"
```

## Usage
The crate makes 3 things public: `DEFAULT_COST`, `hash`, `verify`.

```rust
extern crate bcrypt;

use bcrypt::{DEFAULT_COST, hash, verify};

let hashed = match hash("hunter2", DEFAULT_COST) {
    Ok(h) => h,
    Err(_) => panic!()
};

let valid = match verify("hunter2", &hashed) {
    Ok(valid) => valid,
    Err(_) => panic!()
};
```

The cost needs to be an integer between 4 and 31 (see benchmarks to have an idea of the speed for each), the `DEFAULT_COST` is 12.

## Benchmarks
Speed depends on the cost used: the highest the slowest.
Here are some benchmarks to give you some ideas on the cost/speed ratio. Note that I don't go above 14 as it takes too long.

```
test bench_cost_4       ... bench:   1,312,762 ns/iter (+/- 155,397)
test bench_cost_10      ... bench:  80,696,053 ns/iter (+/- 8,290,601)
test bench_cost_default ... bench: 322,494,673 ns/iter (+/- 19,445,864)
test bench_cost_14      ... bench: 1,295,103,136 ns/iter (+/- 83,242,618)
```

## Acknowledgments
This [gist](https://gist.github.com/rgdmarshall/ae3dc072445ed88b357a) for the hash splitting and the null termination.


## Changelog

* 0.1.3: Fix panic when password > 72 chars
* 0.1.1: make BcryptResult, BcryptError public and update dependencies
* 0.1.0: initial release
{'fraction_non_alphanumeric': 0.14606365159128978, 'fraction_numerical': 0.06901172529313233, 'mean_word_length': 3.8552845528455286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '391831', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1035, 'n_words': 334}