System.Security.Cryptography.IncrementalHash.CreateHash C# (CSharp) Method

CreateHash() public static method

Create an IncrementalHash for the algorithm specified by hashAlgorithm.
/// . is null, or /// the empty string. /// is not a known hash algorithm.
public static CreateHash ( HashAlgorithmName hashAlgorithm ) : IncrementalHash
hashAlgorithm HashAlgorithmName The name of the hash algorithm to perform.
return IncrementalHash
        public static IncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
        {
            if (string.IsNullOrEmpty(hashAlgorithm.Name))
                throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm));

            return new IncrementalHash(hashAlgorithm, GetHashAlgorithm(hashAlgorithm));
        }

Usage Example

 public SHA256CryptoServiceProvider()
 {
     _incrementalHash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
     HashSizeValue    = HashSizeBits;
 }
All Usage Examples Of System.Security.Cryptography.IncrementalHash::CreateHash