Exemple #1
0
 public byte[] HashFinal()
 {
     byte[] hash = new byte [hashSize];
     context.InternalResult = CryptoAPI.CryptGetHashParam(handle, CryptoAPI.HP_HASHVAL, hash, ref hashSize, 0);
     GC.KeepAlive(this);
     return(hash);
 }
Exemple #2
0
 public void Initialize(int algo)
 {
     if (context != null)
     {
         context.InternalResult = CryptoAPI.CryptCreateHash(context.Handle, (uint)algo, IntPtr.Zero, 0, ref handle);
         hashSize = 0;
         if (context.Result)
         {
             context.InternalResult = CryptoAPI.CryptGetHashParam(handle, CryptoAPI.HP_HASHVAL, null, ref hashSize, 0);
         }
         GC.KeepAlive(this);
     }
 }