$StrXor: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Bit-wise exclusive OR two strings<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Bit-wise exclusive OR two strings<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrXor function is the [[BitXorString (String function)]].</p> | ||
This function performs a bit-wise exclusive OR of two strings. | This function performs a bit-wise exclusive OR of two strings. |
Revision as of 20:23, 8 February 2011
<section begin="desc" />Bit-wise exclusive OR two strings<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrXor function is the BitXorString (String function).
This function performs a bit-wise exclusive OR of two strings.
The $StrXor function accepts three arguments and returns a string result that is the bit-wise exclusive OR of the first two arguments, the shorter being padded with as many copies of the third argument as are required to make the string lengths equal.
The first argument is an arbitrary string.
The second argument is another arbitrary string.
The third argument is another arbitrary string that is appended to the shorter of the first two strings and replicated as many times as required to make the strings of equal length. If this value is not specified or is null it defaults to a single null byte (X'00').
Syntax
<section begin="syntax" /> %STR = $StrXor(string1, string2, pad) <section end="syntax" />
For example
%X = $X2C('112233445566') %Y = $X2C('654321') %JUNK = $StrXor(%X, %Y)
would set %JUNK to X'746112445566' and
%X = $X2C('112233445566') %JUNK = $StrXor(%X, , $X2C('CC'))
would set %JUNK to X'DDEEFF8899AA' and
%X = $X2C('112233445566') %Y = $X2C('1122') %Z = $X2C('FF00') %JUNK = $StrXor(%X, %Y, %Z)
would set %JUNK to X'0000CC44AA66'.
$StrXor is only available in Sirius Mods Version 6.2 and later.