Merge pull request #167 from ariel-anieli/pr-deprecation-cond
Removed checks on deprecated crypto:sha/1 & random:uniform/0
This commit is contained in:
commit
20d049ea4f
2 changed files with 4 additions and 19 deletions
|
@ -11,9 +11,6 @@
|
||||||
{erl_opts,
|
{erl_opts,
|
||||||
[{platform_define, "^[0-9]+", namespaced_types},
|
[{platform_define, "^[0-9]+", namespaced_types},
|
||||||
{platform_define, "^[0-9]+", have_callback_support},
|
{platform_define, "^[0-9]+", have_callback_support},
|
||||||
{platform_define, "^R1[4|5]", deprecated_crypto},
|
|
||||||
{platform_define, "^1[8|9]", rand_module},
|
|
||||||
{platform_define, "^2", rand_module},
|
|
||||||
{platform_define, "^2", unicode_str},
|
{platform_define, "^2", unicode_str},
|
||||||
{platform_define, "^(R|1|20)", fun_stacktrace},
|
{platform_define, "^(R|1|20)", fun_stacktrace},
|
||||||
debug_info,
|
debug_info,
|
||||||
|
|
|
@ -143,19 +143,13 @@ try_write_group(To, #file_info{gid=OwnerId}) ->
|
||||||
%% named after the UNIX utility.
|
%% named after the UNIX utility.
|
||||||
-spec md5sum(string() | binary()) -> string().
|
-spec md5sum(string() | binary()) -> string().
|
||||||
md5sum(Value) ->
|
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,
|
%% @doc return the SHA-1 digest of a string or a binary,
|
||||||
%% named after the UNIX utility.
|
%% 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().
|
-spec sha1sum(string() | binary()) -> string().
|
||||||
sha1sum(Value) ->
|
sha1sum(Value) ->
|
||||||
bin_to_hex(crypto:hash(sha, Value)).
|
bin_to_hex(crypto:hash(sha, Value)).
|
||||||
-endif.
|
|
||||||
|
|
||||||
bin_to_hex(Bin) ->
|
bin_to_hex(Bin) ->
|
||||||
hex(binary_to_list(Bin)).
|
hex(binary_to_list(Bin)).
|
||||||
|
@ -382,14 +376,8 @@ sub_files(From) ->
|
||||||
{ok, SubFiles} = file:list_dir(From),
|
{ok, SubFiles} = file:list_dir(From),
|
||||||
[filename:join(From, SubFile) || SubFile <- SubFiles].
|
[filename:join(From, SubFile) || SubFile <- SubFiles].
|
||||||
|
|
||||||
-ifdef(rand_module).
|
|
||||||
random_uniform() ->
|
random_uniform() ->
|
||||||
rand:uniform().
|
rand:uniform().
|
||||||
-else.
|
|
||||||
random_uniform() ->
|
|
||||||
random:seed(os:timestamp()),
|
|
||||||
random:uniform().
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Test Functions
|
%%% Test Functions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue