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 the bitwise XOR. The function gmp_xor takes two GMP resources as inputs and outputs a GMP resource. The calculator can process 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 steps of users converting inputs to a specific type, the calculator allows users to input and output 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.

For example, the input of 10 without a type could be several values. In binary, 10 would be equal to 2 in decimal. In hexadecimal, 10 would be equal to 16 in decimal and in ASCII, 10 could be equal to 12592 in decimal.

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.

A warning message will appear if you output in ASCII and there are character the calculator cannot display. Select another output type, such as hexadecimal, to avoid this problem.

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.

Updated (Dec. 10, 2014): 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