Core Extensions are convenience methods available on standard classes like String
.
We do not extend core classes by default to avoid conflicts with other libraries and your own extensions.
To enable convenience methods, include btcruby/extensions.rb
in your application.
Extensions are automatically available in BTCRuby interactive console bin/console
and in unit tests.
Converts a binary string representing a 32-byte private key to WIF format.
If network
is not specified, BTC::Network.default is used.
If public_key_compressed
is not specified, false
is used.
Converts WIF-encoded string to a raw 32-byte private key.
Raises FormatError
if the receiver is not a valid WIF-encoded string.
Converts a binary string to a hex-encoded string.
Converts a hex-encoded string to a binary string.
Raises FormatError
if the receiver is not a valid hex-encoded string.
Returns a binary string compressed using SHA-1 algorithm.
Returns a binary string compressed using SHA-256 algorithm.
Returns a binary string compressed using SHA-512 algorithm.
Returns a binary string compressed using RIPEMD-160 algorithm.
Returns a binary string compressed using two passes of SHA-256 algorithm. Known in Bitcoin as Hash256.
Returns a binary string compressed using composition ripemd160(sha256(string))
. Known in Bitcoin as Hash160.