问题描述
有人可以解释RC2密钥计划如何工作(特别是它的最开始)?我知道它使用小端,但我的实现不工作的任何关键,除了0000 0000 0000 0000
Can someone explain how the RC2 key schedule works (particularly the very beginning of it)? i know it uses little endian, but my implementation is not working for any key except "0000 0000 0000 0000"
Test Vector
Key = 88bc a90e 9087 5a
Plaintext = 0000 0000 0000 0000
Ciphertext = 6ccf 4308 974c 267f
im假设与键相关的第一件事是将其更改为
im assuming that the first thing to do with the key would be to change it into
bc88 0ea9 8790 5a
是的,我知道RC2甚至不再使用,但我仍然想知道
and yes i know RC2 is not even used anymore, but i would still like to know
推荐答案
RFC说:
所以如果你的键是 88bc a90e 9087 5a
你会得到 L [0] = 0x88,L [1] = 0xbc,... L [6] = 0x5a
。
So if your key is 88bc a90e 9087 5a
you get L[0]=0x88, L[1]=0xbc, ... L[6]=0x5a
.
这里不需要考虑任何字节序。
No need to consider any endianess here.
如果你想把密钥缓冲区视为16位字,你可以得到:
If you want to treat the key-buffer as 16-bit words you get:
K [0] = 0xbc88,K [1] = 0xa90e,K [2] = 0x8790
。 L [7]仅在密钥扩展步骤中稍后分配,因此严格地说,K [3]在此时是未定义的。随意选择任何你想要的值,因为它没有区别的算法。如果选择0,您会得到 K [3] = 0x005a
。
I.e. K[0] = 0xbc88, K[1] = 0xa90e, K[2] = 0x8790
. L[7] is only assigned later in the key-expansion step, so strictly speaking K[3] is undefined at this point. Feel free to choose any value you want however, since it makes no difference to the algorithm. If you select 0, you get K[3] = 0x005a
.
这篇关于RC2键日程表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!