XOR Calculator Help

Use the XOR calculator

This Calculator

General Issues

How does this calculator work?

The calculator uses the GNU Multiple Precision (GMP) extension in PHP to calculate XOR. The function gmp_xor takes two GMP resources as inputs and outputs a GMP resource. The calculator's inputs can be different types (base 2, 10, 16) and are initialized using the gmp_init function. Since gmp_init does not support base 256, the calculator converts ASCII inputs into and out of hexadecimal prior to initialization.

Why does the input need a specified type?

To reduce the extra step of converting inputs into a specific type, the calculator allows users to input as binary, decimal, hexadecimal or ASCII. The consequence of this is that the calculator needs to know the types of the inputs in order to accurately calculate the output.

What are the allowed types?

There are ASCII characters that cannot be displayed correctly in html. Therefore, ASCII is not a realiable type for abitrary output values.

Can the calculator handle large inputs?

Yes, although an early version of this calculator used the built-in XOR bitwise operator in PHP. This meant that inputs and outputs were limited to signed 64-bit integers (2^64/2 or 9,223,372,036,854,775,808). The current implementation uses the GMP extension that is able to handle much larger inputs. The limiting factor will be the size of the POST data to the calculator.

Privacy Policy

This site does not use cookies and does not have third-party content. The site automatically logs all requests and uses tools to track usage and find errors. This data is stored on the server without encryption. In addition, since this site does not use SSL/TLS (i.e. https), the calculator inputs and outputs travel across networks in plaintext and are not secure. Dec. 10, 2014 UPDATE: now with optional https support.

What Is XOR?

XOR "exclusive or" is a bitwise (and logical) operation that outputs 1 (true) if the two inputs are not the same and outputs 0 (false) if the two inputs are the same. With the XOR calculator, this operation occurs at each bit. For example:

Bitwise XOR
Input IInput IIOutput
000
011
101
110

To demonstrate how XOR works with the calculator, try setting inputs and output to binary.

What are related functions?

Other bitwise operations include: AND, OR, NOT

Bitwise AND
Input IInput IIOutput
000
010
100
111
Bitwise OR
Input IInput IIOutput
000
011
101
111
Bitwise NOT
InputOutput
01
10