Module: ECDSA::Format::PointOctetString
- Defined in:
- lib/bitcoin/ext/ecdsa.rb
Class Method Summary collapse
Class Method Details
.base_decode ⇒ Object
22 |
# File 'lib/bitcoin/ext/ecdsa.rb', line 22 alias_method :base_decode, :decode |
.decode(string, group, allow_hybrid: false) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bitcoin/ext/ecdsa.rb', line 25 def self.decode(string, group, allow_hybrid: false) string = string.dup.force_encoding('BINARY') raise ECDSA::Format::DecodeError, 'Point octet string is empty.' if string.empty? if [6, 7].include?(string[0].ord) raise ECDSA::Format::DecodeError, 'Unrecognized start byte for point octet string: 0x%x' % string[0].ord unless allow_hybrid decode_uncompressed string, group if allow_hybrid else base_decode(string, group) end end |