RC5 and Java

If you haven't read about distributed.net and the RC5 cracking effort, see their web page for background info.

I was home with the flu recently, so I took the opportunity to hack on RC5 and Java, just to see what kind of keyrate I could squeeze out of a language doing something it wasn't designed to do.

I put together a sample applet that cracks keys and reports the results. When you hit the "Go!" button, this applet starts a thread that cracks keys for about 30 seconds and then stops. Depending on your browser and OS platform, you may or may not see live updates while the key cracker is working.

(The RC5 test applet requires a browser with Java enabled. If you are reading this, your browser does not support Java.)

(Note: Although this is doing RC5-32/12/8 (64-bit key), you won't find the "winning" key for two reasons: This program uses data from the RSA test contests, not the real thing; and it always checks the same range of keys.)

Performance numbers will vary wildly depending on CPU, OS, and Java VM. Update! Marc Sissom suggested an optimization that improves the results about 8% with Netscape and a whopping 82% with Internet Explorer! Here are the results for my computers:

CPU         Speed    OS      Java VM                keys/sec (v1) keys/sec (v2)
----------  -------  ------  ---------------------  ------------- -------------
Pentium II  300 MHz  NT 4.0  Sun JDK (W32 PP)*      182,000       197,000
Pentium II  300 MHz  NT 4.0  Internet Explorer 4.0   90,000       164,000
Pentium     120 MHz  NT 4.0  Netscape 4.03           44,700
Pentium     120 MHz  NT 4.0  Internet Explorer 4.0   16,500
i486         66 MHz  NT 4.0  Netscape 4.03           14,300
Pentium II  300 MHz  NT 4.0  Sun JDK                  5,200
Pentium     120 MHz  NT 4.0  HotJava 1.0              2,900
i486         66 MHz  NT 4.0  Internet Explorer 4.0    2,850
Pentium      90 MHz  Linux   Sun JDK                  2,300
Pentium      90 MHz  Linux   Netscape 4.03              760

Others have written with their performance numbers:

CPU           Speed           OS              Java VM                 keys/sec
------------  --------------  --------------  ----------------------  --------
Pentium II    300 MHz (dual)  Windows NT 4.0  Netscape 4.03           183,000
Pentium II    266 MHz         Windows NT 4.0  Netscape 4.03           157,000
Pentium Pro   233 MHz (oc)    Windows NT 4.0  Netscape 4.01           137,000
Pentium Pro   233 MHz (oc)    Windows NT 4.0  Sun JDK (W32 PP)*       133,000
AMD K6        200 MHz (oc)    Windows NT 4.0  Netscape 4.03           120,000
AMD K6        200 MHz         Windows 95      Netscape 4.03           118,000
Pentium Pro   200 MHz         Windows NT 4.0  Netscape 4.03           116,000
Pentium Pro   166 MHz (oc)    Windows 95      Netscape 4.03            91,300
Pentium       240 MHz (oc)    Windows NT 4.0  Netscape 4.03            90,500
Pentium II    300 MHz (dual)  Windows NT 4.0  Internet Explorer 4.0    81,000
Pentium       200 MHz         Windows NT 4.0  Netscape 4.03            76,000
Cyrix 6x86    166 MHz         Windows 95      Netscape 4.03            74,700
Cyrix 6x86    166 MHz         Windows 95      Symantec                 67,400
Pentium       166 MHz         Windows NT 4.0  Netscape 4.03            65,300
AMD K6        233 MHz         Windows 95      Internet Explorer 4.0    60,200
AMD K6        200 MHz         Windows 95      Internet Explorer 4.0    52,700
Pentium Pro   200 MHz         Windows NT 4.0  Internet Explorer 3.02   52,000
Pentium       133 MHz         Windows NT 4.0  Netscape 4.0             51,500
Pentium       166 MHz         Windows 95      Netscape 4.0             44,700
Pentium       100 MHz         Windows NT 4.0  Netscape 4.03            37,800
Pentium       240 MHz (oc)    Windows NT 4.0  Internet Explorer 4.0    33,300
Pentium       166 MHz         Windows NT 4.0  Internet Explorer 4.0    31,700
Cyrix 6x86    133 MHz         Windows 95      Internet Explorer 3.02   27,500
UltraSPARC    167 MHz         Solaris 2.6     Sun JDK                  20,300
Pentium       150 MHz         Windows 95      Internet Explorer 3.02   19,000
Cyrix 6x86    133 MHz         Windows 95      Netscape 3.03            11,700
Pentium       150 MHz         Windows 95      Netscape 3.01fr           9,350
Pentium       133 MHz         OS/2 Warp 4     Netscape 2.02             8,250
PowerPC 604e  200 MHz         MacOS           Netscape 4.03             6,200
Pentium II    300 MHz         Linux           Sun JDK                   5,200
Pentium Pro   233 MHz (oc)    Windows NT 4.0  Sun JDK                   3,900
PowerPC       180 MHz         MacOS           Internet Explorer 4.0     3,200
Pentium II    300 MHz         Linux           Netscape 4.03             2,300
PowerPC 604e  200 MHz         MacOS           Runtime for Java 1.5      2,150
Cyrix 6x86    166 MHz         Windows 95      Sun JDK                   2,000
PowerPC 604e  100 MHz         MacOS           Netscape 4.03             1,750
Pentium II    266 MHz         Linux           Netscape 4.03             1,600
68040          40 MHz         MacOS 8         Runtime for Java 1.5.1    1,380
Pentium       133 MHz         Linux           Netscape 4.03             1,080
Mips R4400    200 MHz         (SGI Indigo2)   Netscape 3.01S            1,050
UltraSPARC    167 MHz         Solaris 2.6     Netscape 4.03             1,050
PowerPC 601   120 MHz         MacOS 7.5.5     Netscape 3.01               920
SPARC 5       110 MHz         Solaris         Netscape 4.03               587
68040          40 MHz         MacOS 8         Netscape 3.01                26

(*) W32 PP is the Win32 Performance Pack available with the Sun JDK 1.1.4.

You can download the source code if you want to have a look. The source zip also contains the .class files, so if you would like to try RC5demo from the command line, just run:

java RC5demo

(Substitute the name of your Java interpreter if you're not using the Sun JDK.) This will crack keys for about 30 seconds and report the results to the console.


Greg Hewgill <greg@hewgill.com>