Ejemplo n.º 1
0
        /// <summary>
        /// Creates new connection.
        /// </summary>
        public Connection()
        {
            _buffer     = new byte[1024 * 500];
            _backBuffer = new byte[ushort.MaxValue];
            _crypto     = new TOSCrypto();

            this.State   = ConnectionState.Open;
            this.Address = "?:?";
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates new connection.
        /// </summary>
        public Connection()
        {
            _buffer = new byte[1024 * 500];
            _crypto = new TOSCrypto();

            this.State         = ConnectionState.Open;
            this.Address       = "?:?";
            this.IntegritySeed = RandomProvider.Get().Next();

            // Generates a session key based on a GUID.
            using (var sha = new SHA1Managed())
            {
                var hash = sha.ComputeHash(Guid.NewGuid().ToByteArray());
                this.SessionKey = "*" + BitConverter.ToString(hash).Replace("-", "");
            }
        }