1

有人能解释一下 RC2 密钥时间表是如何工作的(尤其是一开始)吗?我知道它使用小端,但我的实现不适用于除“0000 0000 0000 0000”之外的任何键

Test Vector
Key = 88bc a90e 9087 5a
Plaintext = 0000 0000 0000 0000
Ciphertext = 6ccf 4308 974c 267f

我假设与密钥有关的第一件事是将其更改为

bc88 0ea9 8790 5a

是的,我知道 RC2 甚至不再使用了,但我仍然想知道

4

1 回答 1

1

RFC 说:

密钥扩展算法首先将提供的 T 字节密钥放入密钥缓冲区的字节 L[0]、...、L[T-1]。

所以如果你的钥匙是88bc a90e 9087 5a你得到L[0]=0x88, L[1]=0xbc, ... L[6]=0x5a的。

这里不需要考虑任何字节序。

如果您想将密钥缓冲区视为 16 位字,您将获得:

K[i] = L[2*i] + 256*L[2*i+1]

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.

于 2010-05-30T20:51:13.713 回答