function writeHexString(hexString, out) {
  var asciiCharsPerLine = 16;
  // Number of transferred bytes in a line of output.  Length of a
  // line is roughly 4 times larger.
  var hexCharsPerLine = 2 * asciiCharsPerLine;
  for (var i = 0; i < hexString.length; i += hexCharsPerLine) {
    var hexLine = '';
    var asciiLine = '';
    for (var j = i; j < i + hexCharsPerLine && j < hexString.length; j += 2) {
      // Split into two columns of 8 bytes each.
      if (j == i + hexCharsPerLine / 2)
        hexLine += ' ';
      var hex = hexString.substr(j, 2);
      hexLine += hex + ' ';
      var charCode = parseInt(hex, 16);
      // For ASCII codes 32 though 126, display the corresponding
      // characters.  Use a space for nulls, and a period for
      // everything else.
      if (charCode >= 0x20 && charCode <= 0x7E) {
        asciiLine += String.fromCharCode(charCode);
      } else if (charCode == 0x00) {
        asciiLine += ' ';
      } else {
        asciiLine += '.';
      }
    }

    // Make the ASCII text for the last line of output align with the previous
    // lines.
    hexLine +=
        makeRepeatedString(' ', 3 * asciiCharsPerLine + 1 - hexLine.length);
    out.writeLine('   ' + hexLine + '  ' + asciiLine);
  }
}
/**
 * |hexString| must be a string of hexadecimal characters with no whitespace,
 * whose length is a multiple of two.  Writes multiple lines to |out| with
 * the hexadecimal characters from |hexString| on the left, in groups of
 * two, and their corresponding ASCII characters on the right.
 *
 * 16 bytes will be placed on each line of the output string, split into two
 * columns of 8.
 */
|hexString| must be a string of hexadecimal characters with no whitespace,
whose length is a multiple of two.  Writes multiple lines to |out| with
the hexadecimal characters from |hexString| on the left, in groups of
two, and their corresponding ASCII characters on the right.

16 bytes will be placed on each line of the output string, split into two
columns of 8.
|hexString| must be a string of hexadecimal characters with no whitespace whose length is a multiple of two . Writes multiple lines to |out| with the hexadecimal characters from |hexString| on the left in groups of two and their corresponding ASCII characters on the right . 16 bytes will be placed on each line of the output string split into two columns of 8 .
function writeHexString(hexString, out) {
  var asciiCharsPerLine = 16;
  var hexCharsPerLine = 2 * asciiCharsPerLine;
  for (var i = 0; i < hexString.length; i += hexCharsPerLine) {
    var hexLine = '';
    var asciiLine = '';
    for (var j = i; j < i + hexCharsPerLine && j < hexString.length; j += 2) {
      if (j == i + hexCharsPerLine / 2)
        hexLine += ' ';
      var hex = hexString.substr(j, 2);
      hexLine += hex + ' ';
      var charCode = parseInt(hex, 16);
      if (charCode >= 0x20 && charCode <= 0x7E) {
        asciiLine += String.fromCharCode(charCode);
      } else if (charCode == 0x00) {
        asciiLine += ' ';
      } else {
        asciiLine += '.';
      }
    }
    hexLine +=
        makeRepeatedString(' ', 3 * asciiCharsPerLine + 1 - hexLine.length);
    out.writeLine('   ' + hexLine + '  ' + asciiLine);
  }
}
function writeHexString ( hexString , out ) { var asciiCharsPerLine = 16 ; var hexCharsPerLine = 2 * asciiCharsPerLine ; for ( var i = 0 ; i < hexString . length ; i += hexCharsPerLine ) { var hexLine = '' ; var asciiLine = '' ; for ( var j = i ; j < i + hexCharsPerLine && j < hexString . length ; j += 2 ) { if ( j == i + hexCharsPerLine / 2 ) hexLine += ' ' ; var hex = hexString . substr ( j , 2 ) ; hexLine += hex + ' ' ; var charCode = parseInt ( hex , 16 ) ; if ( charCode >= 0x20 && charCode <= 0x7E ) { asciiLine += String . fromCharCode ( charCode ) ; } else if ( charCode == 0x00 ) { asciiLine += ' ' ; } else { asciiLine += '.' ; } } hexLine += makeRepeatedString ( ' ' , 3 * asciiCharsPerLine + 1 - hexLine . length ) ; out . writeLine ( '   ' + hexLine + '  ' + asciiLine ) ; } }
|hexString| must be a string of hexadecimal characters with no whitespace,
 whose length is a multiple of two.
|hexString| must be a string of hexadecimal characters with no whitespace whose length is a multiple of two .
// Number of transferred bytes in a line of output.  Length of a // line is roughly 4 times larger. // Split into two columns of 8 bytes each. // For ASCII codes 32 though 126, display the corresponding // characters.  Use a space for nulls, and a period for // everything else. // Make the ASCII text for the last line of output align with the previous // lines.