@@ -13,7 +13,7 @@ gen_scalar() ->
|
||||
1 + X rem (ecu_ed25519:n() - 1).
|
||||
|
||||
bench_point_add_test() ->
|
||||
Pts = [ enacl:crypto_ed25519_scalarmult_base(<<(gen_scalar()):256/little>>) || _ <- lists:seq(1, 100) ],
|
||||
Pts = [ enacl:curve25519_scalarmult_base(<<(gen_scalar()):256/little>>) || _ <- lists:seq(1, 100) ],
|
||||
|
||||
PtsEnacl0 = lists:zip(Pts, tl(Pts) ++ [hd(Pts)]),
|
||||
PtsEd255190 = [ {ecu_ed25519:to_ext_hom(P1), ecu_ed25519:to_ext_hom(P2)} || {P1, P2} <- lists:zip(Pts, tl(Pts) ++ [hd(Pts)]) ],
|
||||
@@ -39,7 +39,7 @@ bench_scalar_mul_base_test() ->
|
||||
ScalarsEd25519 = lists:append(lists:duplicate(30, Scalars0)),
|
||||
|
||||
{TimeSecp, _} = timer:tc(fun() -> [ecu_secp256k1:scalar_mul_base(S) || S <- ScalarsSecp], ok end),
|
||||
{TimeEnacl, _} = timer:tc(fun() -> [enacl:crypto_ed25519_scalarmult_base(S) || S <- ScalarsEnacl], ok end),
|
||||
{TimeEnacl, _} = timer:tc(fun() -> [enacl:curve25519_scalarmult_base(S) || S <- ScalarsEnacl], ok end),
|
||||
{TimeEd25519, _} = timer:tc(fun() -> [ecu_ed25519:scalar_mul_base(S) || S <- ScalarsEd25519], ok end),
|
||||
|
||||
?debugFmt("", []),
|
||||
@@ -58,7 +58,7 @@ bench_scalar_mul_test() ->
|
||||
Test = fun(F, P0, Ss) -> lists:foldl(fun(S, P) -> F(S, P) end, P0, Ss) end,
|
||||
|
||||
{TimeSecp, _} = timer:tc(fun() -> Test(fun ecu_secp256k1:scalar_mul/2, ecu_secp256k1:scalar_mul_base(hd(ScalarsSecp)), tl(ScalarsSecp)) end),
|
||||
{TimeEnacl, _} = timer:tc(fun() -> Test(fun enacl:crypto_ed25519_scalarmult/2, enacl:crypto_ed25519_scalarmult_base(hd(ScalarsEnacl)), tl(ScalarsEnacl)) end),
|
||||
{TimeEnacl, _} = timer:tc(fun() -> Test(fun enacl:curve25519_scalarmult/2, enacl:curve25519_scalarmult_base(hd(ScalarsEnacl)), tl(ScalarsEnacl)) end),
|
||||
{TimeEd25519, _} = timer:tc(fun() -> Test(fun ecu_ed25519:scalar_mul/2, ecu_ed25519:scalar_mul_base(hd(ScalarsEd25519)), tl(ScalarsEd25519)) end),
|
||||
|
||||
?debugFmt("", []),
|
||||
|
||||
Reference in New Issue
Block a user