@unabandoned/crypto-js 0.0.0-stage → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CONTRIBUTING.md +40 -0
  2. package/LICENSE +24 -0
  3. package/README.md +289 -2
  4. package/aes.js +234 -0
  5. package/blowfish.js +471 -0
  6. package/cipher-core.js +895 -0
  7. package/core.js +807 -0
  8. package/crypto-js.js +6657 -0
  9. package/docs/QuickStartGuide.wiki +470 -0
  10. package/enc-base64.js +136 -0
  11. package/enc-base64url.js +148 -0
  12. package/enc-hex.js +18 -0
  13. package/enc-latin1.js +18 -0
  14. package/enc-utf16.js +149 -0
  15. package/enc-utf8.js +18 -0
  16. package/evpkdf.js +134 -0
  17. package/format-hex.js +66 -0
  18. package/format-openssl.js +18 -0
  19. package/hmac-md5.js +18 -0
  20. package/hmac-ripemd160.js +18 -0
  21. package/hmac-sha1.js +18 -0
  22. package/hmac-sha224.js +18 -0
  23. package/hmac-sha256.js +18 -0
  24. package/hmac-sha3.js +18 -0
  25. package/hmac-sha384.js +18 -0
  26. package/hmac-sha512.js +18 -0
  27. package/hmac.js +143 -0
  28. package/index.js +18 -0
  29. package/lib-typedarrays.js +76 -0
  30. package/md5.js +268 -0
  31. package/mode-cfb.js +80 -0
  32. package/mode-ctr-gladman.js +116 -0
  33. package/mode-ctr.js +58 -0
  34. package/mode-ecb.js +40 -0
  35. package/mode-ofb.js +54 -0
  36. package/package.json +70 -4
  37. package/pad-ansix923.js +49 -0
  38. package/pad-iso10126.js +44 -0
  39. package/pad-iso97971.js +40 -0
  40. package/pad-nopadding.js +30 -0
  41. package/pad-pkcs7.js +18 -0
  42. package/pad-zeropadding.js +47 -0
  43. package/pbkdf2.js +145 -0
  44. package/rabbit-legacy.js +190 -0
  45. package/rabbit.js +192 -0
  46. package/rc4.js +139 -0
  47. package/ripemd160.js +267 -0
  48. package/sha1.js +150 -0
  49. package/sha224.js +80 -0
  50. package/sha256.js +199 -0
  51. package/sha3.js +326 -0
  52. package/sha384.js +83 -0
  53. package/sha512.js +326 -0
  54. package/tripledes.js +779 -0
  55. package/x64-core.js +304 -0
@@ -0,0 +1,40 @@
1
+ # Contribution
2
+
3
+ # Git Flow
4
+
5
+ In this fork, `develop` is the only working branch. `master` is upstream's old release branch of
6
+ built files, kept for history; nothing targets it.
7
+
8
+ # Pull request
9
+
10
+ Target your pull request on `develop`. PRs are squash-merged and the title is the Conventional
11
+ Commit release-please reads, so pick the type by what ships (`fix:` for a change to `src/`,
12
+ `chore:`/`ci:`/`test:` for anything that does not change the published files).
13
+
14
+ # How to build
15
+
16
+ 1. Clone
17
+
18
+ 2. Run
19
+
20
+ ```sh
21
+ npm install
22
+ ```
23
+
24
+ 3. Run
25
+
26
+ ```sh
27
+ npm run build
28
+ ```
29
+
30
+ This writes the published modules (`index.js`, `aes.js`, `enc-hex.js`, ...) into the package
31
+ root. They are generated and ignored by git.
32
+
33
+ 4. Run
34
+
35
+ ```sh
36
+ npm test
37
+ ```
38
+
39
+ This builds, checks the output against the crypto-js 4.2.0 tarball, and runs upstream's test
40
+ suite on `node:test`.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ # License
2
+
3
+ [The MIT License (MIT)](http://opensource.org/licenses/MIT)
4
+
5
+ Copyright (c) 2009-2013 Jeff Mott
6
+ Copyright (c) 2013-2016 Evan Vosberg
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,290 @@
1
- # Temporary Holding Version
1
+ # crypto-js
2
+
3
+ JavaScript library of crypto standards.
4
+
5
+ > **This is the `unabandoned` fork.** Upstream `crypto-js` stopped at 4.2.0 (October 2023) and
6
+ > is deprecated on npm. This fork continues it as
7
+ > [`@unabandoned/crypto-js`](https://www.npmjs.com/package/@unabandoned/crypto-js) so it has an
8
+ > owner. The library code is unchanged: the published modules are rebuilt from `src/` byte for
9
+ > byte identical to crypto-js 4.2.0, with the same file names, so every `crypto-js/<module>`
10
+ > import keeps working. To switch without touching your imports, alias it:
11
+ >
12
+ > ```bash
13
+ > npm install crypto-js@npm:@unabandoned/crypto-js
14
+ > ```
15
+ >
16
+ > Report problems with the fork [here](https://github.com/unabandoned/crypto-js/issues), not
17
+ > upstream. Upstream's advice below still stands: for new code, prefer the native Web Crypto /
18
+ > Node `crypto` APIs.
19
+
20
+ ## Discontinued
21
+
22
+ Active development of CryptoJS has been discontinued. This library is no longer maintained.
23
+
24
+ Nowadays, NodeJS and modern browsers have a native `Crypto` module. The latest version of CryptoJS already uses the native Crypto module for random number generation, since `Math.random()` is not crypto-safe. Further development of CryptoJS would result in it only being a wrapper of native Crypto. Therefore, development and maintenance has been discontinued, it is time to go for the native `crypto` module.
25
+
26
+ ## Node.js (Install)
27
+
28
+ Requirements:
29
+
30
+ - Node.js
31
+ - npm (Node.js package manager)
32
+
33
+ ```bash
34
+ npm install crypto-js
35
+ ```
36
+
37
+ ### Usage
38
+
39
+ ES6 import for typical API call signing use case:
40
+
41
+ ```javascript
42
+ import sha256 from 'crypto-js/sha256';
43
+ import hmacSHA512 from 'crypto-js/hmac-sha512';
44
+ import Base64 from 'crypto-js/enc-base64';
45
+
46
+ const message, nonce, path, privateKey; // ...
47
+ const hashDigest = sha256(nonce + message);
48
+ const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
49
+ ```
50
+
51
+ Modular include:
52
+
53
+ ```javascript
54
+ var AES = require("crypto-js/aes");
55
+ var SHA256 = require("crypto-js/sha256");
56
+ ...
57
+ console.log(SHA256("Message"));
58
+ ```
59
+
60
+ Including all libraries, for access to extra methods:
61
+
62
+ ```javascript
63
+ var CryptoJS = require("crypto-js");
64
+ console.log(CryptoJS.HmacSHA1("Message", "Key"));
65
+ ```
66
+
67
+ ## Client (browser)
68
+
69
+ Requirements:
70
+
71
+ - Node.js
72
+ - Bower (package manager for frontend)
73
+
74
+ ```bash
75
+ bower install crypto-js
76
+ ```
77
+
78
+ ### Usage
79
+
80
+ Modular include:
81
+
82
+ ```javascript
83
+ require.config({
84
+ packages: [
85
+ {
86
+ name: 'crypto-js',
87
+ location: 'path-to/bower_components/crypto-js',
88
+ main: 'index'
89
+ }
90
+ ]
91
+ });
92
+
93
+ require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) {
94
+ console.log(SHA256("Message"));
95
+ });
96
+ ```
97
+
98
+ Including all libraries, for access to extra methods:
99
+
100
+ ```javascript
101
+ // Above-mentioned will work or use this simple form
102
+ require.config({
103
+ paths: {
104
+ 'crypto-js': 'path-to/bower_components/crypto-js/crypto-js'
105
+ }
106
+ });
107
+
108
+ require(["crypto-js"], function (CryptoJS) {
109
+ console.log(CryptoJS.HmacSHA1("Message", "Key"));
110
+ });
111
+ ```
112
+
113
+ ### Usage without RequireJS
114
+
115
+ ```html
116
+ <script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script>
117
+ <script type="text/javascript">
118
+ var encrypted = CryptoJS.AES(...);
119
+ var encrypted = CryptoJS.SHA256(...);
120
+ </script>
121
+ ```
122
+
123
+ ## API
124
+
125
+ See: https://cryptojs.gitbook.io/docs/
126
+
127
+ ### AES Encryption
128
+
129
+ #### Plain text encryption
130
+
131
+ ```javascript
132
+ var CryptoJS = require("crypto-js");
133
+
134
+ // Encrypt
135
+ var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();
136
+
137
+ // Decrypt
138
+ var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
139
+ var originalText = bytes.toString(CryptoJS.enc.Utf8);
140
+
141
+ console.log(originalText); // 'my message'
142
+ ```
143
+
144
+ #### Object encryption
145
+
146
+ ```javascript
147
+ var CryptoJS = require("crypto-js");
148
+
149
+ var data = [{id: 1}, {id: 2}]
150
+
151
+ // Encrypt
152
+ var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString();
153
+
154
+ // Decrypt
155
+ var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
156
+ var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
157
+
158
+ console.log(decryptedData); // [{id: 1}, {id: 2}]
159
+ ```
160
+
161
+ ### List of modules
162
+
163
+
164
+ - ```crypto-js/core```
165
+ - ```crypto-js/x64-core```
166
+ - ```crypto-js/lib-typedarrays```
167
+
168
+ ---
169
+
170
+ - ```crypto-js/md5```
171
+ - ```crypto-js/sha1```
172
+ - ```crypto-js/sha256```
173
+ - ```crypto-js/sha224```
174
+ - ```crypto-js/sha512```
175
+ - ```crypto-js/sha384```
176
+ - ```crypto-js/sha3```
177
+ - ```crypto-js/ripemd160```
178
+
179
+ ---
180
+
181
+ - ```crypto-js/hmac-md5```
182
+ - ```crypto-js/hmac-sha1```
183
+ - ```crypto-js/hmac-sha256```
184
+ - ```crypto-js/hmac-sha224```
185
+ - ```crypto-js/hmac-sha512```
186
+ - ```crypto-js/hmac-sha384```
187
+ - ```crypto-js/hmac-sha3```
188
+ - ```crypto-js/hmac-ripemd160```
189
+
190
+ ---
191
+
192
+ - ```crypto-js/pbkdf2```
193
+
194
+ ---
195
+
196
+ - ```crypto-js/aes```
197
+ - ```crypto-js/tripledes```
198
+ - ```crypto-js/rc4```
199
+ - ```crypto-js/rabbit```
200
+ - ```crypto-js/rabbit-legacy```
201
+ - ```crypto-js/evpkdf```
202
+
203
+ ---
204
+
205
+ - ```crypto-js/format-openssl```
206
+ - ```crypto-js/format-hex```
207
+
208
+ ---
209
+
210
+ - ```crypto-js/enc-latin1```
211
+ - ```crypto-js/enc-utf8```
212
+ - ```crypto-js/enc-hex```
213
+ - ```crypto-js/enc-utf16```
214
+ - ```crypto-js/enc-base64```
215
+
216
+ ---
217
+
218
+ - ```crypto-js/mode-cfb```
219
+ - ```crypto-js/mode-ctr```
220
+ - ```crypto-js/mode-ctr-gladman```
221
+ - ```crypto-js/mode-ofb```
222
+ - ```crypto-js/mode-ecb```
223
+
224
+ ---
225
+
226
+ - ```crypto-js/pad-pkcs7```
227
+ - ```crypto-js/pad-ansix923```
228
+ - ```crypto-js/pad-iso10126```
229
+ - ```crypto-js/pad-iso97971```
230
+ - ```crypto-js/pad-zeropadding```
231
+ - ```crypto-js/pad-nopadding```
232
+
233
+
234
+ ## Release notes
235
+
236
+ ### 4.2.0
237
+
238
+ Change default hash algorithm and iteration's for PBKDF2 to prevent weak security by using the default configuration.
239
+
240
+ Custom KDF Hasher
241
+
242
+ Blowfish support
243
+
244
+ ### 4.1.1
245
+
246
+ Fix module order in bundled release.
247
+
248
+ Include the browser field in the released package.json.
249
+
250
+ ### 4.1.0
251
+
252
+ Added url safe variant of base64 encoding. [357](https://github.com/brix/crypto-js/pull/357)
253
+
254
+ Avoid webpack to add crypto-browser package. [364](https://github.com/brix/crypto-js/pull/364)
255
+
256
+ ### 4.0.0
257
+
258
+ This is an update including breaking changes for some environments.
259
+
260
+ In this version `Math.random()` has been replaced by the random methods of the native crypto module.
261
+
262
+ For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native.
263
+
264
+ ### 3.3.0
265
+
266
+ Rollback, `3.3.0` is the same as `3.1.9-1`.
267
+
268
+ The move of using native secure crypto module will be shifted to a new `4.x.x` version. As it is a breaking change the impact is too big for a minor release.
269
+
270
+ ### 3.2.1
271
+
272
+ The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved.
273
+
274
+ ### 3.2.0
275
+
276
+ In this version `Math.random()` has been replaced by the random methods of the native crypto module.
277
+
278
+ For this reason CryptoJS might does not run in some JavaScript environments without native crypto module. Such as IE 10 or before.
279
+
280
+ If it's absolute required to run CryptoJS in such an environment, stay with `3.1.x` version. Encrypting and decrypting stays compatible. But keep in mind `3.1.x` versions still use `Math.random()` which is cryptographically not secure, as it's not random enough.
281
+
282
+ This version came along with `CRITICAL` `BUG`.
283
+
284
+ DO NOT USE THIS VERSION! Please, go for a newer version!
285
+
286
+ ### 3.1.x
287
+
288
+ The `3.1.x` are based on the original CryptoJS, wrapped in CommonJS modules.
289
+
2
290
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/aes.js ADDED
@@ -0,0 +1,234 @@
1
+ ;(function (root, factory, undef) {
2
+ if (typeof exports === "object") {
3
+ // CommonJS
4
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ // AMD
8
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
9
+ }
10
+ else {
11
+ // Global (browser)
12
+ factory(root.CryptoJS);
13
+ }
14
+ }(this, function (CryptoJS) {
15
+
16
+ (function () {
17
+ // Shortcuts
18
+ var C = CryptoJS;
19
+ var C_lib = C.lib;
20
+ var BlockCipher = C_lib.BlockCipher;
21
+ var C_algo = C.algo;
22
+
23
+ // Lookup tables
24
+ var SBOX = [];
25
+ var INV_SBOX = [];
26
+ var SUB_MIX_0 = [];
27
+ var SUB_MIX_1 = [];
28
+ var SUB_MIX_2 = [];
29
+ var SUB_MIX_3 = [];
30
+ var INV_SUB_MIX_0 = [];
31
+ var INV_SUB_MIX_1 = [];
32
+ var INV_SUB_MIX_2 = [];
33
+ var INV_SUB_MIX_3 = [];
34
+
35
+ // Compute lookup tables
36
+ (function () {
37
+ // Compute double table
38
+ var d = [];
39
+ for (var i = 0; i < 256; i++) {
40
+ if (i < 128) {
41
+ d[i] = i << 1;
42
+ } else {
43
+ d[i] = (i << 1) ^ 0x11b;
44
+ }
45
+ }
46
+
47
+ // Walk GF(2^8)
48
+ var x = 0;
49
+ var xi = 0;
50
+ for (var i = 0; i < 256; i++) {
51
+ // Compute sbox
52
+ var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
53
+ sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
54
+ SBOX[x] = sx;
55
+ INV_SBOX[sx] = x;
56
+
57
+ // Compute multiplication
58
+ var x2 = d[x];
59
+ var x4 = d[x2];
60
+ var x8 = d[x4];
61
+
62
+ // Compute sub bytes, mix columns tables
63
+ var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
64
+ SUB_MIX_0[x] = (t << 24) | (t >>> 8);
65
+ SUB_MIX_1[x] = (t << 16) | (t >>> 16);
66
+ SUB_MIX_2[x] = (t << 8) | (t >>> 24);
67
+ SUB_MIX_3[x] = t;
68
+
69
+ // Compute inv sub bytes, inv mix columns tables
70
+ var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
71
+ INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
72
+ INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
73
+ INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
74
+ INV_SUB_MIX_3[sx] = t;
75
+
76
+ // Compute next counter
77
+ if (!x) {
78
+ x = xi = 1;
79
+ } else {
80
+ x = x2 ^ d[d[d[x8 ^ x2]]];
81
+ xi ^= d[d[xi]];
82
+ }
83
+ }
84
+ }());
85
+
86
+ // Precomputed Rcon lookup
87
+ var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
88
+
89
+ /**
90
+ * AES block cipher algorithm.
91
+ */
92
+ var AES = C_algo.AES = BlockCipher.extend({
93
+ _doReset: function () {
94
+ var t;
95
+
96
+ // Skip reset of nRounds has been set before and key did not change
97
+ if (this._nRounds && this._keyPriorReset === this._key) {
98
+ return;
99
+ }
100
+
101
+ // Shortcuts
102
+ var key = this._keyPriorReset = this._key;
103
+ var keyWords = key.words;
104
+ var keySize = key.sigBytes / 4;
105
+
106
+ // Compute number of rounds
107
+ var nRounds = this._nRounds = keySize + 6;
108
+
109
+ // Compute number of key schedule rows
110
+ var ksRows = (nRounds + 1) * 4;
111
+
112
+ // Compute key schedule
113
+ var keySchedule = this._keySchedule = [];
114
+ for (var ksRow = 0; ksRow < ksRows; ksRow++) {
115
+ if (ksRow < keySize) {
116
+ keySchedule[ksRow] = keyWords[ksRow];
117
+ } else {
118
+ t = keySchedule[ksRow - 1];
119
+
120
+ if (!(ksRow % keySize)) {
121
+ // Rot word
122
+ t = (t << 8) | (t >>> 24);
123
+
124
+ // Sub word
125
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
126
+
127
+ // Mix Rcon
128
+ t ^= RCON[(ksRow / keySize) | 0] << 24;
129
+ } else if (keySize > 6 && ksRow % keySize == 4) {
130
+ // Sub word
131
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
132
+ }
133
+
134
+ keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
135
+ }
136
+ }
137
+
138
+ // Compute inv key schedule
139
+ var invKeySchedule = this._invKeySchedule = [];
140
+ for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
141
+ var ksRow = ksRows - invKsRow;
142
+
143
+ if (invKsRow % 4) {
144
+ var t = keySchedule[ksRow];
145
+ } else {
146
+ var t = keySchedule[ksRow - 4];
147
+ }
148
+
149
+ if (invKsRow < 4 || ksRow <= 4) {
150
+ invKeySchedule[invKsRow] = t;
151
+ } else {
152
+ invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
153
+ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
154
+ }
155
+ }
156
+ },
157
+
158
+ encryptBlock: function (M, offset) {
159
+ this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
160
+ },
161
+
162
+ decryptBlock: function (M, offset) {
163
+ // Swap 2nd and 4th rows
164
+ var t = M[offset + 1];
165
+ M[offset + 1] = M[offset + 3];
166
+ M[offset + 3] = t;
167
+
168
+ this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
169
+
170
+ // Inv swap 2nd and 4th rows
171
+ var t = M[offset + 1];
172
+ M[offset + 1] = M[offset + 3];
173
+ M[offset + 3] = t;
174
+ },
175
+
176
+ _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
177
+ // Shortcut
178
+ var nRounds = this._nRounds;
179
+
180
+ // Get input, add round key
181
+ var s0 = M[offset] ^ keySchedule[0];
182
+ var s1 = M[offset + 1] ^ keySchedule[1];
183
+ var s2 = M[offset + 2] ^ keySchedule[2];
184
+ var s3 = M[offset + 3] ^ keySchedule[3];
185
+
186
+ // Key schedule row counter
187
+ var ksRow = 4;
188
+
189
+ // Rounds
190
+ for (var round = 1; round < nRounds; round++) {
191
+ // Shift rows, sub bytes, mix columns, add round key
192
+ var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
193
+ var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
194
+ var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
195
+ var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
196
+
197
+ // Update state
198
+ s0 = t0;
199
+ s1 = t1;
200
+ s2 = t2;
201
+ s3 = t3;
202
+ }
203
+
204
+ // Shift rows, sub bytes, add round key
205
+ var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
206
+ var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
207
+ var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
208
+ var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
209
+
210
+ // Set output
211
+ M[offset] = t0;
212
+ M[offset + 1] = t1;
213
+ M[offset + 2] = t2;
214
+ M[offset + 3] = t3;
215
+ },
216
+
217
+ keySize: 256/32
218
+ });
219
+
220
+ /**
221
+ * Shortcut functions to the cipher's object interface.
222
+ *
223
+ * @example
224
+ *
225
+ * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
226
+ * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
227
+ */
228
+ C.AES = BlockCipher._createHelper(AES);
229
+ }());
230
+
231
+
232
+ return CryptoJS.AES;
233
+
234
+ }));