class Integer

Public Instance Methods

itb() click to toggle source
# File lib/bitcoin.rb, line 229
def itb
  to_even_length_hex.htb
end
to_bits(length = nil ) click to toggle source

convert bit string

# File lib/bitcoin.rb, line 234
def to_bits(length = nil )
  if length
    to_s(2).rjust(length, '0')
  else
    to_s(2)
  end
end
to_even_length_hex() click to toggle source
# File lib/bitcoin.rb, line 224
def to_even_length_hex
  hex = to_s(16)
  hex.rjust((hex.length / 2.0).ceil * 2, '0')
end