var hex = " ";
var buffer = new ArrayBuffer((hex.length) / 2);
var byteStream = new Uint8Array(buffer);
var i = 0;
while (hex.length >= 2) {
var x = parseInt(hex.substring(0, 2), 16);
hex = hex.substring(2, hex.length);
byteStream[i++] = x;
}
var hex = " ";
var buffer = new ArrayBuffer((hex.length) / 2);
var byteStream = new Uint8Array(buffer);
var i = 0;
while (hex.length >= 2) {
var x = parseInt(hex.substring(0, 2), 16);
hex = hex.substring(2, hex.length);
byteStream[i++] = x;
}