lib/bitcoin/ext_key.rb in bitcoin-ruby-0.0.18 vs lib/bitcoin/ext_key.rb in bitcoin-ruby-0.0.19

- old
+ new

@@ -84,11 +84,11 @@ def derive(number) new_key = ExtKey.new new_key.depth = depth + 1 new_key.number = number new_key.parent_fingerprint = fingerprint - if number > (2**31 -1) + if number > (2**31 - 1) data = [0x00].pack('C') << priv_key.priv.htb << [number].pack('N') else data = priv_key.pub.htb << [number].pack('N') end l = Bitcoin.hmac_sha512(chain_code, data) @@ -162,11 +162,11 @@ def derive(number) new_key = ExtPubkey.new new_key.depth = depth + 1 new_key.number = number new_key.parent_fingerprint = fingerprint - raise 'hardened key is not support' if number > (2**31 -1) + raise 'hardened key is not support' if number > (2**31 - 1) data = pub.htb << [number].pack('N') l = Bitcoin.hmac_sha512(chain_code, data) left = OpenSSL::BN.from_hex(l[0..31].bth) raise 'invalid key' if left.to_i >= CURVE_ORDER new_key.pub_key = Bitcoin.bitcoin_elliptic_curve.group.generator.mul(left).ec_add(pub_key) @@ -186,6 +186,6 @@ key.pub_key = OpenSSL::PKey::EC::Point.from_hex(Bitcoin.bitcoin_elliptic_curve.group, data.read(33).bth) key end end -end \ No newline at end of file +end