为什么在加密上使用XOR? [英] Why is XOR used on Cryptography?

查看:146
本文介绍了为什么在加密上使用XOR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么XOR只用在加密算法中,不使用OR,AND和NOR等其他逻辑门?

解决方案

p>不是说XOR门是唯一一个在所有加密中使用的,但它是唯一的双向加密,它是专门使用。



这里解释:

假设你有一个二进制数字字符串'10101'
和你XOR字符串'10111'与它你' 00010'



现在你的原始字符串被编码,第二个字符串成为你的键
如果你用你的编码字符串你的密钥,你得到你的原始字符串。



XOR允许您轻松加密和解密字符串,其他逻辑操作不会。



你有一个更长的字符串,你可以重复你的密钥,直到它足够长的
例如,如果你的字符串是1010010011然后你会简单写你的密钥两次,它会变成1011110111和xor它与新的字符串



这里是一个关于XOR密码的维基百科链接 http:// en .wikipedia.org / wiki / XOR_cipher


Why is XOR only used in the cryptographic algorithms, and other logic gates like OR, AND and NOR are not used?

解决方案

It isn't exactly true to say that the XOR gate is the only one used throughout all cryptography, however it is the only two way encryption where it is used exclusively.

Here is that explained:

Imagine you have a string of binary digits '10101' and you XOR the string '10111' with it you get '00010'

now your original string is encoded and the second string becomes your key if you xor your key with your encoded string you get your original string back.

XOR allows you to easily encrypt and decrypt a string, the other logic operations don't.

If you have a longer string you can repeat your key until its long enough for example if your string was 1010010011 then you'd simple write your key twice and it would become 1011110111 and xor it with the new string

Here's a wikipedia link on the XOR cipher http://en.wikipedia.org/wiki/XOR_cipher

这篇关于为什么在加密上使用XOR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆