MSPF-440: upgrade codebase to OTP 21 and move to rebar3

This commit is contained in:
Rustem Shaydullin 2019-05-06 17:07:09 +03:00
parent 232ac4f71d
commit 5ac616232a
5 changed files with 13 additions and 7 deletions

BIN
rebar vendored

Binary file not shown.

View File

@ -1,5 +1,5 @@
{deps, [
{proper, ".*", {git, "https://github.com/manopapad/proper.git", "master"}}
{proper, "1.3.0"}
]}.
{cover_enabled, true}.

6
rebar.lock Normal file
View File

@ -0,0 +1,6 @@
{"1.1.0",
[{<<"proper">>,{pkg,<<"proper">>,<<"1.3.0">>},0}]}.
[
{pkg_hash,[
{<<"proper">>, <<"C1ACD51C51DA17A2FE91D7A6FC6A0C25A6A9849D8DC77093533109D1218D8457">>}]}
].

View File

@ -27,7 +27,7 @@ share(Secret, Threshold, Count) when is_list(Secret) ->
share(Secret, Threshold, Count) when (Secret >= 0 andalso Secret =< 255) ->
GF = galois:generate(8),
Coeffs = binary_to_list(crypto:rand_bytes(Threshold - 1)) ++ [Secret],
Coeffs = binary_to_list(crypto:strong_rand_bytes(Threshold - 1)) ++ [Secret],
[horner(GF, X, Coeffs) || X <- lists:seq(1, Count)].
horner(GF, X, Coeffs) ->

View File

@ -21,7 +21,7 @@ hello_test() ->
shamir(<<"hello">>, 3, 4).
key_test() ->
shamir(crypto:rand_bytes(32), 3, 15).
shamir(crypto:strong_rand_bytes(32), 3, 15).
shamir(Secret, Threshold, Count) ->
Shares = shamir:share(Secret, Threshold, Count),
@ -41,8 +41,8 @@ proper_test_() ->
prop_secrets() ->
?FORALL(Secret, secret(),
begin
Threshold = random:uniform(10),
Count = Threshold * random:uniform(10),
Threshold = rand:uniform(10),
Count = Threshold * rand:uniform(10),
Shares = shamir:share(Secret, Threshold, Count),
RecoveredSecret = shamir:recover(
lists:sublist(
@ -52,7 +52,7 @@ prop_secrets() ->
).
secret() ->
crypto:rand_bytes(1 + random:uniform(64)).
crypto:strong_rand_bytes(1 + rand:uniform(64)).
shuffle(List) ->
%% Determine the log n portion then randomize the list.
@ -67,7 +67,7 @@ randomize(T, List) ->
randomize(List) ->
D = lists:map(fun(A) ->
{random:uniform(), A}
{rand:uniform(), A}
end, List),
{_, D1} = lists:unzip(lists:keysort(1, D)),
D1.