code: func (w *etmWriter) WriteMsg(b []byte) error {
  	w.Lock()
  	defer w.Unlock()
  
  	// encrypt.
  	buf := pool.Get(4 + len(b) + w.mac.Size())
  	defer pool.Put(buf)
  	data := buf[4 : 4+len(b)]
  	w.str.XORKeyStream(data, b)
  
  	// log.Debugf("ENC plaintext (%d): %s %v", len(b), b, b)
  	// log.Debugf("ENC ciphertext (%d): %s %v", len(data), data, data)
  
  	// then, mac.
  	if _, err := w.mac.Write(data); err != nil {
  		return err
  	}
  
  	// Sum appends.
  	data = w.mac.Sum(data)
  	w.mac.Reset()
  	binary.BigEndian.PutUint32(buf[:4], uint32(len(data)))
  
  	_, err := w.w.Write(buf)
  	return err
  }
docs: // WriteMsg writes the msg in the passed in buffer.