public static unsafe void HashData(SafeHashHandleImpl hashHandle, byte[] data, int dataOffset, int dataLength) { if (data == null) { throw ExceptionUtility.ArgumentNull("data"); } if (dataOffset < 0) { throw ExceptionUtility.ArgumentOutOfRange("dataOffset"); } if (dataLength < 0) { throw ExceptionUtility.ArgumentOutOfRange("dataLength"); } if (data.Length < dataOffset + dataLength) { throw ExceptionUtility.ArgumentOutOfRange("dataLength"); } if (dataLength > 0) { fixed(byte *dataRef = data) { var dataOffsetRef = dataRef + dataOffset; if (!CryptoApi.CryptHashData(hashHandle, dataOffsetRef, (uint)dataLength, 0)) { throw CreateWin32Error(); } } } }