Exclusive Or

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Exclusive Or
Ontology

Exclusive Or (XOR, or occasionally EOR), is a logical operation that accepts two bits of input, and produces one bit of output. The output is 1 if the input bits differ, and 0 if they are the same.

More generally, the XOR operation can be performed on a stream of binary input, using a fixed-length binary "key". The key is replicated as needed to make it as long as the input stream, and the 1-bit XOR operation is performed on the corresponding bits. Typical key lengths are 1, 8, 16, 32, or 64 bits.

Some file formats use XOR to obfuscate all or part of their contents. This is done for various reasons, but it usually boils down to a desire to make the format not be trivially decodable or editable, or to make a format that does not look like some other format (e.g. to turn a text format into a binary format).

XOR is a standard building block of encryption algorithms, but by itself it offers very weak encryption (unless it qualifies as a one-time pad (Wikipedia article)).

Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox