Skip to content

Commit 10f7c2c

Browse files
committed
Make AES reset a no-op after first call, since data doesn't change.
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.
1 parent 8940297 commit 10f7c2c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/aes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
*/
7777
var AES = C_algo.AES = BlockCipher.extend({
7878
_doReset: function () {
79+
if (this._nRounds) return;
80+
7981
// Shortcuts
8082
var key = this._key;
8183
var keyWords = key.words;

0 commit comments

Comments
 (0)