BinaryXor

Performs a bitwise XOR (exclusive OR) on portions of two binary buffers.

Syntax:

BinaryXor( target-handle, target-offset, source-handle, source-offset, count )

Parameters:

(i) target-handle: handle of target buffer.

(i) target-offset: zero-based offset into the target buffer specifying where the data to be processed starts, and where the result of the operation should be placed.

(i) source-handle: handle of source buffer.

(i) source-offset: zero-based offset into the source buffer specifying where the data to be processed starts.

(i) count: the number of bytes to process.

Returns:

(i) returns 1.

 

The specified sections of the buffers are processed on a byte-by-byte basis, and the results are written to the buffer specified by "target-handle". i.e., the byte at "source-offset" is XOR'ed with the byte at "target-offset", and the result of the XOR operation is stored in the byte at "target-offset", then the bytes at "source-offset + 1" and "target-offset + 1" are XOR'ed, and so on.

"target-handle" and "source-handle" may both reference the same buffer, in which case two sections of the buffer can be processed.

 

Example:


buf1 = BinaryAlloc(10)
buf2 = BinaryAlloc(10)
For i = 0 To 9
   BinaryPoke(buf1, i, 0)
   BinaryPoke(buf2, i, 1)
Next
BinaryPoke(buf1, 0, 1)
rc = BinaryXor(buf1, 0, buf2, 0, 3)
BinaryWrite(buf1, "zzbin1")
BinaryWrite(buf2, "zzbin2")
Message("BinaryXor returned", rc)
See Also:

Binary Operations, BinaryAlloc, BinaryOr, BinaryCopy, BinaryFree, BinaryRead, DllCall, BinaryCompare, BinaryAnd