Skip to content

Commit

Permalink
Updated README with more information about contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
riverrun committed Dec 9, 2018
1 parent 5127570 commit 8e057ef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ for more details.

1. Add bcrypt_elixir to the `deps` section of your mix.exs file:

If you are using Erlang 20:
If you are using Erlang >20:

```elixir
def deps do
[
{:bcrypt_elixir, "~> 1.0"}
{:bcrypt_elixir, "~> 1.1"}
]
end
```

If you are NOT using Erlang 20:
If you are NOT using Erlang 19 or below:

```elixir
def deps do
Expand Down Expand Up @@ -70,7 +70,7 @@ For a lower-level api, see the documentation for Bcrypt.Base.
For further information about password hashing and using Bcrypt with Comeonin,
see the Comeonin [wiki](https://github.com/riverrun/comeonin/wiki).

## Docker
### Docker

In order to use `bcrypt_elixir` in Docker, you will probably need to manually compile it in your Dockerfile. In order to do it on the Alpine image, you're going to need `make`, `gcc` and `libc-dev`. Add the following lines to your Dockerfile, right after `RUN mix deps.get`

Expand All @@ -80,10 +80,27 @@ RUN apk add --no-cache make gcc libc-dev

Remember to add your local `_build` and `deps` folders to `.dockerignore`, because otherwise, you'll see errors coming up.

## Deployment
### Deployment

See the Comeonin [deployment guide](https://github.com/riverrun/comeonin/wiki/Deployment).

## Contributing

There are many ways you can contribute to the development of this library, including:

* reporting issues
* improving documentation
* sharing your experiences with others
* [making a financial contribution](#donations)

## Donations

You can support the ongoing maintenance of this project by
[making donations through Patreon](https://www.patreon.com/riverrun).

Patreon, by default, will bill you on a monthly basis. If you prefer to make a one-off payment,
see [this guide](https://support.patreon.com/hc/en-us/articles/204606215-Can-I-make-a-one-time-payment-).

### License

BSD. For full details, please read the LICENSE file.
9 changes: 4 additions & 5 deletions c_src/bcrypt_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ static int decode_base64(uint8_t *, size_t, const char *);
static void secure_bzero(void *, size_t);
static int secure_compare(const uint8_t *, const uint8_t *, size_t);

static ERL_NIF_TERM bcrypt_gensalt_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM bcrypt_gensalt_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
ErlNifBinary csalt;
unsigned int log_rounds, minor;

if (argc != 3 ||
!enif_inspect_binary(env, argv[0], &csalt) ||
if (argc != 3 || !enif_inspect_binary(env, argv[0], &csalt) ||
csalt.size != BCRYPT_MAXSALT ||
!enif_get_uint(env, argv[1], &log_rounds) ||
!enif_get_uint(env, argv[2], &minor))
Expand Down Expand Up @@ -227,7 +226,7 @@ static int bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
return -1;
}

static ERL_NIF_TERM bcrypt_hash_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM bcrypt_hash_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
char pass[BCRYPT_MAXPASS];
char salt[BCRYPT_SALTSPACE + 1];
Expand All @@ -245,7 +244,7 @@ static ERL_NIF_TERM bcrypt_hash_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
return output;
}

static ERL_NIF_TERM bcrypt_checkpass_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM bcrypt_checkpass_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
char pass[BCRYPT_MAXPASS];
char goodhash[BCRYPT_HASHSPACE + 1];
Expand Down

0 comments on commit 8e057ef

Please sign in to comment.