Skip to content

Commit

Permalink
Make AES reset a no-op after first call, since data doesn't change.
Browse files Browse the repository at this point in the history
The AES _doReset function sets up a bunch of structures that aren't
actually modified when the cipher runs.  We can save a bunch of time by
re-using previously set up data on subsequent calls to _doReset.
  • Loading branch information
pkaminski committed Oct 12, 2016
1 parent 8940297 commit 10f7c2c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/aes.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
*/
var AES = C_algo.AES = BlockCipher.extend({
_doReset: function () {
if (this._nRounds) return;

// Shortcuts
var key = this._key;
var keyWords = key.words;
Expand Down

0 comments on commit 10f7c2c

Please sign in to comment.