[Hardware] RC5 algorithm

Dan Oetting dan_oetting at qwest.net
Tue Dec 20 19:34:15 EST 2005


You are right that RC5 doesn't care what comes after the current  
block. But it does care about what came before. The RSA contests use  
RC5-CBC so you are given an IV that represents the result from the  
previous block that needs to be XOR'd with the plain text for the  
current block before applying the RC5 encryption. The resulting  
cypher text is then used as the IV for the next block.

Here is a description with sample code: <http://www.ietf.org/rfc/ 
rfc2040.txt>

-- Dan O.


On Dec 20, 2005, at 10:17 AM, Martin Klingensmith wrote:

> 'b' is the length of the key. In this case it will always be 9  
> bytes long.
> RC5 is a stream algorithm. I should be able to encode the first two
> blocks [64 bits, 8 bytes] and get the same output. There is nothing in
> the algorithm which cares about the rest of the message. I could be
> wrong, but I don't think I am [of course].
> --
> Martin
>
> Michael Meeuwisse wrote:
>
>> AFAIK because you're not using the entire plaintext input, but only
>> the first bit, the end cipher is different from what you see on the
>> RSA web page.
>> This is because your keytable (S[]) is builded with a messed up input
>> (key[]) in L[], which in turn will be different depending on the
>> length (b) of your input.
>> That's also why John didn't end up with an error, since the algorithm
>> used is still correct. :)
>>
>> [: wacco :]
>>
>>> From: Martin Klingensmith <martin at nnytech.net>
>>>
>>> The ciphertext should match the ciphertext on the RSA website,  
>>> should it
>>> not? Check here:
>>> <http://www.rsasecurity.com/rsalabs/node.asp?id=2105>
>>> "RC5-32/12/9-test"
>>>
>>> key: c9 0c 03 53 c0 d4 e1 fe 85
>>> plaintext, first two 32-bit words: 54 68 65 20 75 6e 6b 6e
>>> ciphertext: 5a 28 2d 56 2a 85 b7 2f
>>>
>>> -- 
>>> Martin Klingensmith
>>>
>>> John L. Bass wrote:
>>>
>>>> What architecture cpu are you running your tests on?
>>>>
>>>> Works fine from:
>>>>
>>>>    [jbass at dmsd ~]$ uname -a
>>>>    Linux dmsd.com 2.6.10-1.770_FC3smp #1 SMP Thu Feb 24 14:20:06
>>> EST 2005 i686 i686 i386 GNU/Linux
>>>>    [jbass at dmsd ~]$ vi rc5ref.c
>>>>    [jbass at dmsd ~]$ make rc5ref
>>>>    cc     rc5ref.c   -o rc5ref
>>>>    [jbass at dmsd ~]$ ./rc5ref
>>>>    key = C9 0C 03 53 C0 D4 E1 FE 85
>>>>       plaintext 54686520 756E6B6E  --->  ciphertext E61759B8  
>>>> 36808E74
>>>>
>>>> John
>>>> _______________________________________________
>>>> Hardware mailing list
>>>> Hardware at lists.distributed.net
>>>> http://lists.distributed.net/mailman/listinfo/hardware
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Hardware mailing list
>>> Hardware at lists.distributed.net
>>> http://lists.distributed.net/mailman/listinfo/hardware
>>
>>
>>
>> _______________________________________________
>> Hardware mailing list
>> Hardware at lists.distributed.net
>> http://lists.distributed.net/mailman/listinfo/hardware
>
>
> _______________________________________________
> Hardware mailing list
> Hardware at lists.distributed.net
> http://lists.distributed.net/mailman/listinfo/hardware
>



More information about the Hardware mailing list