求解按位代数中的未知数
假设我有 3 个字节,XY 和 Z。X
XOR Y 结果为 Z。
我知道 X 和 Z 是什么,但我不知道 Y 是什么,所以我正在编写一个快速脚本来解决这个问题。
不过,我什至不知道如何开始。我手工做了几个,这只是逐一比较的问题,但我怎样才能在 python 中做到这一点呢?我求解 Y 的过程似乎不够清晰。
因为我只需要实际使用这样的东西,所以要么编写它,要么只使用为我做这件事的东西就足够了。
Suppose I have 3 bytes, X Y and Z.
X XOR Y results in Z.
I know what X and Z are, but I don't know what Y is, so I'm writing a quick script to figure this out.
Though, I don't know how I would even begin. I did a couple of them by hand and it was simply a matter of comparing each bit one by one, but how can I do this in python? My procedure for solving for Y doesn't seem clear enough.
Since I just need to actually use something like this, it would be enough to either write it or just use something that does this for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果
x ^ y == z
,则x ^ z == y
。您可以在 Python 中验证这一点If
x ^ y == z
, thenx ^ z == y
. You can verify this in Python with