Comparing version 3.1.7 to 3.1.8
@@ -94,4 +94,9 @@ ;(function (root, factory, undef) { | ||
_doReset: function () { | ||
// Skip reset of nRounds has been set before and key did not change | ||
if (this._nRounds && this._keyPriorReset === this._key) { | ||
return; | ||
} | ||
// Shortcuts | ||
var key = this._key; | ||
var key = this._keyPriorReset = this._key; | ||
var keyWords = key.words; | ||
@@ -101,3 +106,3 @@ var keySize = key.sigBytes / 4; | ||
// Compute number of rounds | ||
var nRounds = this._nRounds = keySize + 6 | ||
var nRounds = this._nRounds = keySize + 6; | ||
@@ -104,0 +109,0 @@ // Compute number of key schedule rows |
{ | ||
"name": "crypto-js", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"description": "JavaScript library of crypto standards.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
24
core.js
@@ -20,2 +20,21 @@ ;(function (root, factory) { | ||
var CryptoJS = CryptoJS || (function (Math, undefined) { | ||
/* | ||
* Local polyfil of Object.create | ||
*/ | ||
var create = Object.create || (function () { | ||
function F() {}; | ||
return function (obj) { | ||
var subtype; | ||
F.prototype = obj; | ||
subtype = new F(); | ||
F.prototype = null; | ||
return subtype; | ||
}; | ||
}()) | ||
/** | ||
@@ -35,4 +54,4 @@ * CryptoJS namespace. | ||
var Base = C_lib.Base = (function () { | ||
function F() {} | ||
return { | ||
@@ -59,4 +78,3 @@ /** | ||
// Spawn | ||
F.prototype = this; | ||
var subtype = new F(); | ||
var subtype = create(this); | ||
@@ -63,0 +81,0 @@ // Augment |
@@ -91,3 +91,11 @@ ;(function (root, factory) { | ||
var map = this._map; | ||
var reverseMap = this._reverseMap; | ||
if (!reverseMap) { | ||
reverseMap = this._reverseMap = []; | ||
for (var j = 0; j < map.length; j++) { | ||
reverseMap[map.charCodeAt(j)] = j; | ||
} | ||
} | ||
// Ignore padding | ||
@@ -97,3 +105,3 @@ var paddingChar = map.charAt(64); | ||
var paddingIndex = base64Str.indexOf(paddingChar); | ||
if (paddingIndex != -1) { | ||
if (paddingIndex !== -1) { | ||
base64StrLength = paddingIndex; | ||
@@ -104,15 +112,4 @@ } | ||
// Convert | ||
var words = []; | ||
var nBytes = 0; | ||
for (var i = 0; i < base64StrLength; i++) { | ||
if (i % 4) { | ||
var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); | ||
var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); | ||
var bitsCombined = bits1 | bits2; | ||
words[nBytes >>> 2] |= (bitsCombined) << (24 - (nBytes % 4) * 8); | ||
nBytes++; | ||
} | ||
} | ||
return parseLoop(base64Str, base64StrLength, reverseMap); | ||
return WordArray.create(words, nBytes); | ||
}, | ||
@@ -122,2 +119,16 @@ | ||
}; | ||
function parseLoop(base64Str, base64StrLength, reverseMap) { | ||
var words = []; | ||
var nBytes = 0; | ||
for (var i = 0; i < base64StrLength; i++) { | ||
if (i % 4) { | ||
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); | ||
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); | ||
words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); | ||
nBytes++; | ||
} | ||
} | ||
return WordArray.create(words, nBytes); | ||
} | ||
}()); | ||
@@ -124,0 +135,0 @@ |
{ | ||
"name": "crypto-js", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"description": "JavaScript library of crypto standards.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428266
11192