diff --git a/rebar.config b/rebar.config index 07a123c..3cd89c7 100644 --- a/rebar.config +++ b/rebar.config @@ -10,6 +10,7 @@ %% Compiler Options ============================================================ {erl_opts, [{platform_define, "^[0-9]+", namespaced_types}, + {platform_define, "^R1[4|5]", deprecated_crypto}, debug_info, warnings_as_errors]}. diff --git a/src/ec_file.erl b/src/ec_file.erl index 3fe8a93..1885bde 100644 --- a/src/ec_file.erl +++ b/src/ec_file.erl @@ -94,9 +94,15 @@ md5sum(Value) -> %% @doc return an sha1sum checksum string or a binary. Same as unix utility of %% same name. +-ifdef(deprecated_crypto). -spec sha1sum(string() | binary()) -> string(). -sha1sum(Value) -> +sha1sum(Value) -> + hex(binary_to_list(crypto:sha(Value))). +-else. +-spec sha1sum(string() | binary()) -> string(). +sha1sum(Value) -> hex(binary_to_list(crypto:hash(sha, Value))). +-endif. %% @doc delete a file. Use the recursive option for directories. %%