[Hardware] The market of ASICs (One GigaKey / Second?)

jbass at dmsd.com jbass at dmsd.com
Sun Aug 8 23:58:10 EDT 2004

Elektron <elektron_rc5 at yahoo.ca> writes:
> Imagine loops are unrolled, since the % is incredibly wasteful. The 
> B=L[0] line may be able to have a hard-coded value of A in some systems 
> for a marginal speed increase (not PPC though). We don't decrypt. We 
> encrypt the plaintext to check that it matches the ciphertext (most 
> cores do this, and either way it's just as fast, except as mentioned, 
> the last round is faster).

That's pretty much what I did several years back, while trying to construct
an FPGA based RC5 engine. The starting point was a C based code generator
to build C and VHDL RC5 engines.

I still having found the VHDL RC5 tools, but this is a prototype of the
C code RC5 core generator. It still isn't perfect, but gives the C compiler
lots of locality hints to pull all the terms into registers and discard
the writes which can be a bottleneck on small write-thru based caches.
Later gcc versions nearly get it perfect with -O3


 * Construct unrolled RC5 key check core
 * John L. Bass, Copyright 2001
main( )
	const unsigned int P = 0xB7E15163;
	const unsigned int Q = 0x9E3779B9;
	unsigned int S[26];
	unsigned int e, i, s, l;

	/* round 0 */
	S[0]= P;
	for (s=1;s<26;s++)
		S[s]= S[s-1] + Q;
	printf("\t\tL%d = key0 = count;\n",l);
	printf("\t\tL%d = key1 = count>>32;\n",l+1);

	printf("\t\tS%d = ROTL3(0x%08x]);\n",
	printf("\t\tL0 = ROTL(L0 + S%d, S%d);\n",

	/* rounds 0,1 */
	for (;s<(2*26);s++,l^=1)
		printf("\t\tS%d = ROTL3(0x%08x + S%d + %s);\n",
		printf("\t\t%s = ROTL(%s + S%d + %s, S%d + %s);\n",

	/* rounds 2,3 */
	for (;s<(4*26);s++,l^=1)
		printf("\t\tS%d = ROTL3(S%d + S%d + %s);\n",
		if(s != 103)
		printf("\t\t%s = ROTL(%s + S%d + %s, S%d + %s);\n",
		if(s == 78)
		    printf("\t\tE0 = plain0 + S%d;\n",s);
		if(s == 79)
		    printf("\t\tE1 = plain1 + S%d;\n",s);
		if(s > 79)
		printf("\t\tE%d = ROTL(E0 ^ E1, E%d) + S%d;\n",

More information about the Hardware mailing list