MD5 (v16)

Revision 16 of this benchmark created on


Preparation HTML

<script src="https://cdn.jsdelivr.net/gh/emn178/js-md5/build/md5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/md5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/spark-md5/3.0.2/spark-md5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hash-wasm"></script>

Setup

var upperCase = Array(26).fill(0).map((_v, i) => String.fromCharCode(65 + i))
var lowerCase = Array(26).fill(0).map((_v, i) => String.fromCharCode(97 + i))
var digits = Array(10).fill(0).map((_v, i) => i)

var sampleSize = [...upperCase, ...lowerCase, ...digits]

function getRandomIndex() {
  return Math.floor(Math.random() * sampleSize.length);
}

var str = Array(10000000).fill(0).map(() => sampleSize[getRandomIndex()]).join('')

Test runner

Ready to run.

Testing in
TestOps/sec
js-md5
md5(str);
ready
CryptoJS
CryptoJS.MD5(str).toString();
ready
SparkMD5
SparkMD5.hash(str);
ready
Hash-WASM
hashwasm.md5(str)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.