From: "Peña, Botp" Date: 2008-06-10T18:43:32+09:00 Subject: Re: To and from hex nibbles From: daniel åkerud [mailto:daniel.akerud@gmail.com] # 'testing 123'.scan(/./).collect { |i| i.unpack('C')[0].to_s(16) }.join # => "74657374696e6720313233" # and back to binary: # "74657374696e6720313233".scan(/../).collect { |i| i.to_i(16) # }.pack('C*') # => "testing 123" s='testing 123'.unpack("H*")[0] #=> "74657374696e6720313233" s.scan(/../).map{|i| i.to_i(16)}.pack("C*") #=> "testing 123" kind regards -botp