From ee0c4f6ae0bccb5194cd0eb842a229f0c343fff2 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:54:23 +0800 Subject: [PATCH 1/8] Update eth.gemspec --- eth.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth.gemspec b/eth.gemspec index 387789b..aecc2d2 100644 --- a/eth.gemspec +++ b/eth.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.test_files = spec.files.grep %r{^(test|spec|features)/} - spec.add_dependency 'keccak', '~> 1.3' + spec.add_dependency 'keccak256' spec.add_dependency 'ffi', '~> 1.15' spec.add_dependency 'money-tree', '~> 0.10' spec.add_dependency 'rlp', '~> 0.7' From 05b8d7bd5b167bfcf16de716c7b0f409c6d01c90 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:55:10 +0800 Subject: [PATCH 2/8] Update eth.rb --- lib/eth.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eth.rb b/lib/eth.rb index 4e7fcfc..0e51612 100644 --- a/lib/eth.rb +++ b/lib/eth.rb @@ -1,4 +1,4 @@ -require 'digest/keccak' +require 'keccak' require 'ffi' require 'money-tree' require 'rlp' From a1ef2ea5ca009df341c6943b980d14ab7b5be7da Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:55:16 +0800 Subject: [PATCH 3/8] Update eth.rb --- lib/eth.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eth.rb b/lib/eth.rb index 0e51612..3454272 100644 --- a/lib/eth.rb +++ b/lib/eth.rb @@ -1,4 +1,4 @@ -require 'keccak' +require 'keccak256' require 'ffi' require 'money-tree' require 'rlp' From 0ac5b5a2770e47221fe1ae489b04a7dbcc57c168 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:57:46 +0800 Subject: [PATCH 4/8] Update utils.rb --- lib/eth/utils.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/eth/utils.rb b/lib/eth/utils.rb index 44a59d8..37b0830 100644 --- a/lib/eth/utils.rb +++ b/lib/eth/utils.rb @@ -65,11 +65,12 @@ def sha256(x) end def keccak256(x) - Digest::Keccak.new(256).digest(x) + Digest::Keccak256.new.hexdigest(x) end def keccak512(x) - Digest::Keccak.new(512).digest(x) + puts "keccak512 is broken in this version" + #Digest::Keccak.new(512).digest(x) end def keccak256_rlp(x) From ffbb7d5161f6f4e293f340048335e60e8b035e73 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:58:13 +0800 Subject: [PATCH 5/8] Update open_ssl.rb --- lib/eth/open_ssl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eth/open_ssl.rb b/lib/eth/open_ssl.rb index a8ead15..aa2969a 100644 --- a/lib/eth/open_ssl.rb +++ b/lib/eth/open_ssl.rb @@ -6,7 +6,7 @@ class OpenSsl extend FFI::Library if FFI::Platform.windows? - ffi_lib 'libeay32', 'ssleay32' + ffi_lib 'libeay32', 'libssl-1_1-x64' else ffi_lib [ 'libssl.so.1.1.0', 'libssl.so.1.1', From 3d74d857ac14ff86c13ae3489929f312165e4020 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 15:01:41 +0800 Subject: [PATCH 6/8] Update open_ssl.rb test --- lib/eth/open_ssl.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/eth/open_ssl.rb b/lib/eth/open_ssl.rb index aa2969a..5929b3e 100644 --- a/lib/eth/open_ssl.rb +++ b/lib/eth/open_ssl.rb @@ -5,15 +5,15 @@ module Eth class OpenSsl extend FFI::Library - if FFI::Platform.windows? + #if FFI::Platform.windows? ffi_lib 'libeay32', 'libssl-1_1-x64' - else - ffi_lib [ - 'libssl.so.1.1.0', 'libssl.so.1.1', - 'libssl.so.1.0.0', 'libssl.so.10', - 'ssl' - ] - end + #else + # ffi_lib [ + # 'libssl.so.1.1.0', 'libssl.so.1.1', + # 'libssl.so.1.0.0', 'libssl.so.10', + # 'ssl' + # ] + #end NID_secp256k1 = 714 POINT_CONVERSION_COMPRESSED = 2 From 5465f9620e445d894e5f36e669c90006a000473d Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 15:03:01 +0800 Subject: [PATCH 7/8] Update open_ssl.rb test --- lib/eth/open_ssl.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/eth/open_ssl.rb b/lib/eth/open_ssl.rb index 5929b3e..025e80d 100644 --- a/lib/eth/open_ssl.rb +++ b/lib/eth/open_ssl.rb @@ -5,15 +5,15 @@ module Eth class OpenSsl extend FFI::Library - #if FFI::Platform.windows? + if true#FFI::Platform.windows? ffi_lib 'libeay32', 'libssl-1_1-x64' - #else - # ffi_lib [ - # 'libssl.so.1.1.0', 'libssl.so.1.1', - # 'libssl.so.1.0.0', 'libssl.so.10', - # 'ssl' - # ] - #end + else + ffi_lib [ + 'libssl.so.1.1.0', 'libssl.so.1.1', + 'libssl.so.1.0.0', 'libssl.so.10', + 'ssl' + ] + end NID_secp256k1 = 714 POINT_CONVERSION_COMPRESSED = 2 From da8fc5b57e5646842baee5afb255a82b97e84e63 Mon Sep 17 00:00:00 2001 From: Andrew <95168952+terhnt@users.noreply.github.com> Date: Thu, 9 Dec 2021 15:03:52 +0800 Subject: [PATCH 8/8] Update open_ssl.rb --- lib/eth/open_ssl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eth/open_ssl.rb b/lib/eth/open_ssl.rb index 025e80d..8199a5a 100644 --- a/lib/eth/open_ssl.rb +++ b/lib/eth/open_ssl.rb @@ -5,7 +5,7 @@ module Eth class OpenSsl extend FFI::Library - if true#FFI::Platform.windows? + if FFI::Platform.windows? ffi_lib 'libeay32', 'libssl-1_1-x64' else ffi_lib [