private static bool GCryptEncrypt(IntPtr h, IntPtr pbZero, IntPtr pbBuf, ulong uRounds, byte[] pbOut16) { ulong r = 0; while (uRounds != 0) { r = Math.Min(uRounds, (ulong)GCryptBufBlocks); IntPtr cb = new IntPtr((int)r << 4); if (NativeMethods.gcry_cipher_encrypt(h, pbBuf, cb, pbZero, cb) != 0) { Debug.Assert(false); return(false); } uRounds -= r; } if ((pbOut16 != null) && (r != 0)) { Marshal.Copy(MemUtil.AddPtr(pbBuf, ((long)r - 1) << 4), pbOut16, 0, 16); } return(true); }