MD5 Speed Test

MD5 is a digital signature / "message digest" algorithm for security verification and secure authentication without encryption.

Definitions

security verification
a file is sent from a server; the MD5 signature of the server's file is also transferred; the other computer compares the MD5 signature of the file after the transfer to the server-generated signature.
authentication without encryption
a random string is sent from the server with each request; the user enters a password; the browser calculates the MD5 signature of the password and the random string; this combined signature provides access for the next request.

The purpose of the MD5 JavaScript speed test is to evaluate performance of MD5 JavaScript implementations. It is also a useful testcase for general analysis of a given scripting engine.

Functions tested: MD5() / hex_md5() Paul Johnston (MD5() used at Yahoo! Mail login), MD5_hexhash()* Masanao Izumo, and md5() Joseph Myers (optimized)

(*Masanao Izumo's script doesn't work on IE on Macintosh.)

The test uses an automatic judgment algorithm to limit the length of tests so slow computers do not freeze during a test configured for a faster computer. This consists of MD5 calculations of five basic inputs:

input correct MD5 signature
"", the null string d41d8cd98f00b204e9800998ecf8427e
"hello\n", five bytes plus linefeed b1946ac92492d2347c6235b4d2611184
" ", a single space 7215ee9c7d9dc229d2921a40e899ec5f
"HTML", four bytes 4c4ad5fca2e7a3f74dbb1ced00381aa4
A-Za-z0-9+/, list of the sixty-four Base64 alphabet characters 7845f7eade89338adabfef89bd6e9a5b

The test may be run from any known MD5 JavaScript code. The default is to show the results for common browsers and platforms.

Published results

9-3-08. Google Chrome is by far the fastest browser ever tested with MD5 speed from 500,000 to 1,000,000 bytes/second.

3-5-2010. Update. Opera 10.50 is by far the fastest browser ever tested, beating Google Chrome by a huge margin. Google Chrome beats IE 7.0 in MD5 JavaScript speed by a factor of at least 13, and Opera 10.50 beats out Google Chrome by a factor of almost 10 as well. Opera 10.50 is more than 200 times faster than IE 7.0!

PlatformTime
Opera 10.51 RC1, Processor 3.00/2.99 GHz single-core Pentium 4, with 504 MB of RAM (3-16-2010) jkm = 5,120,000 bytes/sec, paj = 3,413,333, mi = 1,284,000
In the improved benchmark at O-1.us, Opera 10.51/jkm_md5 reach a score higher than 7 MB/sec, a 40% improvement on the results above.
Microsoft Internet Explorer 7.0.5730.13 Processor 3.00/2.99 GHz single-core Pentium 4, with 504 MB of RAM (3-16-2010) jkm = 33,097 bytes/sec, paj = 25,974, mi = 25,223.
Mozilla Firefox 2.0.0.16 2.79 GHz Pentium 4 w/ 512 MB RAM Dell Optiplex GX280 jkm = 37,255 bytes/sec, paj = 28,125, mi = 28,872
Opera 9.23 / Windows Vista Ultimate, AMD X2 4000+ (2.1 GHz dual core) jkm = 116,213 B/s, paj = 89,087, mi = 89,825.
Mozilla 1.3 / Macjkm = 3066 B/s, paj = 1852, mi = 2732.
IE 6 / Windows XPjkm = 19053 B/s, paj = 16125 B/s, mi = 17881 B/s.
IE 6 / Windows 98 (another computer) jkm = 9327 B/s, paj = 5618 B/s, mi = 5020 B/s.
IE 5.2.3 / Mac OS X 10.2.6 (6-16-03)jkm = 7769 B/s, paj = 4213 (note: 263-byte test was fastest), mi = 4068 (this with incorrect checksum). (Each was best of two.)
IE 5 / Mac OS 9.2.2jkm = 7570 B/s, paj = 4064, mi = 4068 (with incorrect checksum).
Netscape Communicator 4.77 / Mac OS 9.2.2jkm = 5089 B/s, paj = 3535, mi = 5429.
Camino 7.0+ (nightly on 11-12-03) / Mac OS 10.2.8; best results of twojkm = 7721 B/s, paj = 4339, mi = 6286.
Camino 0.8b (5-22-04) / Mac OS 10.2.8; best results of twojkm = 7471 B/s, paj = 4096, mi = 6247.
Safari Beta 2 / Mac OS 10.2.5jkm = 1076 B/s, paj = 1044, mi = 1126.
Mozilla Firebird 0.6 / Mac OS X 10.2.6jkm = 5576 B/s, paj = 3455, mi = 4840.
Opera 6.02 / Mac OS 10.2.6jkm = 1084 B/s, paj = 925, mi = 1125* (*checksum failed).
Opera 7.50 / Mac OS 10.2.8 (5-18-04, best of two) jkm = 1966 B/s, paj = 1849, mi = 2160.
Safari 1.0 (6-23-03, best of two)jkm = 1460 B/s, paj = 1062, mi = 1304.
Mozilla 1.7a (1-16-04, best of two)jkm = 5577 B/s, paj = 3310, mi = 4786.
Firefox 0.8 (2-9-04, best of two)jkm = 6089 B/s, paj = 3685, mi = 4516.
Firefox 0.9 (6-17-04, best of two)jkm = 5909 B/s, paj = 3481, mi = 5330.
Camino 0.8 (7-3-04, best of two)jkm = 7880 B/s, paj = 4245, mi = 6545.
Firefox 0.9.1 (7-4-04, best of two)jkm = 5918 B/s, paj = 3486, mi = 4538.

jkm = md5 by Joseph Myers, paj = hex_MD5 by Paul Johnston, mi = MD5_hexhash by Masanao Izumo.

Choose a link to test known MD5 implementations: md5 by Joseph Myers, MD5 by Paul Johnston, MD5 by Masanao Izumo.

For historical interest, there is also calcMD5 by Henri Torgemane. Unfortunately, it is written in 1996 and had to be modified somewhat to use local iteration variables; due to other similar artifacts of early JavaScript implementation (all the way back to .jvs), its performance on Mozilla Firefox 0.9 is 338 ms, compared to 29 ms for jkm-md5. Also, it does not pass the calculation for the MD5 sum of "hello\n" (test 2/5), but this is merely due to its ASCII-isation, presumably, which is arguably 50% a feature and 50% not a feature. (Some would say that another function should do that job--not the MD5 calculation.)