support r14/15 crypto

This commit is contained in:
Tristan Sloughter 2014-05-24 09:42:57 -05:00
parent 73f21ee770
commit 3121c892b4
2 changed files with 8 additions and 1 deletions

View file

@ -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]}.

View file

@ -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) ->
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.
%% <pre>