本文介绍了简单的加密算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个电梯的项目只是为了好玩,它实际上是硬件。但我认为这更多的是一个软件问题。我不需要有这个功能,其实这完全是多余的,但我很好奇,所以我将它无论如何,所以我可以学到:P

I'm working on an elevator project just for fun, it's actually hardware. But I think this is more of a software question. I don't need to have this feature, in fact it is completely redundant, but I was curious so I'm adding it anyway so I can learn :P

我有一个8位地址,8位数据总线和一个8位的加密code。我有一个主站和许多从设备。主知道从站的地址,并知道加密code。奴隶们知道他们的地址和加密code为好。

I have an 8 bit address, 8 bit data bus, and an 8 bit encryption code.I have a master and many slave devices.The master knows the address of the slaves and knows the encryption code.The slaves know their address and the encryption code as well.

我想一个非常简单的算法,即:

I want a really simple algorithm such that:

主机发送Y,其中,Y =功能(数据加密code)从机接收Y,可以提取由数据=函数2(Y,加密code)

The master sends "y" where, y = function(data,encryption code)The slave receives "y" and can extract data by data = function2(y,encryption code)

我试着用玩弄AND,XOR,OR,等等以及它们的组合,但不能看着办吧。

I tried playing around with AND, XOR, OR, etc... and combinations of them, but couldn't figure it out.

再次声明,我在寻找简单的算法。如果你不介意的话,你可以帮我一个更大的忙,并解释如何,我可以得出这样一个解决方案/函数的一些理论。

Again I'm looking for simple algorithms. If you don't mind you could do me a bigger favour and explain some theory on how I can come to such a solution/functions.

太感谢了!

推荐答案

您可以使用 XOR chiper 这是非常简单的:

You can use XOR chiper it's very simple:

E(x,key)=> y= x XOR key
D(y,key)=> x= y XOR key

很简单!

您可以升级加密,并使其为密码块链接这意味着,例如,你有你需要将其划分为块,让说大​​小B.块的一个数据D第一块你:

You can upgrade the encryption and to make it to cipher-block chaining that means for example you have a data D you need to divide it to blocks, let say block of size B. for the first block you do:

E(b0,key)=> y0= b0 XOR key

结果它的将是关键的下一个数据块加密:

the result its going to be the key for the next block encryption:

E(b1,y0)=> y1= b0 XOR y0 .... E(bn,yn-1)=> yn= bn XOR yn-1

原始数据是 D = {B0,B1 ..... BN} 和加密数据的现在 E = {Y0, Y1 .... YN} 对加密数据进行解密,你需要做相反的方式!就这样!

The original data was D={b0,b1.....bn} and the encrypted data its now E={y0,y1....yn}to decrypt the encrypted data you need to do the opposite way! that's all!

这篇关于简单的加密算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 01:48