Esempio n. 1
0
 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());
     }
 }
Esempio n. 2
0
 public IHashAlgorithm CreateAlgorithm(HashAlgorithmType algorithm)
 {
     return(HashAlgorithmProvider.CreateAlgorithm(algorithm));
 }