From 39bd0c5fe072584de4680c13dc0fd55da95e2a42 Mon Sep 17 00:00:00 2001 From: Gil Pedersen Date: Fri, 4 Dec 2015 10:55:16 +0100 Subject: [PATCH] add explicit hints that numbers are 32 integers this allows the v8 engine to better optimize the method --- src/crypt/aes128-decrypter.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/crypt/aes128-decrypter.js b/src/crypt/aes128-decrypter.js index af9268ec6ca..7914e8352a9 100644 --- a/src/crypt/aes128-decrypter.js +++ b/src/crypt/aes128-decrypter.js @@ -90,20 +90,20 @@ class AES128Decrypter { // pull out the words of the IV to ensure we don't modify the // passed-in reference and easier access - init0 = initVector[0]; - init1 = initVector[1]; - init2 = initVector[2]; - init3 = initVector[3]; + init0 = ~~initVector[0]; + init1 = ~~initVector[1]; + init2 = ~~initVector[2]; + init3 = ~~initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC) // to each decrypted block for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { // convert big-endian (network order) words into little-endian // (javascript order) - encrypted0 = this.ntoh(encrypted32[wordIx]); - encrypted1 = this.ntoh(encrypted32[wordIx + 1]); - encrypted2 = this.ntoh(encrypted32[wordIx + 2]); - encrypted3 = this.ntoh(encrypted32[wordIx + 3]); + encrypted0 = ~~this.ntoh(encrypted32[wordIx]); + encrypted1 = ~~this.ntoh(encrypted32[wordIx + 1]); + encrypted2 = ~~this.ntoh(encrypted32[wordIx + 2]); + encrypted3 = ~~this.ntoh(encrypted32[wordIx + 3]); // decrypt the block decipher.decrypt(encrypted0,