Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Update documentation to reflect changes
  • Loading branch information
hntrmrrs committed Apr 3, 2011
1 parent ddd2b92 commit e538a31696d192d248697a7cc862205f56b409f6
Showing 1 changed file with 27 additions and 15 deletions.
@@ -11,36 +11,48 @@ Provos and David Mazieres.
Basic build instructions
------------------------

1. Build it::
1. Build it (project uses rebar, but I've included a Makefile)::

make

2. Run it::
2. Run it (simple way, starting sasl, crypto and bcrypt)::

erl -pa ebin
erl -pa ebin -boot start_sasl -s crypto -s bcrypt

Basic usage instructions
------------------------

1. Start the `sasl` and `crypto` applications::
3. Hash a password using a salt with the default number of rounds::

1> ok = application:start(sasl).
ok
2> ok = application:start(crypto).
ok

2. Hash a password using a salt with the default number of rounds::

4> Hash = bcrypt:hashpw("foo", bcrypt:gen_salt()).
"$2...000"
1> {ok, Salt} = bcrypt:gen_salt(),
{ok,"$2a$12$sSS8Eg.ovVzaHzi1nUHYK."}
2> {ok, Hash} = bcrypt:hashpw("foo", Salt),
{ok,"$2a$12$sSS8Eg.ovVzaHzi1nUHYK.HbUIOdlQI0iS22Q5rd5z.JVVYH6sfm6"}

3. Verify the password::

5> Hash =:= bcrypt:hashpw("foo", Hash).
3> {ok, Hash} =:= bcrypt:hashpw("foo", Hash).
true
6> Hash =:= bcrypt:hashpw("bar", Hash).
4> {ok, Hash} =:= bcrypt:hashpw("bar", Hash).
false

Configuration
-------------

The bcrypt application is configured by changing values in the
application's environment:

``default_log_rounds``
Sets the default number of rounds which define the complexity of the
hash function. Defaults to ``12``.

``mechanism``
Specifies whether to use the NIF implementation (``'nif'``) or a
pool of port programs (``'port'``). Defaults to ``'port'``.

``pool_size``
Specifies the size of the port program pool. Defaults to ``4``.

Authors
-------

0 comments on commit e538a31

Please sign in to comment.