1
2
3
def string_to_hex(string)
   string.unpack('U'*string.length).collect {|x| x.to_s 16}.join
end