btcruby 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1937e58fcda56495863a298341de0e58def9807
4
- data.tar.gz: 4b1dab008f068d52b3bfd69dc7816c03c3fd05aa
3
+ metadata.gz: 6f08e8037db701b84d3bcaa4668d31ac412f1ffe
4
+ data.tar.gz: d79f69ebbb77f91742a118418b242a73503392dc
5
5
  SHA512:
6
- metadata.gz: 1f73e371b4252cd9b0a16db3fc68dbcba11122dd4dd4e9fa7dc95468d3c438c82ac8463d5b63632d58ad037a3fc81f55640111eda88792f80cb28a8961c11eba
7
- data.tar.gz: 09f11c01667ca03872e1de72a676d454803742538f02822b8a599985768c68287a40e5fe8087083186cb3613f76039c4aef41a759b5aff3fcb1cbfe0470e7eb5
6
+ metadata.gz: 5a741067c8ee868612b0efc58c293c9da7e530629eb8f9f8e5204167132162fe31a8766f2a8d35a26b7c19bf4745d24d17a8eda7350866eaafc81f726a5e3a42
7
+ data.tar.gz: fdeec25673942c8ded43a90fe9967c0ac6dc52e2b7d69e1943a6eb2c72a7daf1ac9f15bb99b68d1c95d6cb3a5fb085195762cfa0c65c5f67732c59dcc518cdf6
data/RELEASE_NOTES.md CHANGED
@@ -2,6 +2,11 @@
2
2
  BTCRuby Release Notes
3
3
  =====================
4
4
 
5
+ 1.0.8 (July 19, 2015)
6
+ --------------------
7
+
8
+ * Added `verify_hashtype` flag to optionally check hashtype byte.
9
+
5
10
  1.0.7 (July 19, 2015)
6
11
  --------------------
7
12
 
data/lib/btcruby/key.rb CHANGED
@@ -248,7 +248,7 @@ module BTC
248
248
  # Checks if this signature with appended script hash type is well-formed.
249
249
  # Logs detailed info using Diagnostics and returns true or false.
250
250
  # Set verify_lower_s:false when processing incoming blocks.
251
- def self.validate_script_signature(data, verify_lower_s: true)
251
+ def self.validate_script_signature(data, verify_lower_s: true, verify_hashtype: true)
252
252
  # See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
253
253
  # A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
254
254
  # Where R and S are not negative (their first byte has its highest bit not set), and not
@@ -275,11 +275,13 @@ module BTC
275
275
 
276
276
  bytes = data.bytes
277
277
 
278
- hashtype = bytes[length - 1] & (~(SIGHASH_ANYONECANPAY))
278
+ if verify_hashtype
279
+ hashtype = bytes[length - 1] & (~(SIGHASH_ANYONECANPAY))
279
280
 
280
- if hashtype < SIGHASH_ALL || hashtype > SIGHASH_SINGLE
281
- Diagnostics.current.add_message("Non-canonical signature: unknown hashtype byte.")
282
- return false
281
+ if hashtype < SIGHASH_ALL || hashtype > SIGHASH_SINGLE
282
+ Diagnostics.current.add_message("Non-canonical signature: unknown hashtype byte.")
283
+ return false
284
+ end
283
285
  end
284
286
 
285
287
  if bytes[0] != 0x30
@@ -1,3 +1,3 @@
1
1
  module BTC
2
- VERSION = "1.0.7".freeze
2
+ VERSION = "1.0.8".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btcruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Andreev