Provides a Null HashAlgorithm, its blazing fast! Typically, these classes are not thread-safe, but the block-size is 1, there is no history, and the result is always an empty byte array.
상속: System.Security.Cryptography.HashAlgorithm
예제 #1
0
        /// <summary>Creates a HashAlgorithm used by this SPI.</summary>
        public HashAlgorithm CreateHashAlgorithm()
        {
            HashAlgorithm ha = null;

            if (Authenticator.Equals("NullHash"))
            {
                ha = new NullHash();
            }
            else
            {
                ha = HashAlgorithm.Create(Authenticator);
                if (ha == null)
                {
                    ha = KeyedHashAlgorithm.Create(Authenticator);
                }
            }

            if (ha == null)
            {
                throw new Exception("Unsupported authentication method: " + Authenticator);
            }

            return(ha);
        }
예제 #2
0
    /// <summary>Creates a HashAlgorithm used by this SPI.</summary>
    public HashAlgorithm CreateHashAlgorithm() {
      HashAlgorithm ha = null;

      if(Authenticator.Equals("NullHash")) {
        ha = new NullHash();
      } else {
        ha = HashAlgorithm.Create(Authenticator);
        if(ha == null) {
          ha = KeyedHashAlgorithm.Create(Authenticator);
        }
      }
      
      if(ha == null) {
        throw new Exception("Unsupported authentication method: " + Authenticator);
      }

      return ha;
    }