⊕ 二进制 XOR 运算(按位异或)XOR Binary Values
把两个或多个二进制数按位做 XOR(异或)运算:两个数在该位不同时结果为 1,相同时为 0;多个数时,该位上 1 的个数为奇数结果就是 1(奇偶校验)。可以每行一组分别计算,也可以把所有数一起计算;位数不同时右端对齐左边补 0,可显示竖式、十进制和十六进制结果。适合学习位运算、校验和、简单加密(异或密钥)和数字电路练习,数据在本地处理。Apply bitwise XOR to two or more binary values: a result bit is 1 where two values differ and 0 where they match; with more values it is 1 where an odd number of them have a 1 (parity). Work each line separately or combine all values; different lengths are right-aligned with leading zeros. Show the working and the result in decimal and hex too. Handy for learning bitwise logic, checksums, simple XOR ciphers and digital-logic exercises. Processed locally.
使用说明与常见问题How-to & FAQ
「二进制 XOR 运算(按位异或)」是什么?What is the XOR Binary Values tool?
把两个或多个二进制数按位做 XOR(异或)运算:两个数在该位不同时结果为 1,相同时为 0;多个数时,该位上 1 的个数为奇数结果就是 1(奇偶校验)。可以每行一组分别计算,也可以把所有数一起计算;位数不同时右端对齐左边补 0,可显示竖式、十进制和十六进制结果。适合学习位运算、校验和、简单加密(异或密钥)和数字电路练习,数据在本地处理。Apply bitwise XOR to two or more binary values: a result bit is 1 where two values differ and 0 where they match; with more values it is 1 where an odd number of them have a 1 (parity). Work each line separately or combine all values; different lengths are right-aligned with leading zeros. Show the working and the result in decimal and hex too. Handy for learning bitwise logic, checksums, simple XOR ciphers and digital-logic exercises. Processed locally.
如何使用「二进制 XOR 运算(按位异或)」?How do I use the XOR Binary Values tool?
在「二进制 XOR 运算(按位异或)」中,把内容粘贴或输入到上方输入框,按需设置「计算方式」、「位数不同时」、「最少位数(可选)」,结果会实时显示在下方,点击「复制结果」即可复制。In the XOR Binary Values: Paste or type into the input box, adjust "Combine", "Different lengths", "Minimum width (optional)"; the result appears below instantly — click "Copy result" to copy it.
怎样输入多个数?How do I enter several values?
每行一个数,或在同一行里用空格、逗号、分号或加号(+)分隔;可以带 0b 前缀,数中间的下划线会被忽略(如 1010_1100)。“自动”方式下:如果有一行包含两个以上的数,就每行单独计算;否则所有数一起计算。Put one value per line, or separate them with spaces, commas, semicolons or plus signs (+) on a line. A 0b prefix is fine and underscores inside a value are ignored (1010_1100). In Auto mode, if any line holds two or more values each line is worked out on its own; otherwise all values are combined.
位数不同的数怎么对齐?How are values of different lengths lined up?
按右端(最低位)对齐,短的数在左边补 0,例如 101 和 11 按 101 和 011 计算,结果的位数等于最长的数(或你设置的“最少位数”)。如果希望位数不同时报错,把“位数不同时”改为“报错”。They are right-aligned on the lowest bit and shorter values get leading zeros, so 101 and 11 are treated as 101 and 011; the result is as long as the longest value (or the Minimum width you set). Choose "Show an error" under Different lengths if mismatched lengths should be rejected.
XOR 的真值表是什么?What is the XOR truth table?
0 XOR 0 = 0,0 XOR 1 = 1,1 XOR 0 = 1,1 XOR 1 = 0:相同为 0、不同为 1。多个数做 XOR 时,该位上 1 的个数为奇数结果才是 1,因此常用作奇偶校验。XOR 两次同一个数会还原:A XOR K XOR K = A,这是异或加密和 RAID 校验的原理。0 XOR 0 = 0, 0 XOR 1 = 1, 1 XOR 0 = 1, 1 XOR 1 = 0 — the same gives 0, different gives 1. With several values a bit is 1 only where an odd number of them have a 1, which is why XOR is used for parity. XOR-ing with the same value twice restores the original (A XOR K XOR K = A), the idea behind XOR ciphers and RAID parity.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「二进制 XOR 运算(按位异或)」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The XOR Binary Values runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「二进制 XOR 运算(按位异或)」免费吗?需要注册吗?Is the XOR Binary Values free? Do I need an account?
「二进制 XOR 运算(按位异或)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The XOR Binary Values is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.