public static byte[] CalculateDigest(string algorithm, byte[] input)
        {
            IDigest digest = new Org.BouncyCastle.Crypto.Digests.MD5Digest();

            digest.BlockUpdate(input, 0, input.Length);
            return(DoFinal(digest));
        }
 public void UpdateHandshakeHash(byte[] data)
 {
     if (_VerifyHandshake == null)
     {
         if (_VerifyHandshakeSHA1 != null)
         {
             _VerifyHandshakeSHA1.BlockUpdate(data, 0, data.Length);
             _VerifyHandshakeMD5.BlockUpdate(data, 0, data.Length);
         }
     }
     else
     {
         _VerifyHandshake.BlockUpdate(data, 0, data.Length);
     }
 }