Beispiel #1
0
 public HMACSHA384(byte[] key)
 {
     this.HashName = HashAlgorithmNames.SHA384;
     _hMacCommon = new HMACCommon(HashAlgorithmNames.SHA384, key, BlockSize);
     base.Key = _hMacCommon.ActualKey;
     // change the default value of BlockSizeValue to 128 instead of 64
     BlockSizeValue = BlockSize;
 }
Beispiel #2
0
        private IncrementalHash(HashAlgorithmName name, HMACCommon hmac)
        {
            Debug.Assert(name != null);
            Debug.Assert(!string.IsNullOrEmpty(name.Name));
            Debug.Assert(hmac != null);

            _algorithmName = new HashAlgorithmName("HMAC" + name.Name);
            _hmac = hmac;
        }
Beispiel #3
0
 public HMACSHA256(byte[] key)
 {
     this.HashName = HashAlgorithmNames.SHA256;
     _hMacCommon = new HMACCommon(HashAlgorithmNames.SHA256, key, BlockSize);
     base.Key = _hMacCommon.ActualKey;
     // this not really needed as it'll initialize BlockSizeValue with same value it has which is 64.
     // we just want to be explicit in all HMAC extended classes
     BlockSizeValue = BlockSize;
 }
Beispiel #4
0
        /// <summary>
        /// Release all resources used by the current instance of the
        /// <see cref="IncrementalHash"/> class.
        /// </summary>
        public void Dispose()
        {
            _disposed = true;

            if (_hash != null)
            {
                _hash.Dispose();
                _hash = null;
            }

            if (_hmac != null)
            {
                _hmac.Dispose(true);
                _hmac = null;
            }
        }
Beispiel #5
0
 public HMACSHA256(byte[] key)
 {
     this.HashName = HashAlgorithmNames.SHA256;
     _hMacCommon = new HMACCommon(HashAlgorithmNames.SHA256, key, BlockSize);
     base.Key = _hMacCommon.ActualKey;
 }
Beispiel #6
0
 public HMACSHA256(byte[] key)
 {
     this.HashName = HashAlgorithmNames.SHA256;
     _hMacCommon = new HMACCommon(HashAlgorithmNames.SHA256, key);
     base.Key = key;
 }
Beispiel #7
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         HMACCommon hMacCommon = _hMacCommon;
         _hMacCommon = null;
         if (hMacCommon != null)
             hMacCommon.Dispose(disposing);
     }
     base.Dispose(disposing);
 }
Beispiel #8
0
 public HMACMD5(byte[] key)
 {
     this.HashName = HashAlgorithmNames.MD5;
     _hMacCommon = new HMACCommon(HashAlgorithmNames.MD5, key);
     base.Key = key;
 }