CryptoJS vs Google Closure vs SJCL (v11)

Revision 11 of this benchmark created on


Preparation HTML

<script src='http://crypto.stanford.edu/sjcl/sjcl.js'></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/mode-ctr.js"></script>
<script src="https://raw.githubusercontent.com/google/closure-library/master/closure/goog/base.js"></script>

<script>
   goog.require('goog.crypt');
   goog.require('goog.crypt.Aes');
   goog.require('goog.crypt.Cbc');
   goog.require('goog.crypt.pbkdf2');
</script>

<script>
   var encrypted, inputArr, keyphrase, iv, salt, key, aes, cbc;
   var testText = "Lorem ipsum dolor sit amet, eu malis dolore nominati per, his platonem periculis elaboraret at. At illud sententiae voluptatibus his, tollit vituperatoribus eu mei. Eu nec maiorum recusabo. Tation civibus evertitur ex per. Usu menandri referrentur ut, et mea feugiat laoreet perpetua. Ius vitae consul facilisis an. Ei pro choro soleat. Duo ex feugait deterruisset, duo wisi latine id, est tation decore omittantur eu. Duo causae scaevola an, copiosae patrioque id eam, ei facilis ullamcorper definitionem nam. An cibo atqui cum. Dicit noluisse at vis, volumus petentium appellantur vix an. Sed ea lorem assueverit. Odio philosophia mel te, mei quis debet officiis id. Ad mei dicam gubergren interpretaris, sea causae labitur cu, nec posse semper abhorreant cu.";

   inputArr = goog.crypt.stringToByteArray(testText);
   keyphrase = goog.crypt.stringToByteArray('password');
   iv = goog.crypt.stringToByteArray('aaaaaaaaaaaaaaaa');
   salt = goog.crypt.stringToByteArray('aaaaaaaaaaa');
   key = goog.crypt.pbkdf2.deriveKeySha1(keyphrase, salt, 4096, 128);
   aes = new goog.crypt.Aes(key);
   cbc = new goog.crypt.Cbc(aes);
   CryptoJS.algo.AES.keySize = 128/32;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
CryptoJS
encrypted = CryptoJS.AES.encrypt(testText, "password");
ready
Google Closure
encrypted = cbc.encrypt(inputArr, iv);
ready
SJCL
encrypted = sjcl.encrypt('password', testText);
ready

Revisions

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