jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Comparison between some standard crypto algorithms SHA1, HMAC-SHA1, MD5, SHA-256, AES-128, AES-256, ChaCHA20
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/src/core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/src/cipher-core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/src/mode-ofb.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/src/aes.js"></script>
<script src="https://siphash.googlecode.com/svn/trunk/chacha20.js"></script>
<script src="https://raw.github.com/garycourt/murmurhash-js/master/murmurhash3_gc.js">
</script>
<script src="https://raw.github.com/blueimp/JavaScript-MD5/master/md5.js">
</script>
<script>
function fromHex(h) {
h.replace(' ', '');
var out = [], len = h.length, w = '';
for (var i = 0; i < len; i += 2) {
w = h[i];
if (((i+1) >= len) || typeof h[i+1] === 'undefined') {
w += '0';
} else {
w += h[i+1];
}
out.push(parseInt(w, 16));
}
return out;
}
var hashCode = function(str){
if (Array.prototype.reduce){
return str.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);
}
var hash = 0;
if (str.length === 0) return hash;
for (var i = 0; i < str.length; i++) {
var character = str.charCodeAt(i);
hash = ((hash<<5)-hash)+character;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
var makeCRCTable = function() {
var c;
var crcTable = [];
for (var n = 0; n < 256; n++) {
c = n;
for (var k = 0; k < 8; k++) {
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
crcTable[n] = c;
}
console.log("CREATED")
return crcTable;
}
var crcTable = makeCRCTable();
var crc32_g = function(str) {
var crc = 0 ^ (-1);
for (var i = 0; i < str.length; i++) {
crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
}
return (crc ^ (-1)) >>> 0;
};
</script>
<script src="https://raw.github.com/garycourt/murmurhash-js/master/murmurhash3_gc.js">
</script>
<script src="https://raw.github.com/blueimp/JavaScript-MD5/master/md5.js">
</script>
var key128 = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f');
var iv128 = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f');
var key256 = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f');
var iv256 = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f101112131415161718191a1b1c1d1e1f');
chacha_key = fromHex('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f');
chacha_nonce = fromHex('0001020304050607');
chacha_ctx = chacha20_init(chacha_key, chacha_nonce);
//same string than ASomewhatLongMessageWithSomeSecretAndAWholeBunchOfNumbers12398763846536456783527654786254367 but in HEX:
chacha_keystream = fromHex("41536f6d65776861744c6f6e674d65737361676557697468536f6d65536563726574416e644157686f6c6542756e63684f664e756d626572733132333938373633383436353336343536373833353237363534373836323534333637");
chacha_klen = chacha_keystream.length;
chacha_out = new Array(chacha_klen);
Ready to run.
Test | Ops/sec | |
---|---|---|
SHA1 |
| ready |
HMAC-SHA1 |
| ready |
MD5 |
| ready |
SHA-256 |
| ready |
AES-128-CBC |
| ready |
AES-256-CBC |
| ready |
AES-256-OFB |
| ready |
ChaCha20 |
| ready |
crc |
| ready |
hashCode |
| ready |
murmurhash3_128_gc |
| ready |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.