def to_hex_string(grouping = false)
      ret = self.unpack('H*').first
      if grouping
        if grouping.is_a?(::Integer) && grouping > 0
          ret.gsub(/(#{'.' * grouping})/,'\1 ').rstrip
        else
          ret.gsub(/(..)/,'\1 ').rstrip
        end
      else
        ret
      end
    end
def to_hex_string(grouping = false)
      ret = self.unpack('H*').first
      if grouping
        if grouping.is_a?(::Integer) && grouping > 0
          ret.gsub(/(#{'.' * grouping})/,'\1 ').rstrip
        else
          ret.gsub(/(..)/,'\1 ').rstrip
        end
      else
        ret
      end
    end
Converts a binary string into a hex string.

 The +grouping+ parameter can be set to true or an integer value specifying how many chars you want in
 each group.  If true or less than 1, then characters are put into groups of 2.