From 28c80c4e5cd0a07c7e73d3e5321e86461f381bf8 Mon Sep 17 00:00:00 2001 From: Asghar Khan Date: Mon, 16 Aug 2021 16:35:59 +0500 Subject: [PATCH] Update utils.ex support for Erlang 24 added --- lib/aws_auth/utils.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/aws_auth/utils.ex b/lib/aws_auth/utils.ex index bd188ce..94bdfdc 100644 --- a/lib/aws_auth/utils.ex +++ b/lib/aws_auth/utils.ex @@ -49,7 +49,11 @@ defmodule AWSAuth.Utils do end def hmac_sha256(key, data) do - :crypto.hmac(:sha256, key, data) + if function_exported?(:crypto, :mac, 4) do + :crypto.mac(:hmac, :sha256, key, data) + else + :crypto.hmac(:sha256, key, data) + end end def bytes_to_string(bytes) do