Exemplo n.º 1
0
 /// <summary>
 /// Releases the unmanaged resources and optionally releases the managed resources.
 /// </summary>
 /// <param name="disposing">true to release both managed and unmanaged resources; 
 /// false to release only unmanaged resources.
 /// </param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_hash != null)
         {
             _hash.Dispose();
             _hash = null;
         }
     }
     base.Dispose(disposing);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Sha256Hmac"/> class.
        /// </summary>
        internal Sha256()
        {
            _hash = new CryptoServiceProviderHash(
                CryptoConfiguration.CryptoServiceProviderName,
                ProviderType.RsaAes,
                AlgorithmId.Sha256);

            try
            {
                _hash.Initialize();
            }
            catch
            {
                _hash.Dispose();
                throw;
            }
        }