static byte[] CreateHash(HashAlgorithmType type, SecureBuffer data) { if (!HashAlgorithmProvider.IsAlgorithmSupported(type)) { throw new TlsException(AlertDescription.IlegalParameter); } using (var d = new DisposeContext()) { var algorithm = d.Add(HashAlgorithmProvider.CreateAlgorithm(type)); algorithm.TransformBlock(data.Buffer, 0, data.Size); return(algorithm.GetRunningHash()); } }
public IHashAlgorithm CreateAlgorithm(HashAlgorithmType algorithm) { return(HashAlgorithmProvider.CreateAlgorithm(algorithm)); }