Skip to content

Commit

Permalink
turn_digest_into_hex/1 renamed as bin_to_hex/1
Browse files Browse the repository at this point in the history
  • Loading branch information
ariel-anieli committed Dec 21, 2023
1 parent 6781f1b commit fc69b36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ec_file.erl
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,22 @@ try_write_group(To, #file_info{gid=OwnerId}) ->
%% named after the UNIX utility.
-spec md5sum(string() | binary()) -> string().
md5sum(Value) ->
turn_digest_into_hex(erlang:md5(Value)).
bin_to_hex(erlang:md5(Value)).

%% @doc return the SHA-1 digest of a string or a binary,
%% named after the UNIX utility.
-ifdef(deprecated_crypto).
-spec sha1sum(string() | binary()) -> string().
sha1sum(Value) ->
turn_digest_into_hex(crypto:sha(Value)).
bin_to_hex(crypto:sha(Value)).
-else.
-spec sha1sum(string() | binary()) -> string().
sha1sum(Value) ->
turn_digest_into_hex(crypto:hash(sha, Value)).
bin_to_hex(crypto:hash(sha, Value)).
-endif.

turn_digest_into_hex(Digest) ->
hex(binary_to_list(Digest)).
bin_to_hex(Bin) ->
hex(binary_to_list(Bin)).

%% @doc delete a file. Use the recursive option for directories.
%% <pre>
Expand Down

0 comments on commit fc69b36

Please sign in to comment.