From 8e057ef1a24c95b98bf42d8f3622741e2f9a666f Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 9 Dec 2018 11:03:42 +0700 Subject: [PATCH] Updated README with more information about contributing --- README.md | 27 ++++++++++++++++++++++----- c_src/bcrypt_nif.c | 9 ++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4783a24..e35f7b0 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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` @@ -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. diff --git a/c_src/bcrypt_nif.c b/c_src/bcrypt_nif.c index 900414a..8cede41 100644 --- a/c_src/bcrypt_nif.c +++ b/c_src/bcrypt_nif.c @@ -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)) @@ -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]; @@ -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];