Module: CoinOp::Encodings
- Extended by:
- Encodings
- Included in:
- Bit::Input, Bit::MultiNode, Bit::MultiWallet, Bit::Output, Bit::Script, Bit::SparseInput, Bit::Transaction, Blockchain::Blockr, Crypto::PassphraseBox, Crypto::PassphraseBox, Encodings
- Defined in:
- lib/coin-op/encodings.rb
Instance Method Summary collapse
- #base58(blob) ⇒ Object
- #decode_base58(string) ⇒ Object
- #decode_hex(string) ⇒ Object
- #hex(blob) ⇒ Object
Instance Method Details
#base58(blob) ⇒ Object
17 18 19 |
# File 'lib/coin-op/encodings.rb', line 17 def base58(blob) ::Bitcoin.encode_base58(self.hex(blob)) end |
#decode_base58(string) ⇒ Object
21 22 23 |
# File 'lib/coin-op/encodings.rb', line 21 def decode_base58(string) self.decode_hex(::Bitcoin.decode_base58(string)) end |
#decode_hex(string) ⇒ Object
13 14 15 |
# File 'lib/coin-op/encodings.rb', line 13 def decode_hex(string) [string].pack("H*") end |
#hex(blob) ⇒ Object
9 10 11 |
# File 'lib/coin-op/encodings.rb', line 9 def hex(blob) blob.unpack("H*")[0] end |