示例#1
0
        //// NOTE: Leave out the finalizer altogether if this class doesn't
        //// own unmanaged resources itself, but leave the other methods
        //// exactly as they are.
        //~Encryption()
        //{
        //    // Finalizer calls Dispose(false)
        //    Dispose(false);
        //}

        // The bulk of the clean-up code is implemented in Dispose(bool)
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Free managed resources.
                lock (MacProviderLock)
                {
                    if (_MacProvider != null)
                    {
                        _MacProvider.Dispose();
                        _MacProvider = null;
                    }
                }
                lock (RsaProviderLock)
                {
                    if (_RsaProvider != null)
                    {
                        _RsaProvider.Dispose();
                        _RsaProvider = null;
                    }
                }
                if (_RsaSignatureHashAlgorithm != null)
                {
                    _RsaSignatureHashAlgorithm.Dispose();
                    _RsaSignatureHashAlgorithm = null;
                }
            }
        }
示例#2
0
        public static Guid GetGuid(byte[] key, byte[] value)
        {
            var algorithm = new System.Security.Cryptography.HMACMD5();
            var guid      = HashHelper.GetGuid(algorithm, key, value);

            algorithm.Dispose();
            return(guid);
        }
示例#3
0
        public static Guid GetGuid(string key, long value)
        {
            var algorithm = new System.Security.Cryptography.HMACMD5();
            var guid      = HashHelper.GetGuid(algorithm, key, BitConverter.GetBytes(value));

            algorithm.Dispose();
            return(guid);
        }