`xor` package

`xor` contains no classes.

## License

The `xor` package is marked as `Compatible`, which means any game can use it.

## Utility functions

*mangled* = SCUtil.XorString(*string*, *cipher*)
- This returns a copy of
*string* with every character binary XOR'd with *cipher*. *cipher* is a number between 0 and 255 inclusive; if it is outside this range, only the low 8 bits will be used.
- Repeating this operation with the same
*cipher* will return the original *string*. A trivial statistical analysis will "crack" this cipher, so using it for anything other than mild obfuscation is unwise.
*mangled* = SCUtil.XorStrings(*string1*, *string2*)
- This is equivalent to
*XorString*, but each character in *string1* is XOR'd with the corresponding character in *string2*. If one string is longer than the other, the extra characters are appended to the *mangled* string without modification.
- This can be used to implement one-time pad cryptography. If the same "key" string is never used to encrypt more than one "plaintext" string, and the "key" string is sufficiently random, no attack (theoretical or otherwise) will
**ever** be able to recover the plaintext from the ciphertext without the key. (Beware $5 wrench attacks.)

Back to index