def to_byte_string
      ret = self.gsub(/\s+/,'')
      raise 'Hex string must have even number of characters.' unless ret.size % 2 == 0
      raise 'Hex string must only contain 0-9 and A-F characters.' if ret =~ /[^0-9a-fA-F]/
      [ret].pack('H*').force_encoding('ascii-8bit')
    end
def to_byte_string
      ret = self.gsub(/\s+/,'')
      raise 'Hex string must have even number of characters.' unless ret.size % 2 == 0
      raise 'Hex string must only contain 0-9 and A-F characters.' if ret =~ /[^0-9a-fA-F]/
      [ret].pack('H*').force_encoding('ascii-8bit')
    end
Converts a hex string into a byte string.

 Whitespace in the string is ignored.
 The string must only contain characters valid for hex (ie - 0-9, A-F, a-f).
 The string must contain an even number of characters since each character only represents half a byte.