function TaggedHash(tag, message, messageEncoding = 'hex') {
  if (!(this instanceof TaggedHash)) {
    return new TaggedHash(tag, message, messageEncoding);
  }
  BufferWriter.apply(this);
  tag = Buffer.from(tag);

  const taghash = Hash.sha256(tag);
  this.write(taghash);
  this.write(taghash);
  if (message) {
    message = Buffer.isBuffer(message) ? message : Buffer.from(message, messageEncoding);
    this.write(message);
  }
  return this;
}
Creates a tag hash to ensure uniqueness of a message between purposes.
For example, if there's a potential for a collision of messages between
  multiple purposes, a tag can be added to guard against such collisions.
@link https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki#Design (see 'Tagged Hashes')
@param {String} tag The tag to prevent message collisions. Should uniquely reflect the purpose of the message.
@param {Buffer|String} message (optional)
@param {String} messageEncoding (default: 'hex') If `message` is a string, provide the encoding
@returns {TaggedHash} Instance of a BufferWriter with the written tag and `finalize` method