public override bool Encrypt(NetOutgoingMessage msg)
        {
            int unEncLenBits = msg.LengthBits;

            var ms = new MemoryStream();
            var cs = GetEncryptStream(ms);
            cs.Write(msg.m_data, 0, msg.LengthBytes);
            cs.Close();

            // get results
            var arr = ms.ToArray();
            ms.Close();

            msg.EnsureBufferSize((arr.Length + 4) * 8);
            msg.LengthBits = 0; // reset write pointer
            msg.Write((uint)unEncLenBits);
            msg.Write(arr);
            msg.LengthBits = (arr.Length + 4) * 8;

            return true;
        }
        /// <summary>
        /// Encrypt am outgoing message with this algorithm; no writing can be done to the message after encryption, or message will be corrupted
        /// </summary>
        public override bool Encrypt(NetOutgoingMessage msg)
        {
            int payloadBitLength = msg.LengthBits;
            int numBytes = msg.LengthBytes;
            int blockSize = BlockSize;
            int numBlocks = (int)Math.Ceiling((double)numBytes / (double)blockSize);
            int dstSize = numBlocks * blockSize;

            msg.EnsureBufferSize(dstSize * 8 + (4 * 8)); // add 4 bytes for payload length at end
            msg.LengthBits = dstSize * 8; // length will automatically adjust +4 bytes when payload length is written

            for(int i=0;i<numBlocks;i++)
            {
                EncryptBlock(msg.m_data, (i * blockSize), m_tmp);
                Buffer.BlockCopy(m_tmp, 0, msg.m_data, (i * blockSize), m_tmp.Length);
            }

            // add true payload length last
            msg.Write((UInt32)payloadBitLength);

            return true;
        }