code: function intarystrtohex(s) {
    s = s.replace(/^\s*\[\s*/, '');
    s = s.replace(/\s*\]\s*$/, '');
    s = s.replace(/\s*/g, '');
    try {
      var hex = s.split(/,/).map(function(element, index, array) {
        var i = parseInt(element);
        if (i < 0 || 255 < i) throw "integer not in range 0-255";
        var hI = ("00" + i.toString(16)).slice(-2);
        return hI;
      }).join('');
      return hex;
    } catch(ex) {
      throw "malformed integer array string: " + ex;
    }
  }
docs: convert string of integer array to hexadecimal string.<br/>
  @name intarystrtohex
  @function
  @param {String} s string of integer array
  @return {String} hexadecimal string
  @since base64x 1.1.6 jsrsasign 5.0.2
  @throws "malformed integer array string: *" for wrong input
  @description
  This function converts a string of JavaScript integer array to
  a hexadecimal string. Each integer value shall be in a range
  from 0 to 255 otherwise it raise exception. Input string can
  have extra space or newline string so that they will be ignored.
  
  @example
  intarystrtohex(" [123, 34, 101, 34, 58] ")
  &rarr; 7b2265223a (i.e. '{"e":' as string)