money-tree-openssl 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.simplecov +7 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +258 -0
- data/Rakefile +6 -0
- data/certs/mattatgemco.pem +24 -0
- data/checksum/money-tree-0.9.0.gem.sha512 +1 -0
- data/donation_btc_qr_code.gif +0 -0
- data/lib/money-tree/address.rb +16 -0
- data/lib/money-tree/key.rb +265 -0
- data/lib/money-tree/networks.rb +35 -0
- data/lib/money-tree/node.rb +302 -0
- data/lib/money-tree/support.rb +127 -0
- data/lib/money-tree/version.rb +3 -0
- data/lib/money-tree.rb +12 -0
- data/lib/openssl_extensions.rb +33 -0
- data/money-tree.gemspec +38 -0
- data/spec/lib/money-tree/address_spec.rb +62 -0
- data/spec/lib/money-tree/node_spec.rb +807 -0
- data/spec/lib/money-tree/openssl_extensions_spec.rb +64 -0
- data/spec/lib/money-tree/private_key_spec.rb +121 -0
- data/spec/lib/money-tree/public_key_spec.rb +187 -0
- data/spec/lib/money-tree/support_spec.rb +32 -0
- data/spec/spec_helper.rb +3 -0
- metadata +175 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
FIXED_KEY1 = <<-fixed_key
|
4
|
+
-----BEGIN EC PRIVATE KEY-----
|
5
|
+
MHQCAQEEIOvYaAN53KFhyLIElYFZCpm/Q2wq72Uu0kRcKeCDdlJVoAcGBSuBBAAK
|
6
|
+
oUQDQgAE4cdbt+NxMCBLg0cQYqo/UEwfzAONpz/n7ux+QrdKuH9NRulf9D4996x5
|
7
|
+
r7QBY+l5GJ+RgzLoXbFjPyPQtCV+/Q==
|
8
|
+
-----END EC PRIVATE KEY-----
|
9
|
+
fixed_key
|
10
|
+
|
11
|
+
FIXED_KEY2 = <<-fixed_key
|
12
|
+
-----BEGIN EC PRIVATE KEY-----
|
13
|
+
MHQCAQEEIP6nKLMEcH9R3hv695rCUl9OV+ueC9UX18F2PIH5wcFpoAcGBSuBBAAK
|
14
|
+
oUQDQgAErilvn3ms9cKHLNHHegiUU+NuW8c2f223vYInEV+s9ZNSGd28usAXZ6lN
|
15
|
+
O2zE534+k09fFe2skHtdoXbLJuZV8g==
|
16
|
+
-----END EC PRIVATE KEY-----
|
17
|
+
fixed_key
|
18
|
+
|
19
|
+
FIXED_SUM = "04F3C291542F410F61D61861D911F71ABD320A7B77ED571F92FEC533F61549BF218BAA47BD134847D89917F7483AFE20CCD9B1A4CBDFC443B389D1313B48E018F4"
|
20
|
+
|
21
|
+
describe MoneyTree::OpenSSLExtensions do
|
22
|
+
include MoneyTree::OpenSSLExtensions
|
23
|
+
|
24
|
+
context "with inputs" do
|
25
|
+
let(:key1) { OpenSSL::PKey::EC.new("secp256k1").generate_key }
|
26
|
+
let(:key2) { OpenSSL::PKey::EC.new("secp256k1").generate_key }
|
27
|
+
let(:point_1) { key1.public_key }
|
28
|
+
let(:point_2) { key2.public_key }
|
29
|
+
|
30
|
+
let(:point_infinity) { key1.public_key.set_to_infinity! }
|
31
|
+
|
32
|
+
let(:fixed_key1) { OpenSSL::PKey::EC.new(FIXED_KEY1) }
|
33
|
+
let(:fixed_key2) { OpenSSL::PKey::EC.new(FIXED_KEY2) }
|
34
|
+
let(:fixed_point1) { fixed_key1.public_key }
|
35
|
+
let(:fixed_point2) { fixed_key2.public_key }
|
36
|
+
let(:fixed_sum_point) { OpenSSL::PKey::EC::Point.new(OpenSSL::PKey::EC::Group.new("secp256k1"), OpenSSL::BN.new(FIXED_SUM, 16)) }
|
37
|
+
|
38
|
+
it "requires valid points" do
|
39
|
+
expect { MoneyTree::OpenSSLExtensions.add(0, 0) }.to raise_error(ArgumentError)
|
40
|
+
expect { MoneyTree::OpenSSLExtensions.add(nil, nil) }.to raise_error(ArgumentError)
|
41
|
+
expect { MoneyTree::OpenSSLExtensions.add(point_1, 0) }.to raise_error(ArgumentError)
|
42
|
+
expect { MoneyTree::OpenSSLExtensions.add(0, point_2) }.to raise_error(ArgumentError)
|
43
|
+
expect { MoneyTree::OpenSSLExtensions.add(point_infinity, point_2) }.to raise_error(ArgumentError)
|
44
|
+
expect { MoneyTree::OpenSSLExtensions.add(point_1, point_2) }.to_not raise_error
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should add points correctly" do
|
48
|
+
result = MoneyTree::OpenSSLExtensions.add(fixed_point1, fixed_point2)
|
49
|
+
|
50
|
+
expect(result).to eql(FIXED_SUM)
|
51
|
+
|
52
|
+
group = OpenSSL::PKey::EC::Group.new("secp256k1")
|
53
|
+
result_point = OpenSSL::PKey::EC::Point.new(group, OpenSSL::BN.new(result, 16))
|
54
|
+
|
55
|
+
expect(result_point).to eql(fixed_sum_point)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should be able to create the same hex output for the point' do
|
59
|
+
hex_output = fixed_sum_point.to_bn.to_s(16)
|
60
|
+
|
61
|
+
expect(hex_output).to eq(FIXED_SUM)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MoneyTree::PrivateKey do
|
4
|
+
before do
|
5
|
+
@key = MoneyTree::PrivateKey.new key: "5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b"
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "to_hex" do
|
9
|
+
it "has 64 characters" do
|
10
|
+
# must always be 64 characters - leading zeroes need to be preserved!
|
11
|
+
expect(@key.to_hex.length).to eql(64)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "preserves leading zeros" do
|
15
|
+
master = MoneyTree::Master.new seed_hex: "9cf6b6e8451c7d551cb402e2997566e5c7c258543eadb184f9f39322b2e6959b"
|
16
|
+
expect(master.node_for_path("m/427").private_key.to_hex.length).to eql(64)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "is a valid hex" do
|
20
|
+
expect(@key.to_hex).to eql('5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b' )
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "to_wif" do
|
25
|
+
it "is a 52 character base58 key" do
|
26
|
+
expect(@key.to_wif.length).to eql(52)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "starts with K or L" do
|
30
|
+
expect(%w(K L)).to include(@key.to_wif[0])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "is a valid compressed wif" do
|
34
|
+
expect(@key.to_wif).to eql('KzPkwAXJ4wtXHnbamTaJqoMrzwCUUJaqhUxnqYhnZvZH6KhgmDPK' )
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "to_wif(compressed: false)" do
|
39
|
+
it "is a 51 character base58 key" do
|
40
|
+
expect(@key.to_wif(compressed: false).length).to eql(51)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "starts with 5" do
|
44
|
+
expect(@key.to_wif(compressed: false)[0]).to eql('5')
|
45
|
+
end
|
46
|
+
|
47
|
+
it "is valid" do
|
48
|
+
expect(@key.to_wif(compressed: false)).to eql('5JXz5ZyFk31oHVTQxqce7yitCmTAPxBqeGQ4b7H3Aj3L45wUhoa')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "from_wif(wif)" do
|
53
|
+
it "returns the key from a wif" do
|
54
|
+
expect(@key.from_wif("5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ")).to eql('0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "raises an error on bad checksum" do
|
58
|
+
expect { @key.from_wif("5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTBADTJ") }.to raise_error(MoneyTree::Key::InvalidWIFFormat)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "to_base64" do
|
63
|
+
it "has 44 characters" do
|
64
|
+
expect(@key.to_base64.length).to eql(44)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "is a valid base64" do
|
68
|
+
expect(@key.to_base64).to eql('Xq5Tdftfeg6mUFZjY776KDDvRBvcsZGYrfMY+u6G1ks=' )
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "from_base64(base64_key)" do
|
73
|
+
it "parses base64 key" do
|
74
|
+
@key = MoneyTree::PrivateKey.new(key: "Xq5Tdftfeg6mUFZjY776KDDvRBvcsZGYrfMY+u6G1ks=")
|
75
|
+
expect(@key.to_hex).to eql("5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "returns the key from base64 encoding" do
|
79
|
+
expect(@key.from_base64("Xq5Tdftfeg6mUFZjY776KDDvRBvcsZGYrfMY+u6G1ks=")).to eql('5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b')
|
80
|
+
end
|
81
|
+
|
82
|
+
it "raises an error on bad encoding" do
|
83
|
+
expect { @key.from_base64("Xq5Tdftfeg6mUFZjY776KD&%#BbadBADrfMY+u6G1ks=") }.to raise_error(MoneyTree::Key::InvalidBase64Format)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "valid?(eckey)" do
|
88
|
+
it "checks for a valid key" do
|
89
|
+
expect(@key.valid?).to be_truthy
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "parse_raw_key" do
|
94
|
+
it "returns error if key is not Bignum, hex, base64, or wif formatted" do
|
95
|
+
expect { @key = MoneyTree::PrivateKey.new(key: "Thisisnotakey") }.to raise_error(MoneyTree::Key::KeyFormatNotFound)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "raises an error that can be caught using a standard exception block" do
|
99
|
+
exception_raised = false
|
100
|
+
|
101
|
+
begin
|
102
|
+
MoneyTree::PrivateKey.new(key: "Thisisnotakey")
|
103
|
+
rescue => ex
|
104
|
+
exception_raised = true
|
105
|
+
end
|
106
|
+
fail unless exception_raised
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context "testnet" do
|
111
|
+
before do
|
112
|
+
@key = MoneyTree::PrivateKey.new key: 'cRhes8SBnsF6WizphaRKQKZZfDniDa9Bxcw31yKeEC1KDExhxFgD'
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "to_wif" do
|
116
|
+
it "returns same wif" do
|
117
|
+
expect(@key.to_wif(network: :bitcoin_testnet)).to eql('cRhes8SBnsF6WizphaRKQKZZfDniDa9Bxcw31yKeEC1KDExhxFgD')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MoneyTree::PublicKey do
|
4
|
+
|
5
|
+
describe "with a private key" do
|
6
|
+
before do
|
7
|
+
@private_key = MoneyTree::PrivateKey.new key: "5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b"
|
8
|
+
@key = MoneyTree::PublicKey.new @private_key
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "to_hex(compressed: false)" do
|
12
|
+
it "has 65 bytes" do
|
13
|
+
expect(@key.uncompressed.to_hex.length).to eql(130)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "is a valid hex" do
|
17
|
+
expect(@key.uncompressed.to_hex).to eql('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4' )
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "to_hex" do
|
22
|
+
it "has 33 bytes" do
|
23
|
+
expect(@key.to_hex.length).to eql(66)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is a valid compressed hex" do
|
27
|
+
expect(@key.to_hex).to eql('022dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b' )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "to_fingerprint" do
|
32
|
+
it "returns a valid fingerprint" do
|
33
|
+
expect(@key.to_fingerprint).to eql("1fddf42e")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "to_address(compressed: false)" do
|
38
|
+
it "has 34 characters" do
|
39
|
+
expect(@key.uncompressed.to_address.length).to eql(34)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "is a valid bitcoin address" do
|
43
|
+
expect(@key.uncompressed.to_address).to eql('133bJA2xoVqBUsiR3uSkciMo5r15fLAaZg' )
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "to_compressed_address" do
|
48
|
+
it "has 34 characters" do
|
49
|
+
expect(@key.to_address.length).to eql(34)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "is a valid compressed bitcoin address" do
|
53
|
+
expect(@key.to_address).to eql('13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe' )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "without a private key" do
|
59
|
+
before do
|
60
|
+
@key = MoneyTree::PublicKey.new '042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4'
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "to_hex(compressed: false)" do
|
64
|
+
it "has 65 bytes" do
|
65
|
+
expect(@key.uncompressed.to_hex.length).to eql(130)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "is a valid hex" do
|
69
|
+
expect(@key.uncompressed.to_hex).to eql('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4' )
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "to_hex" do
|
74
|
+
it "has 33 bytes" do
|
75
|
+
expect(@key.compressed.to_hex.length).to eql(66)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "is a valid compressed hex" do
|
79
|
+
expect(@key.compressed.to_hex).to eql('022dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b' )
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "to_fingerprint" do
|
84
|
+
it "returns a valid fingerprint" do
|
85
|
+
expect(@key.compressed.to_fingerprint).to eql("1fddf42e")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "to_address(compressed: false)" do
|
90
|
+
it "has 34 characters" do
|
91
|
+
expect(@key.uncompressed.to_address.length).to eql(34)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "is a valid bitcoin address" do
|
95
|
+
expect(@key.uncompressed.to_address).to eql('133bJA2xoVqBUsiR3uSkciMo5r15fLAaZg' )
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "to_compressed_address" do
|
100
|
+
it "has 34 characters" do
|
101
|
+
expect(@key.compressed.to_address.length).to eql(34)
|
102
|
+
end
|
103
|
+
|
104
|
+
it "is a valid compressed bitcoin address" do
|
105
|
+
expect(@key.compressed.to_address).to eql('13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe' )
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "#compression" do
|
110
|
+
it "returns current compression setting" do
|
111
|
+
@key.compression = :uncompressed
|
112
|
+
expect(@key.compression).to eql(:uncompressed)
|
113
|
+
@key.compression = :compressed
|
114
|
+
expect(@key.compression).to eql(:compressed)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "with a bad key" do
|
120
|
+
it "raises KeyFormatNotFound" do
|
121
|
+
expect { @key = MoneyTree::PublicKey.new 'THISISNOTAVALIDKEY' }.to raise_error(MoneyTree::Key::KeyFormatNotFound)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "recalcuating public key" do
|
126
|
+
it "produces same results" do
|
127
|
+
results = []
|
128
|
+
100.times do
|
129
|
+
results << MoneyTree::PublicKey.new('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4').to_s
|
130
|
+
end
|
131
|
+
expect(results.uniq.length).to eql(1)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "#uncompressed" do
|
136
|
+
before do
|
137
|
+
@key = MoneyTree::PublicKey.new('022dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b')
|
138
|
+
end
|
139
|
+
|
140
|
+
it "does not mutate key" do
|
141
|
+
before_str = @key.to_s
|
142
|
+
@key.uncompressed
|
143
|
+
after_str = @key.to_s
|
144
|
+
expect(before_str).to eql(after_str)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "#compressed" do
|
149
|
+
before do
|
150
|
+
@key = MoneyTree::PublicKey.new('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4')
|
151
|
+
end
|
152
|
+
|
153
|
+
it "does not mutate key" do
|
154
|
+
before_str = @key.to_s
|
155
|
+
@key.compressed
|
156
|
+
after_str = @key.to_s
|
157
|
+
expect(before_str).to eql(after_str)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context "testnet" do
|
162
|
+
context 'with private key' do
|
163
|
+
before do
|
164
|
+
@private_key = MoneyTree::PrivateKey.new
|
165
|
+
@key = MoneyTree::PublicKey.new(@private_key)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should have an address starting with m or n" do
|
169
|
+
expect(%w(m n)).to include(@key.to_s(network: :bitcoin_testnet)[0])
|
170
|
+
end
|
171
|
+
|
172
|
+
it "should have an uncompressed address starting with m or n" do
|
173
|
+
expect(%w(m n)).to include(@key.uncompressed.to_s(network: :bitcoin_testnet)[0])
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'without private key' do
|
178
|
+
before do
|
179
|
+
@key = MoneyTree::PublicKey.new('0297b033ba894611345a0e777861237ef1632370fbd58ebe644eb9f3714e8fe2bc')
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should have an address starting with m or n" do
|
183
|
+
expect(%w(m n)).to include(@key.to_s(network: :bitcoin_testnet)[0])
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MoneyTree::Support do
|
4
|
+
include MoneyTree::Support
|
5
|
+
|
6
|
+
describe "sha256(str)" do
|
7
|
+
it "properly calculates sha256 hash" do
|
8
|
+
expect(sha256("abc", ascii: true)).to eql("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")
|
9
|
+
expect(sha256("800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d")).to eql("8147786c4d15106333bf278d71dadaf1079ef2d2440a4dde37d747ded5403592")
|
10
|
+
expect(sha256("8147786c4d15106333bf278d71dadaf1079ef2d2440a4dde37d747ded5403592")).to eql("507a5b8dfed0fc6fe8801743720cedec06aa5c6fca72b07c49964492fb98a714")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "ripemd160(str)" do
|
15
|
+
it "properly calculates ripemd160 hash" do
|
16
|
+
expect(ripemd160("abc", ascii: true)).to eql("8eb208f7e05d987a9b044a8e98c6b087f15a0bfc")
|
17
|
+
expect(ripemd160("e8026715af68676e0287ec9aa774f8103e4bddd5505b209263a8ff97c6ea29cc")).to eql("166db6510884918f31a9d246404760db8154bf84")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "hmac_sha512_hex(key, message)" do
|
22
|
+
it "properly calculates hmac sha512" do
|
23
|
+
expect(hmac_sha512_hex("Jefe", "what do ya want for nothing?")).to eql("164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "hex_to_int" do
|
28
|
+
it "converts hex to integer" do
|
29
|
+
expect(hex_to_int("abcdef0123456789")).to eql(12379813738877118345)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: money-tree-openssl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Micah Winkelspecht
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: openssl
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A Ruby Gem implementation of Bitcoin HD Wallets (forked to remove ffi)
|
112
|
+
email:
|
113
|
+
- winkelspecht@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".simplecov"
|
121
|
+
- ".travis.yml"
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- certs/mattatgemco.pem
|
127
|
+
- checksum/money-tree-0.9.0.gem.sha512
|
128
|
+
- donation_btc_qr_code.gif
|
129
|
+
- lib/money-tree.rb
|
130
|
+
- lib/money-tree/address.rb
|
131
|
+
- lib/money-tree/key.rb
|
132
|
+
- lib/money-tree/networks.rb
|
133
|
+
- lib/money-tree/node.rb
|
134
|
+
- lib/money-tree/support.rb
|
135
|
+
- lib/money-tree/version.rb
|
136
|
+
- lib/openssl_extensions.rb
|
137
|
+
- money-tree.gemspec
|
138
|
+
- spec/lib/money-tree/address_spec.rb
|
139
|
+
- spec/lib/money-tree/node_spec.rb
|
140
|
+
- spec/lib/money-tree/openssl_extensions_spec.rb
|
141
|
+
- spec/lib/money-tree/private_key_spec.rb
|
142
|
+
- spec/lib/money-tree/public_key_spec.rb
|
143
|
+
- spec/lib/money-tree/support_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
homepage: https://github.com/cte/money-tree
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata: {}
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
requirements: []
|
164
|
+
rubygems_version: 3.2.22
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: Bitcoin Hierarchical Deterministic Wallets in Ruby! (Bitcoin standard BIP0032)
|
168
|
+
test_files:
|
169
|
+
- spec/lib/money-tree/address_spec.rb
|
170
|
+
- spec/lib/money-tree/node_spec.rb
|
171
|
+
- spec/lib/money-tree/openssl_extensions_spec.rb
|
172
|
+
- spec/lib/money-tree/private_key_spec.rb
|
173
|
+
- spec/lib/money-tree/public_key_spec.rb
|
174
|
+
- spec/lib/money-tree/support_spec.rb
|
175
|
+
- spec/spec_helper.rb
|