Skip to content

Commit

Permalink
remove fast_pbkdf2 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Aug 14, 2023
1 parent c705306 commit f8d48a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{erl_opts, []}.

{deps, [{fast_pbkdf2, "1.0.3"}]}.
{deps, []}.
{plugins, [rebar3_hex]}.

{profiles, [
Expand Down
9 changes: 1 addition & 8 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{"1.2.0",
[{<<"fast_pbkdf2">>,{pkg,<<"fast_pbkdf2">>,<<"1.0.3">>},0}]}.
[
{pkg_hash,[
{<<"fast_pbkdf2">>, <<"4F09D6C6C20DBEE1970E0A6AE91432E1B7731F88426C671D083BAC31FFA1FDAD">>}]},
{pkg_hash_ext,[
{<<"fast_pbkdf2">>, <<"2900431E2E6402F23A92754448BBD949DA366BC9C984FDC791DDCFCC41042434">>}]}
].
[].
3 changes: 2 additions & 1 deletion src/fast_scram.erl
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,5 @@ server_signature(Sha, ServerKey, AuthMessage) ->
-spec hi(sha_type(), binary(), binary(), non_neg_integer()) -> binary().
hi(Hash, Password, Salt, IterationCount)
when ?is_valid_hash(Hash), is_binary(Password), is_binary(Salt), ?is_positive_integer(IterationCount) ->
fast_pbkdf2:pbkdf2(Hash, Password, Salt, IterationCount).
#{ size := KeyLength } = crypto:hash_info(Hash),
crypto:pbkdf2_hmac(Hash, Password, Salt, IterationCount, KeyLength).
3 changes: 2 additions & 1 deletion src/fast_scram_definitions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
-spec salted_password(sha_type(), binary(), binary(), non_neg_integer()) -> binary().
salted_password(Sha, Password, Salt, IterationCount)
when ?is_valid_hash(Sha), is_binary(Password), is_binary(Salt), ?is_positive_integer(IterationCount) ->
fast_pbkdf2:pbkdf2(Sha, Password, Salt, IterationCount).
#{ size := KeyLength } = crypto:hash_info(Sha),
crypto:pbkdf2_hmac(Sha, Password, Salt, IterationCount, KeyLength).

-spec client_key(sha_type(), binary()) -> binary().
client_key(Sha, SaltedPassword)
Expand Down

0 comments on commit f8d48a7

Please sign in to comment.