Module: Hive::Utils

Included in:
Broadcast, Marshal, Operation, Transaction, TransactionBuilder
Defined in:
lib/hive/utils.rb

Instance Method Summary collapse

Instance Method Details

#hexlify(s) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/hive/utils.rb', line 3

def hexlify(s)
  a = []
  if s.respond_to? :each_byte
    s.each_byte { |b| a << sprintf('%02X', b) }
  else
    s.each { |b| a << sprintf('%02X', b) }
  end
  a.join.downcase
end

#unhexlify(s) ⇒ Object



13
14
15
# File 'lib/hive/utils.rb', line 13

def unhexlify(s)
  s.split.pack('H*')
end