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.
Inheritance: System.Security.Cryptography.HashAlgorithm
Exemplo n.º 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);
        }
Exemplo n.º 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;
    }