Пример #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());
     }
 }
Пример #2
0
 public IHashAlgorithm CreateAlgorithm(HashAlgorithmType algorithm)
 {
     return(HashAlgorithmProvider.CreateAlgorithm(algorithm));
 }