[80393] in Cypherpunks

home help back first fref pref prev next nref lref last post

Re: Question: RC5 assembly code?

daemon@ATHENA.MIT.EDU (Peter Gutmann)
Tue May 20 10:17:28 1997

From: pgut001@cs.auckland.ac.nz (Peter Gutmann)
To: cypherpunks@toad.com, juriaan_massenza@ctp.com
X-Charge-To: pgut001
Date: Wed, 21 May 1997 01:33:42 (NZST)
Reply-To: pgut001@cs.auckland.ac.nz (Peter Gutmann)

>I have the source code for RC5 encryption algorithm, but it is in C, well it
>is still cool since it is "portable" but I am actually looking for a PowerPC
>assembly code for the same, or at least for the Key Expansion, Encryption and
>Decryption routines.
>
>The "formula" for RC5 is pretty interesting and looks like is made to be
>implemented in Assembler.
 
Not if it's x86 assembler.  On the Pentium each rotate uses 4-5 non-pairable
cycles, so rotates are very slow (each rotate is the equivalent of (in the best
case) 8-10 normal instructions, so the two rotates in an RC5 round are the
equivalent of 16-20 other instructions).  According to Intel shifts and rotates
have been optimised on the PPro so they're slight faster than on the P5, but I
haven't looked at the details yet.  I haven't tried to formulate the RC5 core
in asm yet (because of the patent - what good is it writing code which noone
can use?) but on Intel hardware it's certainly going to be a lot slower than it
looks (the much more complex CAST core is faster than just the rotates from the
RC5 core).  This is kind of unfortunate, because it's a nice algorithm.
 
Peter.
 


home help back first fref pref prev next nref lref last post