Removed conditions on deprecated cryptos and rand modoles
* CI/CD lowest OTP version is 19.3 * from 19.3, `rand` module exists (https://www.erlang.org/docs/19/man/rand) * from 19.3, `crypto:hash/1` exists (https://www.erlang.org/docs/19/man/crypto).
This commit is contained in:
parent
952a1d2bc6
commit
685f08621b
2 changed files with 4 additions and 13 deletions
|
@ -143,19 +143,13 @@ try_write_group(To, #file_info{gid=OwnerId}) ->
|
|||
%% named after the UNIX utility.
|
||||
-spec md5sum(string() | binary()) -> string().
|
||||
md5sum(Value) ->
|
||||
bin_to_hex(erlang:md5(Value)).
|
||||
bin_to_hex(crypto:hash(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) ->
|
||||
bin_to_hex(crypto:sha(Value)).
|
||||
-else.
|
||||
-spec sha1sum(string() | binary()) -> string().
|
||||
sha1sum(Value) ->
|
||||
bin_to_hex(crypto:hash(sha, Value)).
|
||||
-endif.
|
||||
|
||||
bin_to_hex(Bin) ->
|
||||
hex(binary_to_list(Bin)).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue