Skip to content

Commit

Permalink
Update fast_pbkdf2 to upstream d079c45 (#4944)
Browse files Browse the repository at this point in the history
  • Loading branch information
big-r81 committed Jan 4, 2024
1 parent af1a17f commit 42c2484
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 78 deletions.
1 change: 1 addition & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
~r"/node_modules/",
~r"/src/certifi/",
~r"/src/excoveralls/",
~r"/src/fast_pbkdf2/",
~r"/src/jason",
~r"/src/hackney",
~r"/src/httpotion",
Expand Down
39 changes: 0 additions & 39 deletions src/fast_pbkdf2/Makefile

This file was deleted.

7 changes: 3 additions & 4 deletions src/fast_pbkdf2/benchmarks/bench.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
defmodule PBKDF2.Benchmarks do
@moduledoc "blank"
def pbkdf2_input itCount do
password = :base64.encode(:crypto.strong_rand_bytes(10))
salt = :base64.encode(:crypto.strong_rand_bytes(16))
Expand All @@ -26,9 +25,9 @@ Benchee.run(
"1. 8" => PBKDF2.Benchmarks.pbkdf2_input(8),
"2. 512" => PBKDF2.Benchmarks.pbkdf2_input(512),
"3. 4096" => PBKDF2.Benchmarks.pbkdf2_input(4096),
"4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10_000),
"5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160_000),
"6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500_000)
"4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10000),
"5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160000),
"6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500000)
},
parallel: 12,
time: 5,
Expand Down
2 changes: 1 addition & 1 deletion src/fast_pbkdf2/mix.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule FastPbkdf2.MixProject do
defmodule Fast_Pbkdf2.MixProject do
use Mix.Project

def project do
Expand Down
83 changes: 49 additions & 34 deletions src/fast_pbkdf2/rebar.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{erl_opts, [
deterministic
]}.
]}.

{deps, []}.

Expand All @@ -10,51 +10,66 @@
{deps, [
{base16, "2.0.1"},
{proper, "1.4.0"}
]},
]},
{plugins, [
{rebar3_codecov, "0.3.0"}
]},
{port_env,
[
{"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC --coverage"},
{"LDFLAGS", "$LDFLAGS --coverage"},
{"LDLIBS", "$LDLIBS -lcrypto"},
{"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}
]}
]}
]
{rebar3_codecov, "0.6.0"}]},
{port_env,
[
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib --coverage"}
]
}
]}
]
}.

{plugins, [pc, rebar3_hex]}.
{plugins, [pc]}.

{artifacts, ["priv/fast_pbkdf2.so"]}.
{port_env,
[
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib"},
{"win32", "CFLAGS", "$CFLAGS /I${OPENSSL_INSTALL_DIR}/include /O2 /DNDEBUG /Wall"},
{"win32", "LDLIBS", "$LDLIBS /LIBPATH:${OPENSSL_INSTALL_DIR}/lib libcrypto.lib"},
{"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}
]
}.

{port_specs,
[
[
{
% Any arch
".*",
% Create library
"priv/fast_pbkdf2.so",
% From files
["c_src/*.c"],
% Using options
[ {env, [{"(linux|solaris|darwin|freebsd)", "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include/"},
{"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"},
{"(linux|solaris|darwin|freebsd)", "LDLIBS", "$LDLIBS -lcrypto -L /opt/homebrew/lib/"},
{"win32", "LDLIBS", "$LDLIBS libcrypto.lib"},
{"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}]}]
}
]}.
% Any arch
".*",
% Create library
"priv/fast_pbkdf2.so",
% From files
["c_src/*.c"]
}
]}.

{provider_hooks,
[
[
{post,
[
[
{compile, {pc, compile}},
{clean, {pc, clean}}
]}
]}.
]}
]}.

{cover_enabled, true}.
{cover_export_enabled, true}.

{project_plugins, [
rebar3_hex,
rebar3_ex_doc
]}.

{hex, [{doc, ex_doc}]}.

{ex_doc, [
{source_url, <<"https://github.com/esl/fast_pbkdf2">>}
]}.
8 changes: 8 additions & 0 deletions src/fast_pbkdf2/rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Artifacts = case os:type() of
{win32, _} ->
[{artifacts, ["priv/fast_pbkdf2.dll"]}];
_ ->
[{artifacts, ["priv/fast_pbkdf2.so"]}]
end,

CONFIG ++ Artifacts.

0 comments on commit 42c2484

Please sign in to comment.