function fromHex (hex) {
  const byteArray = new Uint8Array(hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16)))
  return byteArray.buffer
}
Convert a hex string to a buffer
@param {string} hex - the hex string to convert
@returns {ArrayBuffer} - the buffer