Skip to content

Commit 6d2aa33

Browse files
committed
added support for OTP 22 and 24
1 parent 864bf70 commit 6d2aa33

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/mongo/pbkdf2.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ defmodule Mongo.PBKDF2 do
5454
iterate(fun, iteration - 1, next, :crypto.exor(next, acc))
5555
end
5656

57-
defp mac_fun(digest, secret) do
58-
&:crypto.mac(:hmac, digest, secret, &1)
57+
if Code.ensure_loaded?(:crypto) and function_exported?(:crypto, :hmac, 3) do
58+
defp mac_fun(digest, secret) do
59+
&:crypto.hmac(digest, secret, &1)
60+
end
61+
else
62+
defp mac_fun(digest, secret) do
63+
&:crypto.mac(:hmac, digest, secret, &1)
64+
end
5965
end
66+
6067
end

0 commit comments

Comments
 (0)