From 959dcbd917bc5af9659b0eb6a043571d7cd67061 Mon Sep 17 00:00:00 2001 From: Kanstantsin Date: Sat, 29 Mar 2014 17:43:33 +0200 Subject: [PATCH 1/3] Update cutkey.erl make he lib working in R16 --- src/cutkey.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cutkey.erl b/src/cutkey.erl index af292d7..5635e37 100644 --- a/src/cutkey.erl +++ b/src/cutkey.erl @@ -68,7 +68,7 @@ rsa(Bits, E, Opts) when is_integer(Bits), Bits > 0, E band 1 =:= 1 -> false -> erlang:error(badarg) end. -erlint(MPInts) -> [ crypto:erlint(X) || X <- MPInts ]. +erlint(MPInts) -> [ crypto:bytes_to_intyger(X) || X <- MPInts ]. -ifdef(TEST). @@ -81,7 +81,7 @@ bare_test_() -> [fun() -> {ok, MPInts} = cutkey:rsa(512, 65537, [{return, bare}]), 3 = length(MPInts), - Fun = fun(X) -> is_integer(crypto:erlint(X)) end, + Fun = fun(X) -> is_integer(crypto:bytes_to_intyger(X)) end, true = lists:all(Fun, MPInts) end, fun() -> From 3220f64e978a17cf9f921279b36b1327205f7204 Mon Sep 17 00:00:00 2001 From: Kanstantsin Date: Thu, 3 Apr 2014 17:13:59 +0300 Subject: [PATCH 2/3] Update cutkey.erl fix typeo --- src/cutkey.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cutkey.erl b/src/cutkey.erl index 5635e37..12b55e5 100644 --- a/src/cutkey.erl +++ b/src/cutkey.erl @@ -68,7 +68,7 @@ rsa(Bits, E, Opts) when is_integer(Bits), Bits > 0, E band 1 =:= 1 -> false -> erlang:error(badarg) end. -erlint(MPInts) -> [ crypto:bytes_to_intyger(X) || X <- MPInts ]. +erlint(MPInts) -> [ crypto:bytes_to_integer(X) || X <- MPInts ]. -ifdef(TEST). @@ -81,7 +81,7 @@ bare_test_() -> [fun() -> {ok, MPInts} = cutkey:rsa(512, 65537, [{return, bare}]), 3 = length(MPInts), - Fun = fun(X) -> is_integer(crypto:bytes_to_intyger(X)) end, + Fun = fun(X) -> is_integer(crypto:bytes_to_integer(X)) end, true = lists:all(Fun, MPInts) end, fun() -> From 0dc50329b4d4d13c69eafd08fc6611a61fcf8dd0 Mon Sep 17 00:00:00 2001 From: Kanstantsin Date: Thu, 3 Apr 2014 17:24:16 +0300 Subject: [PATCH 3/3] Update cutkey.erl finally fixed --- src/cutkey.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cutkey.erl b/src/cutkey.erl index 12b55e5..b4a13de 100644 --- a/src/cutkey.erl +++ b/src/cutkey.erl @@ -68,7 +68,12 @@ rsa(Bits, E, Opts) when is_integer(Bits), Bits > 0, E band 1 =:= 1 -> false -> erlang:error(badarg) end. -erlint(MPInts) -> [ crypto:bytes_to_integer(X) || X <- MPInts ]. +erlint(MPInts) -> [ crypto_erlint(X) || X <- MPInts ]. + +crypto_erlint(<>) -> + Bits= MPIntSize * 8, + <> = MPIntValue, + Integer. -ifdef(TEST). @@ -81,7 +86,7 @@ bare_test_() -> [fun() -> {ok, MPInts} = cutkey:rsa(512, 65537, [{return, bare}]), 3 = length(MPInts), - Fun = fun(X) -> is_integer(crypto:bytes_to_integer(X)) end, + Fun = fun(X) -> is_integer(crypto_erlint(X)) end, true = lists:all(Fun, MPInts) end, fun() -> @@ -97,7 +102,7 @@ full_test_() -> [fun() -> {ok, MPInts} = cutkey:rsa(512, 65537, [{return, full}]), 8 = length(MPInts), - Fun = fun(X) -> is_integer(crypto:erlint(X)) end, + Fun = fun(X) -> is_integer(crypto_erlint(X)) end, true = lists:all(Fun, MPInts) end, fun() ->