code: func (m *Memberlist) encryptLocalState(sendBuf []byte) ([]byte, error) {
  	var buf bytes.Buffer
  
  	// Write the encryptMsg byte
  	buf.WriteByte(byte(encryptMsg))
  
  	// Write the size of the message
  	sizeBuf := make([]byte, 4)
  	encVsn := m.encryptionVersion()
  	encLen := encryptedLength(encVsn, len(sendBuf))
  	binary.BigEndian.PutUint32(sizeBuf, uint32(encLen))
  	buf.Write(sizeBuf)
  
  	// Write the encrypted cipher text to the buffer
  	key := m.config.Keyring.GetPrimaryKey()
  	err := encryptPayload(encVsn, key, sendBuf, buf.Bytes()[:5], &buf)
  	if err != nil {
  		return nil, err
  	}
  	return buf.Bytes(), nil
  }
docs: // encryptLocalState is used to help encrypt local state before sending