Skip to content

Commit 42c2484

Browse files
authored
Update fast_pbkdf2 to upstream d079c45 (#4944)
1 parent af1a17f commit 42c2484

File tree

6 files changed

+62
-78
lines changed

6 files changed

+62
-78
lines changed

.credo.exs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
~r"/node_modules/",
2828
~r"/src/certifi/",
2929
~r"/src/excoveralls/",
30+
~r"/src/fast_pbkdf2/",
3031
~r"/src/jason",
3132
~r"/src/hackney",
3233
~r"/src/httpotion",

src/fast_pbkdf2/Makefile

-39
This file was deleted.

src/fast_pbkdf2/benchmarks/bench.ex

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
defmodule PBKDF2.Benchmarks do
2-
@moduledoc "blank"
32
def pbkdf2_input itCount do
43
password = :base64.encode(:crypto.strong_rand_bytes(10))
54
salt = :base64.encode(:crypto.strong_rand_bytes(16))
@@ -26,9 +25,9 @@ Benchee.run(
2625
"1. 8" => PBKDF2.Benchmarks.pbkdf2_input(8),
2726
"2. 512" => PBKDF2.Benchmarks.pbkdf2_input(512),
2827
"3. 4096" => PBKDF2.Benchmarks.pbkdf2_input(4096),
29-
"4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10_000),
30-
"5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160_000),
31-
"6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500_000)
28+
"4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10000),
29+
"5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160000),
30+
"6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500000)
3231
},
3332
parallel: 12,
3433
time: 5,

src/fast_pbkdf2/mix.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule FastPbkdf2.MixProject do
1+
defmodule Fast_Pbkdf2.MixProject do
22
use Mix.Project
33

44
def project do

src/fast_pbkdf2/rebar.config

+49-34
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{erl_opts, [
22
deterministic
3-
]}.
3+
]}.
44

55
{deps, []}.
66

@@ -10,51 +10,66 @@
1010
{deps, [
1111
{base16, "2.0.1"},
1212
{proper, "1.4.0"}
13-
]},
13+
]},
1414
{plugins, [
15-
{rebar3_codecov, "0.3.0"}
16-
]},
17-
{port_env,
18-
[
19-
{"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC --coverage"},
20-
{"LDFLAGS", "$LDFLAGS --coverage"},
21-
{"LDLIBS", "$LDLIBS -lcrypto"},
22-
{"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}
23-
]}
24-
]}
25-
]
15+
{rebar3_codecov, "0.6.0"}]},
16+
{port_env,
17+
[
18+
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
19+
"CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC -I/opt/homebrew/include -I/usr/local/include --coverage"},
20+
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
21+
"LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib --coverage"}
22+
]
23+
}
24+
]}
25+
]
2626
}.
2727

28-
{plugins, [pc, rebar3_hex]}.
28+
{plugins, [pc]}.
2929

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

3242
{port_specs,
33-
[
43+
[
3444
{
35-
% Any arch
36-
".*",
37-
% Create library
38-
"priv/fast_pbkdf2.so",
39-
% From files
40-
["c_src/*.c"],
41-
% Using options
42-
[ {env, [{"(linux|solaris|darwin|freebsd)", "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include/"},
43-
{"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"},
44-
{"(linux|solaris|darwin|freebsd)", "LDLIBS", "$LDLIBS -lcrypto -L /opt/homebrew/lib/"},
45-
{"win32", "LDLIBS", "$LDLIBS libcrypto.lib"},
46-
{"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}]}]
47-
}
48-
]}.
45+
% Any arch
46+
".*",
47+
% Create library
48+
"priv/fast_pbkdf2.so",
49+
% From files
50+
["c_src/*.c"]
51+
}
52+
]}.
4953

5054
{provider_hooks,
51-
[
55+
[
5256
{post,
53-
[
57+
[
5458
{compile, {pc, compile}},
5559
{clean, {pc, clean}}
56-
]}
57-
]}.
60+
]}
61+
]}.
5862

5963
{cover_enabled, true}.
6064
{cover_export_enabled, true}.
65+
66+
{project_plugins, [
67+
rebar3_hex,
68+
rebar3_ex_doc
69+
]}.
70+
71+
{hex, [{doc, ex_doc}]}.
72+
73+
{ex_doc, [
74+
{source_url, <<"https://github.com/esl/fast_pbkdf2">>}
75+
]}.

src/fast_pbkdf2/rebar.config.script

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Artifacts = case os:type() of
2+
{win32, _} ->
3+
[{artifacts, ["priv/fast_pbkdf2.dll"]}];
4+
_ ->
5+
[{artifacts, ["priv/fast_pbkdf2.so"]}]
6+
end,
7+
8+
CONFIG ++ Artifacts.

0 commit comments

Comments
 (0)