拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6879 lines
217KB

  1. module.exports = (function() {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
  4. var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
  5. var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
  6. var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
  7. __DEFINE__(1679274193843, function(require, module, exports) {
  8. ;(function (root, factory, undef) {
  9. if (typeof exports === "object") {
  10. // CommonJS
  11. module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./enc-base64url"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy"));
  12. }
  13. else if (typeof define === "function" && define.amd) {
  14. // AMD
  15. define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./enc-base64url", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory);
  16. }
  17. else {
  18. // Global (browser)
  19. root.CryptoJS = factory(root.CryptoJS);
  20. }
  21. }(this, function (CryptoJS) {
  22. return CryptoJS;
  23. }));
  24. }, function(modId) {var map = {"./core":1679274193844,"./x64-core":1679274193845,"./lib-typedarrays":1679274193846,"./enc-utf16":1679274193847,"./enc-base64":1679274193848,"./enc-base64url":1679274193849,"./md5":1679274193850,"./sha1":1679274193851,"./sha256":1679274193852,"./sha224":1679274193853,"./sha512":1679274193854,"./sha384":1679274193855,"./sha3":1679274193856,"./ripemd160":1679274193857,"./hmac":1679274193858,"./pbkdf2":1679274193859,"./evpkdf":1679274193860,"./cipher-core":1679274193861,"./mode-cfb":1679274193862,"./mode-ctr":1679274193863,"./mode-ctr-gladman":1679274193864,"./mode-ofb":1679274193865,"./mode-ecb":1679274193866,"./pad-ansix923":1679274193867,"./pad-iso10126":1679274193868,"./pad-iso97971":1679274193869,"./pad-zeropadding":1679274193870,"./pad-nopadding":1679274193871,"./format-hex":1679274193872,"./aes":1679274193873,"./tripledes":1679274193874,"./rc4":1679274193875,"./rabbit":1679274193876,"./rabbit-legacy":1679274193877}; return __REQUIRE__(map[modId], modId); })
  25. __DEFINE__(1679274193844, function(require, module, exports) {
  26. ;(function (root, factory) {
  27. if (typeof exports === "object") {
  28. // CommonJS
  29. module.exports = exports = factory();
  30. }
  31. else if (typeof define === "function" && define.amd) {
  32. // AMD
  33. define([], factory);
  34. }
  35. else {
  36. // Global (browser)
  37. root.CryptoJS = factory();
  38. }
  39. }(this, function () {
  40. /*globals window, global, require*/
  41. /**
  42. * CryptoJS core components.
  43. */
  44. var CryptoJS = CryptoJS || (function (Math, undefined) {
  45. var crypto;
  46. // Native crypto from window (Browser)
  47. if (typeof window !== 'undefined' && window.crypto) {
  48. crypto = window.crypto;
  49. }
  50. // Native crypto in web worker (Browser)
  51. if (typeof self !== 'undefined' && self.crypto) {
  52. crypto = self.crypto;
  53. }
  54. // Native crypto from worker
  55. if (typeof globalThis !== 'undefined' && globalThis.crypto) {
  56. crypto = globalThis.crypto;
  57. }
  58. // Native (experimental IE 11) crypto from window (Browser)
  59. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  60. crypto = window.msCrypto;
  61. }
  62. // Native crypto from global (NodeJS)
  63. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  64. crypto = global.crypto;
  65. }
  66. // Native crypto import via require (NodeJS)
  67. if (!crypto && typeof require === 'function') {
  68. try {
  69. crypto = require('crypto');
  70. } catch (err) {}
  71. }
  72. /*
  73. * Cryptographically secure pseudorandom number generator
  74. *
  75. * As Math.random() is cryptographically not safe to use
  76. */
  77. var cryptoSecureRandomInt = function () {
  78. if (crypto) {
  79. // Use getRandomValues method (Browser)
  80. if (typeof crypto.getRandomValues === 'function') {
  81. try {
  82. return crypto.getRandomValues(new Uint32Array(1))[0];
  83. } catch (err) {}
  84. }
  85. // Use randomBytes method (NodeJS)
  86. if (typeof crypto.randomBytes === 'function') {
  87. try {
  88. return crypto.randomBytes(4).readInt32LE();
  89. } catch (err) {}
  90. }
  91. }
  92. throw new Error('Native crypto module could not be used to get secure random number.');
  93. };
  94. /*
  95. * Local polyfill of Object.create
  96. */
  97. var create = Object.create || (function () {
  98. function F() {}
  99. return function (obj) {
  100. var subtype;
  101. F.prototype = obj;
  102. subtype = new F();
  103. F.prototype = null;
  104. return subtype;
  105. };
  106. }());
  107. /**
  108. * CryptoJS namespace.
  109. */
  110. var C = {};
  111. /**
  112. * Library namespace.
  113. */
  114. var C_lib = C.lib = {};
  115. /**
  116. * Base object for prototypal inheritance.
  117. */
  118. var Base = C_lib.Base = (function () {
  119. return {
  120. /**
  121. * Creates a new object that inherits from this object.
  122. *
  123. * @param {Object} overrides Properties to copy into the new object.
  124. *
  125. * @return {Object} The new object.
  126. *
  127. * @static
  128. *
  129. * @example
  130. *
  131. * var MyType = CryptoJS.lib.Base.extend({
  132. * field: 'value',
  133. *
  134. * method: function () {
  135. * }
  136. * });
  137. */
  138. extend: function (overrides) {
  139. // Spawn
  140. var subtype = create(this);
  141. // Augment
  142. if (overrides) {
  143. subtype.mixIn(overrides);
  144. }
  145. // Create default initializer
  146. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  147. subtype.init = function () {
  148. subtype.$super.init.apply(this, arguments);
  149. };
  150. }
  151. // Initializer's prototype is the subtype object
  152. subtype.init.prototype = subtype;
  153. // Reference supertype
  154. subtype.$super = this;
  155. return subtype;
  156. },
  157. /**
  158. * Extends this object and runs the init method.
  159. * Arguments to create() will be passed to init().
  160. *
  161. * @return {Object} The new object.
  162. *
  163. * @static
  164. *
  165. * @example
  166. *
  167. * var instance = MyType.create();
  168. */
  169. create: function () {
  170. var instance = this.extend();
  171. instance.init.apply(instance, arguments);
  172. return instance;
  173. },
  174. /**
  175. * Initializes a newly created object.
  176. * Override this method to add some logic when your objects are created.
  177. *
  178. * @example
  179. *
  180. * var MyType = CryptoJS.lib.Base.extend({
  181. * init: function () {
  182. * // ...
  183. * }
  184. * });
  185. */
  186. init: function () {
  187. },
  188. /**
  189. * Copies properties into this object.
  190. *
  191. * @param {Object} properties The properties to mix in.
  192. *
  193. * @example
  194. *
  195. * MyType.mixIn({
  196. * field: 'value'
  197. * });
  198. */
  199. mixIn: function (properties) {
  200. for (var propertyName in properties) {
  201. if (properties.hasOwnProperty(propertyName)) {
  202. this[propertyName] = properties[propertyName];
  203. }
  204. }
  205. // IE won't copy toString using the loop above
  206. if (properties.hasOwnProperty('toString')) {
  207. this.toString = properties.toString;
  208. }
  209. },
  210. /**
  211. * Creates a copy of this object.
  212. *
  213. * @return {Object} The clone.
  214. *
  215. * @example
  216. *
  217. * var clone = instance.clone();
  218. */
  219. clone: function () {
  220. return this.init.prototype.extend(this);
  221. }
  222. };
  223. }());
  224. /**
  225. * An array of 32-bit words.
  226. *
  227. * @property {Array} words The array of 32-bit words.
  228. * @property {number} sigBytes The number of significant bytes in this word array.
  229. */
  230. var WordArray = C_lib.WordArray = Base.extend({
  231. /**
  232. * Initializes a newly created word array.
  233. *
  234. * @param {Array} words (Optional) An array of 32-bit words.
  235. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  236. *
  237. * @example
  238. *
  239. * var wordArray = CryptoJS.lib.WordArray.create();
  240. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  241. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  242. */
  243. init: function (words, sigBytes) {
  244. words = this.words = words || [];
  245. if (sigBytes != undefined) {
  246. this.sigBytes = sigBytes;
  247. } else {
  248. this.sigBytes = words.length * 4;
  249. }
  250. },
  251. /**
  252. * Converts this word array to a string.
  253. *
  254. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  255. *
  256. * @return {string} The stringified word array.
  257. *
  258. * @example
  259. *
  260. * var string = wordArray + '';
  261. * var string = wordArray.toString();
  262. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  263. */
  264. toString: function (encoder) {
  265. return (encoder || Hex).stringify(this);
  266. },
  267. /**
  268. * Concatenates a word array to this word array.
  269. *
  270. * @param {WordArray} wordArray The word array to append.
  271. *
  272. * @return {WordArray} This word array.
  273. *
  274. * @example
  275. *
  276. * wordArray1.concat(wordArray2);
  277. */
  278. concat: function (wordArray) {
  279. // Shortcuts
  280. var thisWords = this.words;
  281. var thatWords = wordArray.words;
  282. var thisSigBytes = this.sigBytes;
  283. var thatSigBytes = wordArray.sigBytes;
  284. // Clamp excess bits
  285. this.clamp();
  286. // Concat
  287. if (thisSigBytes % 4) {
  288. // Copy one byte at a time
  289. for (var i = 0; i < thatSigBytes; i++) {
  290. var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  291. thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  292. }
  293. } else {
  294. // Copy one word at a time
  295. for (var j = 0; j < thatSigBytes; j += 4) {
  296. thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
  297. }
  298. }
  299. this.sigBytes += thatSigBytes;
  300. // Chainable
  301. return this;
  302. },
  303. /**
  304. * Removes insignificant bits.
  305. *
  306. * @example
  307. *
  308. * wordArray.clamp();
  309. */
  310. clamp: function () {
  311. // Shortcuts
  312. var words = this.words;
  313. var sigBytes = this.sigBytes;
  314. // Clamp
  315. words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
  316. words.length = Math.ceil(sigBytes / 4);
  317. },
  318. /**
  319. * Creates a copy of this word array.
  320. *
  321. * @return {WordArray} The clone.
  322. *
  323. * @example
  324. *
  325. * var clone = wordArray.clone();
  326. */
  327. clone: function () {
  328. var clone = Base.clone.call(this);
  329. clone.words = this.words.slice(0);
  330. return clone;
  331. },
  332. /**
  333. * Creates a word array filled with random bytes.
  334. *
  335. * @param {number} nBytes The number of random bytes to generate.
  336. *
  337. * @return {WordArray} The random word array.
  338. *
  339. * @static
  340. *
  341. * @example
  342. *
  343. * var wordArray = CryptoJS.lib.WordArray.random(16);
  344. */
  345. random: function (nBytes) {
  346. var words = [];
  347. for (var i = 0; i < nBytes; i += 4) {
  348. words.push(cryptoSecureRandomInt());
  349. }
  350. return new WordArray.init(words, nBytes);
  351. }
  352. });
  353. /**
  354. * Encoder namespace.
  355. */
  356. var C_enc = C.enc = {};
  357. /**
  358. * Hex encoding strategy.
  359. */
  360. var Hex = C_enc.Hex = {
  361. /**
  362. * Converts a word array to a hex string.
  363. *
  364. * @param {WordArray} wordArray The word array.
  365. *
  366. * @return {string} The hex string.
  367. *
  368. * @static
  369. *
  370. * @example
  371. *
  372. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  373. */
  374. stringify: function (wordArray) {
  375. // Shortcuts
  376. var words = wordArray.words;
  377. var sigBytes = wordArray.sigBytes;
  378. // Convert
  379. var hexChars = [];
  380. for (var i = 0; i < sigBytes; i++) {
  381. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  382. hexChars.push((bite >>> 4).toString(16));
  383. hexChars.push((bite & 0x0f).toString(16));
  384. }
  385. return hexChars.join('');
  386. },
  387. /**
  388. * Converts a hex string to a word array.
  389. *
  390. * @param {string} hexStr The hex string.
  391. *
  392. * @return {WordArray} The word array.
  393. *
  394. * @static
  395. *
  396. * @example
  397. *
  398. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  399. */
  400. parse: function (hexStr) {
  401. // Shortcut
  402. var hexStrLength = hexStr.length;
  403. // Convert
  404. var words = [];
  405. for (var i = 0; i < hexStrLength; i += 2) {
  406. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  407. }
  408. return new WordArray.init(words, hexStrLength / 2);
  409. }
  410. };
  411. /**
  412. * Latin1 encoding strategy.
  413. */
  414. var Latin1 = C_enc.Latin1 = {
  415. /**
  416. * Converts a word array to a Latin1 string.
  417. *
  418. * @param {WordArray} wordArray The word array.
  419. *
  420. * @return {string} The Latin1 string.
  421. *
  422. * @static
  423. *
  424. * @example
  425. *
  426. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  427. */
  428. stringify: function (wordArray) {
  429. // Shortcuts
  430. var words = wordArray.words;
  431. var sigBytes = wordArray.sigBytes;
  432. // Convert
  433. var latin1Chars = [];
  434. for (var i = 0; i < sigBytes; i++) {
  435. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  436. latin1Chars.push(String.fromCharCode(bite));
  437. }
  438. return latin1Chars.join('');
  439. },
  440. /**
  441. * Converts a Latin1 string to a word array.
  442. *
  443. * @param {string} latin1Str The Latin1 string.
  444. *
  445. * @return {WordArray} The word array.
  446. *
  447. * @static
  448. *
  449. * @example
  450. *
  451. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  452. */
  453. parse: function (latin1Str) {
  454. // Shortcut
  455. var latin1StrLength = latin1Str.length;
  456. // Convert
  457. var words = [];
  458. for (var i = 0; i < latin1StrLength; i++) {
  459. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  460. }
  461. return new WordArray.init(words, latin1StrLength);
  462. }
  463. };
  464. /**
  465. * UTF-8 encoding strategy.
  466. */
  467. var Utf8 = C_enc.Utf8 = {
  468. /**
  469. * Converts a word array to a UTF-8 string.
  470. *
  471. * @param {WordArray} wordArray The word array.
  472. *
  473. * @return {string} The UTF-8 string.
  474. *
  475. * @static
  476. *
  477. * @example
  478. *
  479. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  480. */
  481. stringify: function (wordArray) {
  482. try {
  483. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  484. } catch (e) {
  485. throw new Error('Malformed UTF-8 data');
  486. }
  487. },
  488. /**
  489. * Converts a UTF-8 string to a word array.
  490. *
  491. * @param {string} utf8Str The UTF-8 string.
  492. *
  493. * @return {WordArray} The word array.
  494. *
  495. * @static
  496. *
  497. * @example
  498. *
  499. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  500. */
  501. parse: function (utf8Str) {
  502. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  503. }
  504. };
  505. /**
  506. * Abstract buffered block algorithm template.
  507. *
  508. * The property blockSize must be implemented in a concrete subtype.
  509. *
  510. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  511. */
  512. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  513. /**
  514. * Resets this block algorithm's data buffer to its initial state.
  515. *
  516. * @example
  517. *
  518. * bufferedBlockAlgorithm.reset();
  519. */
  520. reset: function () {
  521. // Initial values
  522. this._data = new WordArray.init();
  523. this._nDataBytes = 0;
  524. },
  525. /**
  526. * Adds new data to this block algorithm's buffer.
  527. *
  528. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  529. *
  530. * @example
  531. *
  532. * bufferedBlockAlgorithm._append('data');
  533. * bufferedBlockAlgorithm._append(wordArray);
  534. */
  535. _append: function (data) {
  536. // Convert string to WordArray, else assume WordArray already
  537. if (typeof data == 'string') {
  538. data = Utf8.parse(data);
  539. }
  540. // Append
  541. this._data.concat(data);
  542. this._nDataBytes += data.sigBytes;
  543. },
  544. /**
  545. * Processes available data blocks.
  546. *
  547. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  548. *
  549. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  550. *
  551. * @return {WordArray} The processed data.
  552. *
  553. * @example
  554. *
  555. * var processedData = bufferedBlockAlgorithm._process();
  556. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  557. */
  558. _process: function (doFlush) {
  559. var processedWords;
  560. // Shortcuts
  561. var data = this._data;
  562. var dataWords = data.words;
  563. var dataSigBytes = data.sigBytes;
  564. var blockSize = this.blockSize;
  565. var blockSizeBytes = blockSize * 4;
  566. // Count blocks ready
  567. var nBlocksReady = dataSigBytes / blockSizeBytes;
  568. if (doFlush) {
  569. // Round up to include partial blocks
  570. nBlocksReady = Math.ceil(nBlocksReady);
  571. } else {
  572. // Round down to include only full blocks,
  573. // less the number of blocks that must remain in the buffer
  574. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  575. }
  576. // Count words ready
  577. var nWordsReady = nBlocksReady * blockSize;
  578. // Count bytes ready
  579. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  580. // Process blocks
  581. if (nWordsReady) {
  582. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  583. // Perform concrete-algorithm logic
  584. this._doProcessBlock(dataWords, offset);
  585. }
  586. // Remove processed words
  587. processedWords = dataWords.splice(0, nWordsReady);
  588. data.sigBytes -= nBytesReady;
  589. }
  590. // Return processed words
  591. return new WordArray.init(processedWords, nBytesReady);
  592. },
  593. /**
  594. * Creates a copy of this object.
  595. *
  596. * @return {Object} The clone.
  597. *
  598. * @example
  599. *
  600. * var clone = bufferedBlockAlgorithm.clone();
  601. */
  602. clone: function () {
  603. var clone = Base.clone.call(this);
  604. clone._data = this._data.clone();
  605. return clone;
  606. },
  607. _minBufferSize: 0
  608. });
  609. /**
  610. * Abstract hasher template.
  611. *
  612. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  613. */
  614. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  615. /**
  616. * Configuration options.
  617. */
  618. cfg: Base.extend(),
  619. /**
  620. * Initializes a newly created hasher.
  621. *
  622. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  623. *
  624. * @example
  625. *
  626. * var hasher = CryptoJS.algo.SHA256.create();
  627. */
  628. init: function (cfg) {
  629. // Apply config defaults
  630. this.cfg = this.cfg.extend(cfg);
  631. // Set initial values
  632. this.reset();
  633. },
  634. /**
  635. * Resets this hasher to its initial state.
  636. *
  637. * @example
  638. *
  639. * hasher.reset();
  640. */
  641. reset: function () {
  642. // Reset data buffer
  643. BufferedBlockAlgorithm.reset.call(this);
  644. // Perform concrete-hasher logic
  645. this._doReset();
  646. },
  647. /**
  648. * Updates this hasher with a message.
  649. *
  650. * @param {WordArray|string} messageUpdate The message to append.
  651. *
  652. * @return {Hasher} This hasher.
  653. *
  654. * @example
  655. *
  656. * hasher.update('message');
  657. * hasher.update(wordArray);
  658. */
  659. update: function (messageUpdate) {
  660. // Append
  661. this._append(messageUpdate);
  662. // Update the hash
  663. this._process();
  664. // Chainable
  665. return this;
  666. },
  667. /**
  668. * Finalizes the hash computation.
  669. * Note that the finalize operation is effectively a destructive, read-once operation.
  670. *
  671. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  672. *
  673. * @return {WordArray} The hash.
  674. *
  675. * @example
  676. *
  677. * var hash = hasher.finalize();
  678. * var hash = hasher.finalize('message');
  679. * var hash = hasher.finalize(wordArray);
  680. */
  681. finalize: function (messageUpdate) {
  682. // Final message update
  683. if (messageUpdate) {
  684. this._append(messageUpdate);
  685. }
  686. // Perform concrete-hasher logic
  687. var hash = this._doFinalize();
  688. return hash;
  689. },
  690. blockSize: 512/32,
  691. /**
  692. * Creates a shortcut function to a hasher's object interface.
  693. *
  694. * @param {Hasher} hasher The hasher to create a helper for.
  695. *
  696. * @return {Function} The shortcut function.
  697. *
  698. * @static
  699. *
  700. * @example
  701. *
  702. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  703. */
  704. _createHelper: function (hasher) {
  705. return function (message, cfg) {
  706. return new hasher.init(cfg).finalize(message);
  707. };
  708. },
  709. /**
  710. * Creates a shortcut function to the HMAC's object interface.
  711. *
  712. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  713. *
  714. * @return {Function} The shortcut function.
  715. *
  716. * @static
  717. *
  718. * @example
  719. *
  720. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  721. */
  722. _createHmacHelper: function (hasher) {
  723. return function (message, key) {
  724. return new C_algo.HMAC.init(hasher, key).finalize(message);
  725. };
  726. }
  727. });
  728. /**
  729. * Algorithm namespace.
  730. */
  731. var C_algo = C.algo = {};
  732. return C;
  733. }(Math));
  734. return CryptoJS;
  735. }));
  736. }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
  737. __DEFINE__(1679274193845, function(require, module, exports) {
  738. ;(function (root, factory) {
  739. if (typeof exports === "object") {
  740. // CommonJS
  741. module.exports = exports = factory(require("./core"));
  742. }
  743. else if (typeof define === "function" && define.amd) {
  744. // AMD
  745. define(["./core"], factory);
  746. }
  747. else {
  748. // Global (browser)
  749. factory(root.CryptoJS);
  750. }
  751. }(this, function (CryptoJS) {
  752. (function (undefined) {
  753. // Shortcuts
  754. var C = CryptoJS;
  755. var C_lib = C.lib;
  756. var Base = C_lib.Base;
  757. var X32WordArray = C_lib.WordArray;
  758. /**
  759. * x64 namespace.
  760. */
  761. var C_x64 = C.x64 = {};
  762. /**
  763. * A 64-bit word.
  764. */
  765. var X64Word = C_x64.Word = Base.extend({
  766. /**
  767. * Initializes a newly created 64-bit word.
  768. *
  769. * @param {number} high The high 32 bits.
  770. * @param {number} low The low 32 bits.
  771. *
  772. * @example
  773. *
  774. * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
  775. */
  776. init: function (high, low) {
  777. this.high = high;
  778. this.low = low;
  779. }
  780. /**
  781. * Bitwise NOTs this word.
  782. *
  783. * @return {X64Word} A new x64-Word object after negating.
  784. *
  785. * @example
  786. *
  787. * var negated = x64Word.not();
  788. */
  789. // not: function () {
  790. // var high = ~this.high;
  791. // var low = ~this.low;
  792. // return X64Word.create(high, low);
  793. // },
  794. /**
  795. * Bitwise ANDs this word with the passed word.
  796. *
  797. * @param {X64Word} word The x64-Word to AND with this word.
  798. *
  799. * @return {X64Word} A new x64-Word object after ANDing.
  800. *
  801. * @example
  802. *
  803. * var anded = x64Word.and(anotherX64Word);
  804. */
  805. // and: function (word) {
  806. // var high = this.high & word.high;
  807. // var low = this.low & word.low;
  808. // return X64Word.create(high, low);
  809. // },
  810. /**
  811. * Bitwise ORs this word with the passed word.
  812. *
  813. * @param {X64Word} word The x64-Word to OR with this word.
  814. *
  815. * @return {X64Word} A new x64-Word object after ORing.
  816. *
  817. * @example
  818. *
  819. * var ored = x64Word.or(anotherX64Word);
  820. */
  821. // or: function (word) {
  822. // var high = this.high | word.high;
  823. // var low = this.low | word.low;
  824. // return X64Word.create(high, low);
  825. // },
  826. /**
  827. * Bitwise XORs this word with the passed word.
  828. *
  829. * @param {X64Word} word The x64-Word to XOR with this word.
  830. *
  831. * @return {X64Word} A new x64-Word object after XORing.
  832. *
  833. * @example
  834. *
  835. * var xored = x64Word.xor(anotherX64Word);
  836. */
  837. // xor: function (word) {
  838. // var high = this.high ^ word.high;
  839. // var low = this.low ^ word.low;
  840. // return X64Word.create(high, low);
  841. // },
  842. /**
  843. * Shifts this word n bits to the left.
  844. *
  845. * @param {number} n The number of bits to shift.
  846. *
  847. * @return {X64Word} A new x64-Word object after shifting.
  848. *
  849. * @example
  850. *
  851. * var shifted = x64Word.shiftL(25);
  852. */
  853. // shiftL: function (n) {
  854. // if (n < 32) {
  855. // var high = (this.high << n) | (this.low >>> (32 - n));
  856. // var low = this.low << n;
  857. // } else {
  858. // var high = this.low << (n - 32);
  859. // var low = 0;
  860. // }
  861. // return X64Word.create(high, low);
  862. // },
  863. /**
  864. * Shifts this word n bits to the right.
  865. *
  866. * @param {number} n The number of bits to shift.
  867. *
  868. * @return {X64Word} A new x64-Word object after shifting.
  869. *
  870. * @example
  871. *
  872. * var shifted = x64Word.shiftR(7);
  873. */
  874. // shiftR: function (n) {
  875. // if (n < 32) {
  876. // var low = (this.low >>> n) | (this.high << (32 - n));
  877. // var high = this.high >>> n;
  878. // } else {
  879. // var low = this.high >>> (n - 32);
  880. // var high = 0;
  881. // }
  882. // return X64Word.create(high, low);
  883. // },
  884. /**
  885. * Rotates this word n bits to the left.
  886. *
  887. * @param {number} n The number of bits to rotate.
  888. *
  889. * @return {X64Word} A new x64-Word object after rotating.
  890. *
  891. * @example
  892. *
  893. * var rotated = x64Word.rotL(25);
  894. */
  895. // rotL: function (n) {
  896. // return this.shiftL(n).or(this.shiftR(64 - n));
  897. // },
  898. /**
  899. * Rotates this word n bits to the right.
  900. *
  901. * @param {number} n The number of bits to rotate.
  902. *
  903. * @return {X64Word} A new x64-Word object after rotating.
  904. *
  905. * @example
  906. *
  907. * var rotated = x64Word.rotR(7);
  908. */
  909. // rotR: function (n) {
  910. // return this.shiftR(n).or(this.shiftL(64 - n));
  911. // },
  912. /**
  913. * Adds this word with the passed word.
  914. *
  915. * @param {X64Word} word The x64-Word to add with this word.
  916. *
  917. * @return {X64Word} A new x64-Word object after adding.
  918. *
  919. * @example
  920. *
  921. * var added = x64Word.add(anotherX64Word);
  922. */
  923. // add: function (word) {
  924. // var low = (this.low + word.low) | 0;
  925. // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
  926. // var high = (this.high + word.high + carry) | 0;
  927. // return X64Word.create(high, low);
  928. // }
  929. });
  930. /**
  931. * An array of 64-bit words.
  932. *
  933. * @property {Array} words The array of CryptoJS.x64.Word objects.
  934. * @property {number} sigBytes The number of significant bytes in this word array.
  935. */
  936. var X64WordArray = C_x64.WordArray = Base.extend({
  937. /**
  938. * Initializes a newly created word array.
  939. *
  940. * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
  941. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  942. *
  943. * @example
  944. *
  945. * var wordArray = CryptoJS.x64.WordArray.create();
  946. *
  947. * var wordArray = CryptoJS.x64.WordArray.create([
  948. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  949. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  950. * ]);
  951. *
  952. * var wordArray = CryptoJS.x64.WordArray.create([
  953. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  954. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  955. * ], 10);
  956. */
  957. init: function (words, sigBytes) {
  958. words = this.words = words || [];
  959. if (sigBytes != undefined) {
  960. this.sigBytes = sigBytes;
  961. } else {
  962. this.sigBytes = words.length * 8;
  963. }
  964. },
  965. /**
  966. * Converts this 64-bit word array to a 32-bit word array.
  967. *
  968. * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
  969. *
  970. * @example
  971. *
  972. * var x32WordArray = x64WordArray.toX32();
  973. */
  974. toX32: function () {
  975. // Shortcuts
  976. var x64Words = this.words;
  977. var x64WordsLength = x64Words.length;
  978. // Convert
  979. var x32Words = [];
  980. for (var i = 0; i < x64WordsLength; i++) {
  981. var x64Word = x64Words[i];
  982. x32Words.push(x64Word.high);
  983. x32Words.push(x64Word.low);
  984. }
  985. return X32WordArray.create(x32Words, this.sigBytes);
  986. },
  987. /**
  988. * Creates a copy of this word array.
  989. *
  990. * @return {X64WordArray} The clone.
  991. *
  992. * @example
  993. *
  994. * var clone = x64WordArray.clone();
  995. */
  996. clone: function () {
  997. var clone = Base.clone.call(this);
  998. // Clone "words" array
  999. var words = clone.words = this.words.slice(0);
  1000. // Clone each X64Word object
  1001. var wordsLength = words.length;
  1002. for (var i = 0; i < wordsLength; i++) {
  1003. words[i] = words[i].clone();
  1004. }
  1005. return clone;
  1006. }
  1007. });
  1008. }());
  1009. return CryptoJS;
  1010. }));
  1011. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1012. __DEFINE__(1679274193846, function(require, module, exports) {
  1013. ;(function (root, factory) {
  1014. if (typeof exports === "object") {
  1015. // CommonJS
  1016. module.exports = exports = factory(require("./core"));
  1017. }
  1018. else if (typeof define === "function" && define.amd) {
  1019. // AMD
  1020. define(["./core"], factory);
  1021. }
  1022. else {
  1023. // Global (browser)
  1024. factory(root.CryptoJS);
  1025. }
  1026. }(this, function (CryptoJS) {
  1027. (function () {
  1028. // Check if typed arrays are supported
  1029. if (typeof ArrayBuffer != 'function') {
  1030. return;
  1031. }
  1032. // Shortcuts
  1033. var C = CryptoJS;
  1034. var C_lib = C.lib;
  1035. var WordArray = C_lib.WordArray;
  1036. // Reference original init
  1037. var superInit = WordArray.init;
  1038. // Augment WordArray.init to handle typed arrays
  1039. var subInit = WordArray.init = function (typedArray) {
  1040. // Convert buffers to uint8
  1041. if (typedArray instanceof ArrayBuffer) {
  1042. typedArray = new Uint8Array(typedArray);
  1043. }
  1044. // Convert other array views to uint8
  1045. if (
  1046. typedArray instanceof Int8Array ||
  1047. (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
  1048. typedArray instanceof Int16Array ||
  1049. typedArray instanceof Uint16Array ||
  1050. typedArray instanceof Int32Array ||
  1051. typedArray instanceof Uint32Array ||
  1052. typedArray instanceof Float32Array ||
  1053. typedArray instanceof Float64Array
  1054. ) {
  1055. typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
  1056. }
  1057. // Handle Uint8Array
  1058. if (typedArray instanceof Uint8Array) {
  1059. // Shortcut
  1060. var typedArrayByteLength = typedArray.byteLength;
  1061. // Extract bytes
  1062. var words = [];
  1063. for (var i = 0; i < typedArrayByteLength; i++) {
  1064. words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
  1065. }
  1066. // Initialize this word array
  1067. superInit.call(this, words, typedArrayByteLength);
  1068. } else {
  1069. // Else call normal init
  1070. superInit.apply(this, arguments);
  1071. }
  1072. };
  1073. subInit.prototype = WordArray;
  1074. }());
  1075. return CryptoJS.lib.WordArray;
  1076. }));
  1077. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1078. __DEFINE__(1679274193847, function(require, module, exports) {
  1079. ;(function (root, factory) {
  1080. if (typeof exports === "object") {
  1081. // CommonJS
  1082. module.exports = exports = factory(require("./core"));
  1083. }
  1084. else if (typeof define === "function" && define.amd) {
  1085. // AMD
  1086. define(["./core"], factory);
  1087. }
  1088. else {
  1089. // Global (browser)
  1090. factory(root.CryptoJS);
  1091. }
  1092. }(this, function (CryptoJS) {
  1093. (function () {
  1094. // Shortcuts
  1095. var C = CryptoJS;
  1096. var C_lib = C.lib;
  1097. var WordArray = C_lib.WordArray;
  1098. var C_enc = C.enc;
  1099. /**
  1100. * UTF-16 BE encoding strategy.
  1101. */
  1102. var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
  1103. /**
  1104. * Converts a word array to a UTF-16 BE string.
  1105. *
  1106. * @param {WordArray} wordArray The word array.
  1107. *
  1108. * @return {string} The UTF-16 BE string.
  1109. *
  1110. * @static
  1111. *
  1112. * @example
  1113. *
  1114. * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  1115. */
  1116. stringify: function (wordArray) {
  1117. // Shortcuts
  1118. var words = wordArray.words;
  1119. var sigBytes = wordArray.sigBytes;
  1120. // Convert
  1121. var utf16Chars = [];
  1122. for (var i = 0; i < sigBytes; i += 2) {
  1123. var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
  1124. utf16Chars.push(String.fromCharCode(codePoint));
  1125. }
  1126. return utf16Chars.join('');
  1127. },
  1128. /**
  1129. * Converts a UTF-16 BE string to a word array.
  1130. *
  1131. * @param {string} utf16Str The UTF-16 BE string.
  1132. *
  1133. * @return {WordArray} The word array.
  1134. *
  1135. * @static
  1136. *
  1137. * @example
  1138. *
  1139. * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  1140. */
  1141. parse: function (utf16Str) {
  1142. // Shortcut
  1143. var utf16StrLength = utf16Str.length;
  1144. // Convert
  1145. var words = [];
  1146. for (var i = 0; i < utf16StrLength; i++) {
  1147. words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
  1148. }
  1149. return WordArray.create(words, utf16StrLength * 2);
  1150. }
  1151. };
  1152. /**
  1153. * UTF-16 LE encoding strategy.
  1154. */
  1155. C_enc.Utf16LE = {
  1156. /**
  1157. * Converts a word array to a UTF-16 LE string.
  1158. *
  1159. * @param {WordArray} wordArray The word array.
  1160. *
  1161. * @return {string} The UTF-16 LE string.
  1162. *
  1163. * @static
  1164. *
  1165. * @example
  1166. *
  1167. * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  1168. */
  1169. stringify: function (wordArray) {
  1170. // Shortcuts
  1171. var words = wordArray.words;
  1172. var sigBytes = wordArray.sigBytes;
  1173. // Convert
  1174. var utf16Chars = [];
  1175. for (var i = 0; i < sigBytes; i += 2) {
  1176. var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
  1177. utf16Chars.push(String.fromCharCode(codePoint));
  1178. }
  1179. return utf16Chars.join('');
  1180. },
  1181. /**
  1182. * Converts a UTF-16 LE string to a word array.
  1183. *
  1184. * @param {string} utf16Str The UTF-16 LE string.
  1185. *
  1186. * @return {WordArray} The word array.
  1187. *
  1188. * @static
  1189. *
  1190. * @example
  1191. *
  1192. * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  1193. */
  1194. parse: function (utf16Str) {
  1195. // Shortcut
  1196. var utf16StrLength = utf16Str.length;
  1197. // Convert
  1198. var words = [];
  1199. for (var i = 0; i < utf16StrLength; i++) {
  1200. words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
  1201. }
  1202. return WordArray.create(words, utf16StrLength * 2);
  1203. }
  1204. };
  1205. function swapEndian(word) {
  1206. return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
  1207. }
  1208. }());
  1209. return CryptoJS.enc.Utf16;
  1210. }));
  1211. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1212. __DEFINE__(1679274193848, function(require, module, exports) {
  1213. ;(function (root, factory) {
  1214. if (typeof exports === "object") {
  1215. // CommonJS
  1216. module.exports = exports = factory(require("./core"));
  1217. }
  1218. else if (typeof define === "function" && define.amd) {
  1219. // AMD
  1220. define(["./core"], factory);
  1221. }
  1222. else {
  1223. // Global (browser)
  1224. factory(root.CryptoJS);
  1225. }
  1226. }(this, function (CryptoJS) {
  1227. (function () {
  1228. // Shortcuts
  1229. var C = CryptoJS;
  1230. var C_lib = C.lib;
  1231. var WordArray = C_lib.WordArray;
  1232. var C_enc = C.enc;
  1233. /**
  1234. * Base64 encoding strategy.
  1235. */
  1236. var Base64 = C_enc.Base64 = {
  1237. /**
  1238. * Converts a word array to a Base64 string.
  1239. *
  1240. * @param {WordArray} wordArray The word array.
  1241. *
  1242. * @return {string} The Base64 string.
  1243. *
  1244. * @static
  1245. *
  1246. * @example
  1247. *
  1248. * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  1249. */
  1250. stringify: function (wordArray) {
  1251. // Shortcuts
  1252. var words = wordArray.words;
  1253. var sigBytes = wordArray.sigBytes;
  1254. var map = this._map;
  1255. // Clamp excess bits
  1256. wordArray.clamp();
  1257. // Convert
  1258. var base64Chars = [];
  1259. for (var i = 0; i < sigBytes; i += 3) {
  1260. var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  1261. var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  1262. var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  1263. var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  1264. for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  1265. base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  1266. }
  1267. }
  1268. // Add padding
  1269. var paddingChar = map.charAt(64);
  1270. if (paddingChar) {
  1271. while (base64Chars.length % 4) {
  1272. base64Chars.push(paddingChar);
  1273. }
  1274. }
  1275. return base64Chars.join('');
  1276. },
  1277. /**
  1278. * Converts a Base64 string to a word array.
  1279. *
  1280. * @param {string} base64Str The Base64 string.
  1281. *
  1282. * @return {WordArray} The word array.
  1283. *
  1284. * @static
  1285. *
  1286. * @example
  1287. *
  1288. * var wordArray = CryptoJS.enc.Base64.parse(base64String);
  1289. */
  1290. parse: function (base64Str) {
  1291. // Shortcuts
  1292. var base64StrLength = base64Str.length;
  1293. var map = this._map;
  1294. var reverseMap = this._reverseMap;
  1295. if (!reverseMap) {
  1296. reverseMap = this._reverseMap = [];
  1297. for (var j = 0; j < map.length; j++) {
  1298. reverseMap[map.charCodeAt(j)] = j;
  1299. }
  1300. }
  1301. // Ignore padding
  1302. var paddingChar = map.charAt(64);
  1303. if (paddingChar) {
  1304. var paddingIndex = base64Str.indexOf(paddingChar);
  1305. if (paddingIndex !== -1) {
  1306. base64StrLength = paddingIndex;
  1307. }
  1308. }
  1309. // Convert
  1310. return parseLoop(base64Str, base64StrLength, reverseMap);
  1311. },
  1312. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  1313. };
  1314. function parseLoop(base64Str, base64StrLength, reverseMap) {
  1315. var words = [];
  1316. var nBytes = 0;
  1317. for (var i = 0; i < base64StrLength; i++) {
  1318. if (i % 4) {
  1319. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  1320. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  1321. var bitsCombined = bits1 | bits2;
  1322. words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
  1323. nBytes++;
  1324. }
  1325. }
  1326. return WordArray.create(words, nBytes);
  1327. }
  1328. }());
  1329. return CryptoJS.enc.Base64;
  1330. }));
  1331. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1332. __DEFINE__(1679274193849, function(require, module, exports) {
  1333. ;(function (root, factory) {
  1334. if (typeof exports === "object") {
  1335. // CommonJS
  1336. module.exports = exports = factory(require("./core"));
  1337. }
  1338. else if (typeof define === "function" && define.amd) {
  1339. // AMD
  1340. define(["./core"], factory);
  1341. }
  1342. else {
  1343. // Global (browser)
  1344. factory(root.CryptoJS);
  1345. }
  1346. }(this, function (CryptoJS) {
  1347. (function () {
  1348. // Shortcuts
  1349. var C = CryptoJS;
  1350. var C_lib = C.lib;
  1351. var WordArray = C_lib.WordArray;
  1352. var C_enc = C.enc;
  1353. /**
  1354. * Base64url encoding strategy.
  1355. */
  1356. var Base64url = C_enc.Base64url = {
  1357. /**
  1358. * Converts a word array to a Base64url string.
  1359. *
  1360. * @param {WordArray} wordArray The word array.
  1361. *
  1362. * @param {boolean} urlSafe Whether to use url safe
  1363. *
  1364. * @return {string} The Base64url string.
  1365. *
  1366. * @static
  1367. *
  1368. * @example
  1369. *
  1370. * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
  1371. */
  1372. stringify: function (wordArray, urlSafe=true) {
  1373. // Shortcuts
  1374. var words = wordArray.words;
  1375. var sigBytes = wordArray.sigBytes;
  1376. var map = urlSafe ? this._safe_map : this._map;
  1377. // Clamp excess bits
  1378. wordArray.clamp();
  1379. // Convert
  1380. var base64Chars = [];
  1381. for (var i = 0; i < sigBytes; i += 3) {
  1382. var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  1383. var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  1384. var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  1385. var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  1386. for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  1387. base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  1388. }
  1389. }
  1390. // Add padding
  1391. var paddingChar = map.charAt(64);
  1392. if (paddingChar) {
  1393. while (base64Chars.length % 4) {
  1394. base64Chars.push(paddingChar);
  1395. }
  1396. }
  1397. return base64Chars.join('');
  1398. },
  1399. /**
  1400. * Converts a Base64url string to a word array.
  1401. *
  1402. * @param {string} base64Str The Base64url string.
  1403. *
  1404. * @param {boolean} urlSafe Whether to use url safe
  1405. *
  1406. * @return {WordArray} The word array.
  1407. *
  1408. * @static
  1409. *
  1410. * @example
  1411. *
  1412. * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
  1413. */
  1414. parse: function (base64Str, urlSafe=true) {
  1415. // Shortcuts
  1416. var base64StrLength = base64Str.length;
  1417. var map = urlSafe ? this._safe_map : this._map;
  1418. var reverseMap = this._reverseMap;
  1419. if (!reverseMap) {
  1420. reverseMap = this._reverseMap = [];
  1421. for (var j = 0; j < map.length; j++) {
  1422. reverseMap[map.charCodeAt(j)] = j;
  1423. }
  1424. }
  1425. // Ignore padding
  1426. var paddingChar = map.charAt(64);
  1427. if (paddingChar) {
  1428. var paddingIndex = base64Str.indexOf(paddingChar);
  1429. if (paddingIndex !== -1) {
  1430. base64StrLength = paddingIndex;
  1431. }
  1432. }
  1433. // Convert
  1434. return parseLoop(base64Str, base64StrLength, reverseMap);
  1435. },
  1436. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
  1437. _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
  1438. };
  1439. function parseLoop(base64Str, base64StrLength, reverseMap) {
  1440. var words = [];
  1441. var nBytes = 0;
  1442. for (var i = 0; i < base64StrLength; i++) {
  1443. if (i % 4) {
  1444. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  1445. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  1446. var bitsCombined = bits1 | bits2;
  1447. words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
  1448. nBytes++;
  1449. }
  1450. }
  1451. return WordArray.create(words, nBytes);
  1452. }
  1453. }());
  1454. return CryptoJS.enc.Base64url;
  1455. }));
  1456. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1457. __DEFINE__(1679274193850, function(require, module, exports) {
  1458. ;(function (root, factory) {
  1459. if (typeof exports === "object") {
  1460. // CommonJS
  1461. module.exports = exports = factory(require("./core"));
  1462. }
  1463. else if (typeof define === "function" && define.amd) {
  1464. // AMD
  1465. define(["./core"], factory);
  1466. }
  1467. else {
  1468. // Global (browser)
  1469. factory(root.CryptoJS);
  1470. }
  1471. }(this, function (CryptoJS) {
  1472. (function (Math) {
  1473. // Shortcuts
  1474. var C = CryptoJS;
  1475. var C_lib = C.lib;
  1476. var WordArray = C_lib.WordArray;
  1477. var Hasher = C_lib.Hasher;
  1478. var C_algo = C.algo;
  1479. // Constants table
  1480. var T = [];
  1481. // Compute constants
  1482. (function () {
  1483. for (var i = 0; i < 64; i++) {
  1484. T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
  1485. }
  1486. }());
  1487. /**
  1488. * MD5 hash algorithm.
  1489. */
  1490. var MD5 = C_algo.MD5 = Hasher.extend({
  1491. _doReset: function () {
  1492. this._hash = new WordArray.init([
  1493. 0x67452301, 0xefcdab89,
  1494. 0x98badcfe, 0x10325476
  1495. ]);
  1496. },
  1497. _doProcessBlock: function (M, offset) {
  1498. // Swap endian
  1499. for (var i = 0; i < 16; i++) {
  1500. // Shortcuts
  1501. var offset_i = offset + i;
  1502. var M_offset_i = M[offset_i];
  1503. M[offset_i] = (
  1504. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  1505. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  1506. );
  1507. }
  1508. // Shortcuts
  1509. var H = this._hash.words;
  1510. var M_offset_0 = M[offset + 0];
  1511. var M_offset_1 = M[offset + 1];
  1512. var M_offset_2 = M[offset + 2];
  1513. var M_offset_3 = M[offset + 3];
  1514. var M_offset_4 = M[offset + 4];
  1515. var M_offset_5 = M[offset + 5];
  1516. var M_offset_6 = M[offset + 6];
  1517. var M_offset_7 = M[offset + 7];
  1518. var M_offset_8 = M[offset + 8];
  1519. var M_offset_9 = M[offset + 9];
  1520. var M_offset_10 = M[offset + 10];
  1521. var M_offset_11 = M[offset + 11];
  1522. var M_offset_12 = M[offset + 12];
  1523. var M_offset_13 = M[offset + 13];
  1524. var M_offset_14 = M[offset + 14];
  1525. var M_offset_15 = M[offset + 15];
  1526. // Working varialbes
  1527. var a = H[0];
  1528. var b = H[1];
  1529. var c = H[2];
  1530. var d = H[3];
  1531. // Computation
  1532. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  1533. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  1534. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  1535. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  1536. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  1537. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  1538. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  1539. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  1540. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  1541. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  1542. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  1543. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  1544. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  1545. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  1546. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  1547. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  1548. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  1549. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  1550. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  1551. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  1552. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  1553. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  1554. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  1555. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  1556. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  1557. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  1558. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  1559. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  1560. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  1561. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  1562. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  1563. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  1564. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  1565. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  1566. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  1567. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  1568. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  1569. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  1570. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  1571. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  1572. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  1573. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  1574. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  1575. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  1576. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  1577. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  1578. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  1579. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  1580. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  1581. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  1582. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  1583. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  1584. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  1585. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  1586. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  1587. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  1588. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  1589. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  1590. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  1591. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  1592. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  1593. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  1594. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  1595. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  1596. // Intermediate hash value
  1597. H[0] = (H[0] + a) | 0;
  1598. H[1] = (H[1] + b) | 0;
  1599. H[2] = (H[2] + c) | 0;
  1600. H[3] = (H[3] + d) | 0;
  1601. },
  1602. _doFinalize: function () {
  1603. // Shortcuts
  1604. var data = this._data;
  1605. var dataWords = data.words;
  1606. var nBitsTotal = this._nDataBytes * 8;
  1607. var nBitsLeft = data.sigBytes * 8;
  1608. // Add padding
  1609. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1610. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  1611. var nBitsTotalL = nBitsTotal;
  1612. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
  1613. (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
  1614. (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
  1615. );
  1616. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  1617. (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
  1618. (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
  1619. );
  1620. data.sigBytes = (dataWords.length + 1) * 4;
  1621. // Hash final blocks
  1622. this._process();
  1623. // Shortcuts
  1624. var hash = this._hash;
  1625. var H = hash.words;
  1626. // Swap endian
  1627. for (var i = 0; i < 4; i++) {
  1628. // Shortcut
  1629. var H_i = H[i];
  1630. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  1631. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
  1632. }
  1633. // Return final computed hash
  1634. return hash;
  1635. },
  1636. clone: function () {
  1637. var clone = Hasher.clone.call(this);
  1638. clone._hash = this._hash.clone();
  1639. return clone;
  1640. }
  1641. });
  1642. function FF(a, b, c, d, x, s, t) {
  1643. var n = a + ((b & c) | (~b & d)) + x + t;
  1644. return ((n << s) | (n >>> (32 - s))) + b;
  1645. }
  1646. function GG(a, b, c, d, x, s, t) {
  1647. var n = a + ((b & d) | (c & ~d)) + x + t;
  1648. return ((n << s) | (n >>> (32 - s))) + b;
  1649. }
  1650. function HH(a, b, c, d, x, s, t) {
  1651. var n = a + (b ^ c ^ d) + x + t;
  1652. return ((n << s) | (n >>> (32 - s))) + b;
  1653. }
  1654. function II(a, b, c, d, x, s, t) {
  1655. var n = a + (c ^ (b | ~d)) + x + t;
  1656. return ((n << s) | (n >>> (32 - s))) + b;
  1657. }
  1658. /**
  1659. * Shortcut function to the hasher's object interface.
  1660. *
  1661. * @param {WordArray|string} message The message to hash.
  1662. *
  1663. * @return {WordArray} The hash.
  1664. *
  1665. * @static
  1666. *
  1667. * @example
  1668. *
  1669. * var hash = CryptoJS.MD5('message');
  1670. * var hash = CryptoJS.MD5(wordArray);
  1671. */
  1672. C.MD5 = Hasher._createHelper(MD5);
  1673. /**
  1674. * Shortcut function to the HMAC's object interface.
  1675. *
  1676. * @param {WordArray|string} message The message to hash.
  1677. * @param {WordArray|string} key The secret key.
  1678. *
  1679. * @return {WordArray} The HMAC.
  1680. *
  1681. * @static
  1682. *
  1683. * @example
  1684. *
  1685. * var hmac = CryptoJS.HmacMD5(message, key);
  1686. */
  1687. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  1688. }(Math));
  1689. return CryptoJS.MD5;
  1690. }));
  1691. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1692. __DEFINE__(1679274193851, function(require, module, exports) {
  1693. ;(function (root, factory) {
  1694. if (typeof exports === "object") {
  1695. // CommonJS
  1696. module.exports = exports = factory(require("./core"));
  1697. }
  1698. else if (typeof define === "function" && define.amd) {
  1699. // AMD
  1700. define(["./core"], factory);
  1701. }
  1702. else {
  1703. // Global (browser)
  1704. factory(root.CryptoJS);
  1705. }
  1706. }(this, function (CryptoJS) {
  1707. (function () {
  1708. // Shortcuts
  1709. var C = CryptoJS;
  1710. var C_lib = C.lib;
  1711. var WordArray = C_lib.WordArray;
  1712. var Hasher = C_lib.Hasher;
  1713. var C_algo = C.algo;
  1714. // Reusable object
  1715. var W = [];
  1716. /**
  1717. * SHA-1 hash algorithm.
  1718. */
  1719. var SHA1 = C_algo.SHA1 = Hasher.extend({
  1720. _doReset: function () {
  1721. this._hash = new WordArray.init([
  1722. 0x67452301, 0xefcdab89,
  1723. 0x98badcfe, 0x10325476,
  1724. 0xc3d2e1f0
  1725. ]);
  1726. },
  1727. _doProcessBlock: function (M, offset) {
  1728. // Shortcut
  1729. var H = this._hash.words;
  1730. // Working variables
  1731. var a = H[0];
  1732. var b = H[1];
  1733. var c = H[2];
  1734. var d = H[3];
  1735. var e = H[4];
  1736. // Computation
  1737. for (var i = 0; i < 80; i++) {
  1738. if (i < 16) {
  1739. W[i] = M[offset + i] | 0;
  1740. } else {
  1741. var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
  1742. W[i] = (n << 1) | (n >>> 31);
  1743. }
  1744. var t = ((a << 5) | (a >>> 27)) + e + W[i];
  1745. if (i < 20) {
  1746. t += ((b & c) | (~b & d)) + 0x5a827999;
  1747. } else if (i < 40) {
  1748. t += (b ^ c ^ d) + 0x6ed9eba1;
  1749. } else if (i < 60) {
  1750. t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
  1751. } else /* if (i < 80) */ {
  1752. t += (b ^ c ^ d) - 0x359d3e2a;
  1753. }
  1754. e = d;
  1755. d = c;
  1756. c = (b << 30) | (b >>> 2);
  1757. b = a;
  1758. a = t;
  1759. }
  1760. // Intermediate hash value
  1761. H[0] = (H[0] + a) | 0;
  1762. H[1] = (H[1] + b) | 0;
  1763. H[2] = (H[2] + c) | 0;
  1764. H[3] = (H[3] + d) | 0;
  1765. H[4] = (H[4] + e) | 0;
  1766. },
  1767. _doFinalize: function () {
  1768. // Shortcuts
  1769. var data = this._data;
  1770. var dataWords = data.words;
  1771. var nBitsTotal = this._nDataBytes * 8;
  1772. var nBitsLeft = data.sigBytes * 8;
  1773. // Add padding
  1774. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1775. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  1776. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
  1777. data.sigBytes = dataWords.length * 4;
  1778. // Hash final blocks
  1779. this._process();
  1780. // Return final computed hash
  1781. return this._hash;
  1782. },
  1783. clone: function () {
  1784. var clone = Hasher.clone.call(this);
  1785. clone._hash = this._hash.clone();
  1786. return clone;
  1787. }
  1788. });
  1789. /**
  1790. * Shortcut function to the hasher's object interface.
  1791. *
  1792. * @param {WordArray|string} message The message to hash.
  1793. *
  1794. * @return {WordArray} The hash.
  1795. *
  1796. * @static
  1797. *
  1798. * @example
  1799. *
  1800. * var hash = CryptoJS.SHA1('message');
  1801. * var hash = CryptoJS.SHA1(wordArray);
  1802. */
  1803. C.SHA1 = Hasher._createHelper(SHA1);
  1804. /**
  1805. * Shortcut function to the HMAC's object interface.
  1806. *
  1807. * @param {WordArray|string} message The message to hash.
  1808. * @param {WordArray|string} key The secret key.
  1809. *
  1810. * @return {WordArray} The HMAC.
  1811. *
  1812. * @static
  1813. *
  1814. * @example
  1815. *
  1816. * var hmac = CryptoJS.HmacSHA1(message, key);
  1817. */
  1818. C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
  1819. }());
  1820. return CryptoJS.SHA1;
  1821. }));
  1822. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1823. __DEFINE__(1679274193852, function(require, module, exports) {
  1824. ;(function (root, factory) {
  1825. if (typeof exports === "object") {
  1826. // CommonJS
  1827. module.exports = exports = factory(require("./core"));
  1828. }
  1829. else if (typeof define === "function" && define.amd) {
  1830. // AMD
  1831. define(["./core"], factory);
  1832. }
  1833. else {
  1834. // Global (browser)
  1835. factory(root.CryptoJS);
  1836. }
  1837. }(this, function (CryptoJS) {
  1838. (function (Math) {
  1839. // Shortcuts
  1840. var C = CryptoJS;
  1841. var C_lib = C.lib;
  1842. var WordArray = C_lib.WordArray;
  1843. var Hasher = C_lib.Hasher;
  1844. var C_algo = C.algo;
  1845. // Initialization and round constants tables
  1846. var H = [];
  1847. var K = [];
  1848. // Compute constants
  1849. (function () {
  1850. function isPrime(n) {
  1851. var sqrtN = Math.sqrt(n);
  1852. for (var factor = 2; factor <= sqrtN; factor++) {
  1853. if (!(n % factor)) {
  1854. return false;
  1855. }
  1856. }
  1857. return true;
  1858. }
  1859. function getFractionalBits(n) {
  1860. return ((n - (n | 0)) * 0x100000000) | 0;
  1861. }
  1862. var n = 2;
  1863. var nPrime = 0;
  1864. while (nPrime < 64) {
  1865. if (isPrime(n)) {
  1866. if (nPrime < 8) {
  1867. H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
  1868. }
  1869. K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
  1870. nPrime++;
  1871. }
  1872. n++;
  1873. }
  1874. }());
  1875. // Reusable object
  1876. var W = [];
  1877. /**
  1878. * SHA-256 hash algorithm.
  1879. */
  1880. var SHA256 = C_algo.SHA256 = Hasher.extend({
  1881. _doReset: function () {
  1882. this._hash = new WordArray.init(H.slice(0));
  1883. },
  1884. _doProcessBlock: function (M, offset) {
  1885. // Shortcut
  1886. var H = this._hash.words;
  1887. // Working variables
  1888. var a = H[0];
  1889. var b = H[1];
  1890. var c = H[2];
  1891. var d = H[3];
  1892. var e = H[4];
  1893. var f = H[5];
  1894. var g = H[6];
  1895. var h = H[7];
  1896. // Computation
  1897. for (var i = 0; i < 64; i++) {
  1898. if (i < 16) {
  1899. W[i] = M[offset + i] | 0;
  1900. } else {
  1901. var gamma0x = W[i - 15];
  1902. var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
  1903. ((gamma0x << 14) | (gamma0x >>> 18)) ^
  1904. (gamma0x >>> 3);
  1905. var gamma1x = W[i - 2];
  1906. var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
  1907. ((gamma1x << 13) | (gamma1x >>> 19)) ^
  1908. (gamma1x >>> 10);
  1909. W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
  1910. }
  1911. var ch = (e & f) ^ (~e & g);
  1912. var maj = (a & b) ^ (a & c) ^ (b & c);
  1913. var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
  1914. var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
  1915. var t1 = h + sigma1 + ch + K[i] + W[i];
  1916. var t2 = sigma0 + maj;
  1917. h = g;
  1918. g = f;
  1919. f = e;
  1920. e = (d + t1) | 0;
  1921. d = c;
  1922. c = b;
  1923. b = a;
  1924. a = (t1 + t2) | 0;
  1925. }
  1926. // Intermediate hash value
  1927. H[0] = (H[0] + a) | 0;
  1928. H[1] = (H[1] + b) | 0;
  1929. H[2] = (H[2] + c) | 0;
  1930. H[3] = (H[3] + d) | 0;
  1931. H[4] = (H[4] + e) | 0;
  1932. H[5] = (H[5] + f) | 0;
  1933. H[6] = (H[6] + g) | 0;
  1934. H[7] = (H[7] + h) | 0;
  1935. },
  1936. _doFinalize: function () {
  1937. // Shortcuts
  1938. var data = this._data;
  1939. var dataWords = data.words;
  1940. var nBitsTotal = this._nDataBytes * 8;
  1941. var nBitsLeft = data.sigBytes * 8;
  1942. // Add padding
  1943. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1944. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  1945. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
  1946. data.sigBytes = dataWords.length * 4;
  1947. // Hash final blocks
  1948. this._process();
  1949. // Return final computed hash
  1950. return this._hash;
  1951. },
  1952. clone: function () {
  1953. var clone = Hasher.clone.call(this);
  1954. clone._hash = this._hash.clone();
  1955. return clone;
  1956. }
  1957. });
  1958. /**
  1959. * Shortcut function to the hasher's object interface.
  1960. *
  1961. * @param {WordArray|string} message The message to hash.
  1962. *
  1963. * @return {WordArray} The hash.
  1964. *
  1965. * @static
  1966. *
  1967. * @example
  1968. *
  1969. * var hash = CryptoJS.SHA256('message');
  1970. * var hash = CryptoJS.SHA256(wordArray);
  1971. */
  1972. C.SHA256 = Hasher._createHelper(SHA256);
  1973. /**
  1974. * Shortcut function to the HMAC's object interface.
  1975. *
  1976. * @param {WordArray|string} message The message to hash.
  1977. * @param {WordArray|string} key The secret key.
  1978. *
  1979. * @return {WordArray} The HMAC.
  1980. *
  1981. * @static
  1982. *
  1983. * @example
  1984. *
  1985. * var hmac = CryptoJS.HmacSHA256(message, key);
  1986. */
  1987. C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
  1988. }(Math));
  1989. return CryptoJS.SHA256;
  1990. }));
  1991. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  1992. __DEFINE__(1679274193853, function(require, module, exports) {
  1993. ;(function (root, factory, undef) {
  1994. if (typeof exports === "object") {
  1995. // CommonJS
  1996. module.exports = exports = factory(require("./core"), require("./sha256"));
  1997. }
  1998. else if (typeof define === "function" && define.amd) {
  1999. // AMD
  2000. define(["./core", "./sha256"], factory);
  2001. }
  2002. else {
  2003. // Global (browser)
  2004. factory(root.CryptoJS);
  2005. }
  2006. }(this, function (CryptoJS) {
  2007. (function () {
  2008. // Shortcuts
  2009. var C = CryptoJS;
  2010. var C_lib = C.lib;
  2011. var WordArray = C_lib.WordArray;
  2012. var C_algo = C.algo;
  2013. var SHA256 = C_algo.SHA256;
  2014. /**
  2015. * SHA-224 hash algorithm.
  2016. */
  2017. var SHA224 = C_algo.SHA224 = SHA256.extend({
  2018. _doReset: function () {
  2019. this._hash = new WordArray.init([
  2020. 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  2021. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
  2022. ]);
  2023. },
  2024. _doFinalize: function () {
  2025. var hash = SHA256._doFinalize.call(this);
  2026. hash.sigBytes -= 4;
  2027. return hash;
  2028. }
  2029. });
  2030. /**
  2031. * Shortcut function to the hasher's object interface.
  2032. *
  2033. * @param {WordArray|string} message The message to hash.
  2034. *
  2035. * @return {WordArray} The hash.
  2036. *
  2037. * @static
  2038. *
  2039. * @example
  2040. *
  2041. * var hash = CryptoJS.SHA224('message');
  2042. * var hash = CryptoJS.SHA224(wordArray);
  2043. */
  2044. C.SHA224 = SHA256._createHelper(SHA224);
  2045. /**
  2046. * Shortcut function to the HMAC's object interface.
  2047. *
  2048. * @param {WordArray|string} message The message to hash.
  2049. * @param {WordArray|string} key The secret key.
  2050. *
  2051. * @return {WordArray} The HMAC.
  2052. *
  2053. * @static
  2054. *
  2055. * @example
  2056. *
  2057. * var hmac = CryptoJS.HmacSHA224(message, key);
  2058. */
  2059. C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
  2060. }());
  2061. return CryptoJS.SHA224;
  2062. }));
  2063. }, function(modId) { var map = {"./core":1679274193844,"./sha256":1679274193852}; return __REQUIRE__(map[modId], modId); })
  2064. __DEFINE__(1679274193854, function(require, module, exports) {
  2065. ;(function (root, factory, undef) {
  2066. if (typeof exports === "object") {
  2067. // CommonJS
  2068. module.exports = exports = factory(require("./core"), require("./x64-core"));
  2069. }
  2070. else if (typeof define === "function" && define.amd) {
  2071. // AMD
  2072. define(["./core", "./x64-core"], factory);
  2073. }
  2074. else {
  2075. // Global (browser)
  2076. factory(root.CryptoJS);
  2077. }
  2078. }(this, function (CryptoJS) {
  2079. (function () {
  2080. // Shortcuts
  2081. var C = CryptoJS;
  2082. var C_lib = C.lib;
  2083. var Hasher = C_lib.Hasher;
  2084. var C_x64 = C.x64;
  2085. var X64Word = C_x64.Word;
  2086. var X64WordArray = C_x64.WordArray;
  2087. var C_algo = C.algo;
  2088. function X64Word_create() {
  2089. return X64Word.create.apply(X64Word, arguments);
  2090. }
  2091. // Constants
  2092. var K = [
  2093. X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
  2094. X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
  2095. X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
  2096. X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
  2097. X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
  2098. X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
  2099. X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
  2100. X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
  2101. X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
  2102. X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
  2103. X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
  2104. X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
  2105. X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
  2106. X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
  2107. X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
  2108. X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
  2109. X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
  2110. X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
  2111. X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
  2112. X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
  2113. X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
  2114. X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
  2115. X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
  2116. X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
  2117. X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
  2118. X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
  2119. X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
  2120. X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
  2121. X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
  2122. X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
  2123. X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
  2124. X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
  2125. X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
  2126. X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
  2127. X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
  2128. X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
  2129. X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
  2130. X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
  2131. X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
  2132. X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
  2133. ];
  2134. // Reusable objects
  2135. var W = [];
  2136. (function () {
  2137. for (var i = 0; i < 80; i++) {
  2138. W[i] = X64Word_create();
  2139. }
  2140. }());
  2141. /**
  2142. * SHA-512 hash algorithm.
  2143. */
  2144. var SHA512 = C_algo.SHA512 = Hasher.extend({
  2145. _doReset: function () {
  2146. this._hash = new X64WordArray.init([
  2147. new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
  2148. new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
  2149. new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
  2150. new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
  2151. ]);
  2152. },
  2153. _doProcessBlock: function (M, offset) {
  2154. // Shortcuts
  2155. var H = this._hash.words;
  2156. var H0 = H[0];
  2157. var H1 = H[1];
  2158. var H2 = H[2];
  2159. var H3 = H[3];
  2160. var H4 = H[4];
  2161. var H5 = H[5];
  2162. var H6 = H[6];
  2163. var H7 = H[7];
  2164. var H0h = H0.high;
  2165. var H0l = H0.low;
  2166. var H1h = H1.high;
  2167. var H1l = H1.low;
  2168. var H2h = H2.high;
  2169. var H2l = H2.low;
  2170. var H3h = H3.high;
  2171. var H3l = H3.low;
  2172. var H4h = H4.high;
  2173. var H4l = H4.low;
  2174. var H5h = H5.high;
  2175. var H5l = H5.low;
  2176. var H6h = H6.high;
  2177. var H6l = H6.low;
  2178. var H7h = H7.high;
  2179. var H7l = H7.low;
  2180. // Working variables
  2181. var ah = H0h;
  2182. var al = H0l;
  2183. var bh = H1h;
  2184. var bl = H1l;
  2185. var ch = H2h;
  2186. var cl = H2l;
  2187. var dh = H3h;
  2188. var dl = H3l;
  2189. var eh = H4h;
  2190. var el = H4l;
  2191. var fh = H5h;
  2192. var fl = H5l;
  2193. var gh = H6h;
  2194. var gl = H6l;
  2195. var hh = H7h;
  2196. var hl = H7l;
  2197. // Rounds
  2198. for (var i = 0; i < 80; i++) {
  2199. var Wil;
  2200. var Wih;
  2201. // Shortcut
  2202. var Wi = W[i];
  2203. // Extend message
  2204. if (i < 16) {
  2205. Wih = Wi.high = M[offset + i * 2] | 0;
  2206. Wil = Wi.low = M[offset + i * 2 + 1] | 0;
  2207. } else {
  2208. // Gamma0
  2209. var gamma0x = W[i - 15];
  2210. var gamma0xh = gamma0x.high;
  2211. var gamma0xl = gamma0x.low;
  2212. var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
  2213. var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
  2214. // Gamma1
  2215. var gamma1x = W[i - 2];
  2216. var gamma1xh = gamma1x.high;
  2217. var gamma1xl = gamma1x.low;
  2218. var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
  2219. var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
  2220. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  2221. var Wi7 = W[i - 7];
  2222. var Wi7h = Wi7.high;
  2223. var Wi7l = Wi7.low;
  2224. var Wi16 = W[i - 16];
  2225. var Wi16h = Wi16.high;
  2226. var Wi16l = Wi16.low;
  2227. Wil = gamma0l + Wi7l;
  2228. Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
  2229. Wil = Wil + gamma1l;
  2230. Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
  2231. Wil = Wil + Wi16l;
  2232. Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
  2233. Wi.high = Wih;
  2234. Wi.low = Wil;
  2235. }
  2236. var chh = (eh & fh) ^ (~eh & gh);
  2237. var chl = (el & fl) ^ (~el & gl);
  2238. var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
  2239. var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
  2240. var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
  2241. var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
  2242. var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
  2243. var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
  2244. // t1 = h + sigma1 + ch + K[i] + W[i]
  2245. var Ki = K[i];
  2246. var Kih = Ki.high;
  2247. var Kil = Ki.low;
  2248. var t1l = hl + sigma1l;
  2249. var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
  2250. var t1l = t1l + chl;
  2251. var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
  2252. var t1l = t1l + Kil;
  2253. var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
  2254. var t1l = t1l + Wil;
  2255. var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
  2256. // t2 = sigma0 + maj
  2257. var t2l = sigma0l + majl;
  2258. var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
  2259. // Update working variables
  2260. hh = gh;
  2261. hl = gl;
  2262. gh = fh;
  2263. gl = fl;
  2264. fh = eh;
  2265. fl = el;
  2266. el = (dl + t1l) | 0;
  2267. eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
  2268. dh = ch;
  2269. dl = cl;
  2270. ch = bh;
  2271. cl = bl;
  2272. bh = ah;
  2273. bl = al;
  2274. al = (t1l + t2l) | 0;
  2275. ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
  2276. }
  2277. // Intermediate hash value
  2278. H0l = H0.low = (H0l + al);
  2279. H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
  2280. H1l = H1.low = (H1l + bl);
  2281. H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
  2282. H2l = H2.low = (H2l + cl);
  2283. H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
  2284. H3l = H3.low = (H3l + dl);
  2285. H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
  2286. H4l = H4.low = (H4l + el);
  2287. H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
  2288. H5l = H5.low = (H5l + fl);
  2289. H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
  2290. H6l = H6.low = (H6l + gl);
  2291. H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
  2292. H7l = H7.low = (H7l + hl);
  2293. H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
  2294. },
  2295. _doFinalize: function () {
  2296. // Shortcuts
  2297. var data = this._data;
  2298. var dataWords = data.words;
  2299. var nBitsTotal = this._nDataBytes * 8;
  2300. var nBitsLeft = data.sigBytes * 8;
  2301. // Add padding
  2302. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  2303. dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
  2304. dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
  2305. data.sigBytes = dataWords.length * 4;
  2306. // Hash final blocks
  2307. this._process();
  2308. // Convert hash to 32-bit word array before returning
  2309. var hash = this._hash.toX32();
  2310. // Return final computed hash
  2311. return hash;
  2312. },
  2313. clone: function () {
  2314. var clone = Hasher.clone.call(this);
  2315. clone._hash = this._hash.clone();
  2316. return clone;
  2317. },
  2318. blockSize: 1024/32
  2319. });
  2320. /**
  2321. * Shortcut function to the hasher's object interface.
  2322. *
  2323. * @param {WordArray|string} message The message to hash.
  2324. *
  2325. * @return {WordArray} The hash.
  2326. *
  2327. * @static
  2328. *
  2329. * @example
  2330. *
  2331. * var hash = CryptoJS.SHA512('message');
  2332. * var hash = CryptoJS.SHA512(wordArray);
  2333. */
  2334. C.SHA512 = Hasher._createHelper(SHA512);
  2335. /**
  2336. * Shortcut function to the HMAC's object interface.
  2337. *
  2338. * @param {WordArray|string} message The message to hash.
  2339. * @param {WordArray|string} key The secret key.
  2340. *
  2341. * @return {WordArray} The HMAC.
  2342. *
  2343. * @static
  2344. *
  2345. * @example
  2346. *
  2347. * var hmac = CryptoJS.HmacSHA512(message, key);
  2348. */
  2349. C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
  2350. }());
  2351. return CryptoJS.SHA512;
  2352. }));
  2353. }, function(modId) { var map = {"./core":1679274193844,"./x64-core":1679274193845}; return __REQUIRE__(map[modId], modId); })
  2354. __DEFINE__(1679274193855, function(require, module, exports) {
  2355. ;(function (root, factory, undef) {
  2356. if (typeof exports === "object") {
  2357. // CommonJS
  2358. module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
  2359. }
  2360. else if (typeof define === "function" && define.amd) {
  2361. // AMD
  2362. define(["./core", "./x64-core", "./sha512"], factory);
  2363. }
  2364. else {
  2365. // Global (browser)
  2366. factory(root.CryptoJS);
  2367. }
  2368. }(this, function (CryptoJS) {
  2369. (function () {
  2370. // Shortcuts
  2371. var C = CryptoJS;
  2372. var C_x64 = C.x64;
  2373. var X64Word = C_x64.Word;
  2374. var X64WordArray = C_x64.WordArray;
  2375. var C_algo = C.algo;
  2376. var SHA512 = C_algo.SHA512;
  2377. /**
  2378. * SHA-384 hash algorithm.
  2379. */
  2380. var SHA384 = C_algo.SHA384 = SHA512.extend({
  2381. _doReset: function () {
  2382. this._hash = new X64WordArray.init([
  2383. new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
  2384. new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
  2385. new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
  2386. new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
  2387. ]);
  2388. },
  2389. _doFinalize: function () {
  2390. var hash = SHA512._doFinalize.call(this);
  2391. hash.sigBytes -= 16;
  2392. return hash;
  2393. }
  2394. });
  2395. /**
  2396. * Shortcut function to the hasher's object interface.
  2397. *
  2398. * @param {WordArray|string} message The message to hash.
  2399. *
  2400. * @return {WordArray} The hash.
  2401. *
  2402. * @static
  2403. *
  2404. * @example
  2405. *
  2406. * var hash = CryptoJS.SHA384('message');
  2407. * var hash = CryptoJS.SHA384(wordArray);
  2408. */
  2409. C.SHA384 = SHA512._createHelper(SHA384);
  2410. /**
  2411. * Shortcut function to the HMAC's object interface.
  2412. *
  2413. * @param {WordArray|string} message The message to hash.
  2414. * @param {WordArray|string} key The secret key.
  2415. *
  2416. * @return {WordArray} The HMAC.
  2417. *
  2418. * @static
  2419. *
  2420. * @example
  2421. *
  2422. * var hmac = CryptoJS.HmacSHA384(message, key);
  2423. */
  2424. C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
  2425. }());
  2426. return CryptoJS.SHA384;
  2427. }));
  2428. }, function(modId) { var map = {"./core":1679274193844,"./x64-core":1679274193845,"./sha512":1679274193854}; return __REQUIRE__(map[modId], modId); })
  2429. __DEFINE__(1679274193856, function(require, module, exports) {
  2430. ;(function (root, factory, undef) {
  2431. if (typeof exports === "object") {
  2432. // CommonJS
  2433. module.exports = exports = factory(require("./core"), require("./x64-core"));
  2434. }
  2435. else if (typeof define === "function" && define.amd) {
  2436. // AMD
  2437. define(["./core", "./x64-core"], factory);
  2438. }
  2439. else {
  2440. // Global (browser)
  2441. factory(root.CryptoJS);
  2442. }
  2443. }(this, function (CryptoJS) {
  2444. (function (Math) {
  2445. // Shortcuts
  2446. var C = CryptoJS;
  2447. var C_lib = C.lib;
  2448. var WordArray = C_lib.WordArray;
  2449. var Hasher = C_lib.Hasher;
  2450. var C_x64 = C.x64;
  2451. var X64Word = C_x64.Word;
  2452. var C_algo = C.algo;
  2453. // Constants tables
  2454. var RHO_OFFSETS = [];
  2455. var PI_INDEXES = [];
  2456. var ROUND_CONSTANTS = [];
  2457. // Compute Constants
  2458. (function () {
  2459. // Compute rho offset constants
  2460. var x = 1, y = 0;
  2461. for (var t = 0; t < 24; t++) {
  2462. RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
  2463. var newX = y % 5;
  2464. var newY = (2 * x + 3 * y) % 5;
  2465. x = newX;
  2466. y = newY;
  2467. }
  2468. // Compute pi index constants
  2469. for (var x = 0; x < 5; x++) {
  2470. for (var y = 0; y < 5; y++) {
  2471. PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
  2472. }
  2473. }
  2474. // Compute round constants
  2475. var LFSR = 0x01;
  2476. for (var i = 0; i < 24; i++) {
  2477. var roundConstantMsw = 0;
  2478. var roundConstantLsw = 0;
  2479. for (var j = 0; j < 7; j++) {
  2480. if (LFSR & 0x01) {
  2481. var bitPosition = (1 << j) - 1;
  2482. if (bitPosition < 32) {
  2483. roundConstantLsw ^= 1 << bitPosition;
  2484. } else /* if (bitPosition >= 32) */ {
  2485. roundConstantMsw ^= 1 << (bitPosition - 32);
  2486. }
  2487. }
  2488. // Compute next LFSR
  2489. if (LFSR & 0x80) {
  2490. // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
  2491. LFSR = (LFSR << 1) ^ 0x71;
  2492. } else {
  2493. LFSR <<= 1;
  2494. }
  2495. }
  2496. ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
  2497. }
  2498. }());
  2499. // Reusable objects for temporary values
  2500. var T = [];
  2501. (function () {
  2502. for (var i = 0; i < 25; i++) {
  2503. T[i] = X64Word.create();
  2504. }
  2505. }());
  2506. /**
  2507. * SHA-3 hash algorithm.
  2508. */
  2509. var SHA3 = C_algo.SHA3 = Hasher.extend({
  2510. /**
  2511. * Configuration options.
  2512. *
  2513. * @property {number} outputLength
  2514. * The desired number of bits in the output hash.
  2515. * Only values permitted are: 224, 256, 384, 512.
  2516. * Default: 512
  2517. */
  2518. cfg: Hasher.cfg.extend({
  2519. outputLength: 512
  2520. }),
  2521. _doReset: function () {
  2522. var state = this._state = []
  2523. for (var i = 0; i < 25; i++) {
  2524. state[i] = new X64Word.init();
  2525. }
  2526. this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
  2527. },
  2528. _doProcessBlock: function (M, offset) {
  2529. // Shortcuts
  2530. var state = this._state;
  2531. var nBlockSizeLanes = this.blockSize / 2;
  2532. // Absorb
  2533. for (var i = 0; i < nBlockSizeLanes; i++) {
  2534. // Shortcuts
  2535. var M2i = M[offset + 2 * i];
  2536. var M2i1 = M[offset + 2 * i + 1];
  2537. // Swap endian
  2538. M2i = (
  2539. (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
  2540. (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
  2541. );
  2542. M2i1 = (
  2543. (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
  2544. (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
  2545. );
  2546. // Absorb message into state
  2547. var lane = state[i];
  2548. lane.high ^= M2i1;
  2549. lane.low ^= M2i;
  2550. }
  2551. // Rounds
  2552. for (var round = 0; round < 24; round++) {
  2553. // Theta
  2554. for (var x = 0; x < 5; x++) {
  2555. // Mix column lanes
  2556. var tMsw = 0, tLsw = 0;
  2557. for (var y = 0; y < 5; y++) {
  2558. var lane = state[x + 5 * y];
  2559. tMsw ^= lane.high;
  2560. tLsw ^= lane.low;
  2561. }
  2562. // Temporary values
  2563. var Tx = T[x];
  2564. Tx.high = tMsw;
  2565. Tx.low = tLsw;
  2566. }
  2567. for (var x = 0; x < 5; x++) {
  2568. // Shortcuts
  2569. var Tx4 = T[(x + 4) % 5];
  2570. var Tx1 = T[(x + 1) % 5];
  2571. var Tx1Msw = Tx1.high;
  2572. var Tx1Lsw = Tx1.low;
  2573. // Mix surrounding columns
  2574. var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
  2575. var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
  2576. for (var y = 0; y < 5; y++) {
  2577. var lane = state[x + 5 * y];
  2578. lane.high ^= tMsw;
  2579. lane.low ^= tLsw;
  2580. }
  2581. }
  2582. // Rho Pi
  2583. for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
  2584. var tMsw;
  2585. var tLsw;
  2586. // Shortcuts
  2587. var lane = state[laneIndex];
  2588. var laneMsw = lane.high;
  2589. var laneLsw = lane.low;
  2590. var rhoOffset = RHO_OFFSETS[laneIndex];
  2591. // Rotate lanes
  2592. if (rhoOffset < 32) {
  2593. tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
  2594. tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
  2595. } else /* if (rhoOffset >= 32) */ {
  2596. tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
  2597. tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
  2598. }
  2599. // Transpose lanes
  2600. var TPiLane = T[PI_INDEXES[laneIndex]];
  2601. TPiLane.high = tMsw;
  2602. TPiLane.low = tLsw;
  2603. }
  2604. // Rho pi at x = y = 0
  2605. var T0 = T[0];
  2606. var state0 = state[0];
  2607. T0.high = state0.high;
  2608. T0.low = state0.low;
  2609. // Chi
  2610. for (var x = 0; x < 5; x++) {
  2611. for (var y = 0; y < 5; y++) {
  2612. // Shortcuts
  2613. var laneIndex = x + 5 * y;
  2614. var lane = state[laneIndex];
  2615. var TLane = T[laneIndex];
  2616. var Tx1Lane = T[((x + 1) % 5) + 5 * y];
  2617. var Tx2Lane = T[((x + 2) % 5) + 5 * y];
  2618. // Mix rows
  2619. lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
  2620. lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
  2621. }
  2622. }
  2623. // Iota
  2624. var lane = state[0];
  2625. var roundConstant = ROUND_CONSTANTS[round];
  2626. lane.high ^= roundConstant.high;
  2627. lane.low ^= roundConstant.low;
  2628. }
  2629. },
  2630. _doFinalize: function () {
  2631. // Shortcuts
  2632. var data = this._data;
  2633. var dataWords = data.words;
  2634. var nBitsTotal = this._nDataBytes * 8;
  2635. var nBitsLeft = data.sigBytes * 8;
  2636. var blockSizeBits = this.blockSize * 32;
  2637. // Add padding
  2638. dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
  2639. dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
  2640. data.sigBytes = dataWords.length * 4;
  2641. // Hash final blocks
  2642. this._process();
  2643. // Shortcuts
  2644. var state = this._state;
  2645. var outputLengthBytes = this.cfg.outputLength / 8;
  2646. var outputLengthLanes = outputLengthBytes / 8;
  2647. // Squeeze
  2648. var hashWords = [];
  2649. for (var i = 0; i < outputLengthLanes; i++) {
  2650. // Shortcuts
  2651. var lane = state[i];
  2652. var laneMsw = lane.high;
  2653. var laneLsw = lane.low;
  2654. // Swap endian
  2655. laneMsw = (
  2656. (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
  2657. (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
  2658. );
  2659. laneLsw = (
  2660. (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
  2661. (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
  2662. );
  2663. // Squeeze state to retrieve hash
  2664. hashWords.push(laneLsw);
  2665. hashWords.push(laneMsw);
  2666. }
  2667. // Return final computed hash
  2668. return new WordArray.init(hashWords, outputLengthBytes);
  2669. },
  2670. clone: function () {
  2671. var clone = Hasher.clone.call(this);
  2672. var state = clone._state = this._state.slice(0);
  2673. for (var i = 0; i < 25; i++) {
  2674. state[i] = state[i].clone();
  2675. }
  2676. return clone;
  2677. }
  2678. });
  2679. /**
  2680. * Shortcut function to the hasher's object interface.
  2681. *
  2682. * @param {WordArray|string} message The message to hash.
  2683. *
  2684. * @return {WordArray} The hash.
  2685. *
  2686. * @static
  2687. *
  2688. * @example
  2689. *
  2690. * var hash = CryptoJS.SHA3('message');
  2691. * var hash = CryptoJS.SHA3(wordArray);
  2692. */
  2693. C.SHA3 = Hasher._createHelper(SHA3);
  2694. /**
  2695. * Shortcut function to the HMAC's object interface.
  2696. *
  2697. * @param {WordArray|string} message The message to hash.
  2698. * @param {WordArray|string} key The secret key.
  2699. *
  2700. * @return {WordArray} The HMAC.
  2701. *
  2702. * @static
  2703. *
  2704. * @example
  2705. *
  2706. * var hmac = CryptoJS.HmacSHA3(message, key);
  2707. */
  2708. C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
  2709. }(Math));
  2710. return CryptoJS.SHA3;
  2711. }));
  2712. }, function(modId) { var map = {"./core":1679274193844,"./x64-core":1679274193845}; return __REQUIRE__(map[modId], modId); })
  2713. __DEFINE__(1679274193857, function(require, module, exports) {
  2714. ;(function (root, factory) {
  2715. if (typeof exports === "object") {
  2716. // CommonJS
  2717. module.exports = exports = factory(require("./core"));
  2718. }
  2719. else if (typeof define === "function" && define.amd) {
  2720. // AMD
  2721. define(["./core"], factory);
  2722. }
  2723. else {
  2724. // Global (browser)
  2725. factory(root.CryptoJS);
  2726. }
  2727. }(this, function (CryptoJS) {
  2728. /** @preserve
  2729. (c) 2012 by Cédric Mesnil. All rights reserved.
  2730. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  2731. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2732. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  2733. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2734. */
  2735. (function (Math) {
  2736. // Shortcuts
  2737. var C = CryptoJS;
  2738. var C_lib = C.lib;
  2739. var WordArray = C_lib.WordArray;
  2740. var Hasher = C_lib.Hasher;
  2741. var C_algo = C.algo;
  2742. // Constants table
  2743. var _zl = WordArray.create([
  2744. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  2745. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  2746. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  2747. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  2748. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
  2749. var _zr = WordArray.create([
  2750. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  2751. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  2752. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  2753. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  2754. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
  2755. var _sl = WordArray.create([
  2756. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  2757. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  2758. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  2759. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  2760. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
  2761. var _sr = WordArray.create([
  2762. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  2763. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  2764. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  2765. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  2766. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
  2767. var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
  2768. var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
  2769. /**
  2770. * RIPEMD160 hash algorithm.
  2771. */
  2772. var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
  2773. _doReset: function () {
  2774. this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
  2775. },
  2776. _doProcessBlock: function (M, offset) {
  2777. // Swap endian
  2778. for (var i = 0; i < 16; i++) {
  2779. // Shortcuts
  2780. var offset_i = offset + i;
  2781. var M_offset_i = M[offset_i];
  2782. // Swap
  2783. M[offset_i] = (
  2784. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  2785. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  2786. );
  2787. }
  2788. // Shortcut
  2789. var H = this._hash.words;
  2790. var hl = _hl.words;
  2791. var hr = _hr.words;
  2792. var zl = _zl.words;
  2793. var zr = _zr.words;
  2794. var sl = _sl.words;
  2795. var sr = _sr.words;
  2796. // Working variables
  2797. var al, bl, cl, dl, el;
  2798. var ar, br, cr, dr, er;
  2799. ar = al = H[0];
  2800. br = bl = H[1];
  2801. cr = cl = H[2];
  2802. dr = dl = H[3];
  2803. er = el = H[4];
  2804. // Computation
  2805. var t;
  2806. for (var i = 0; i < 80; i += 1) {
  2807. t = (al + M[offset+zl[i]])|0;
  2808. if (i<16){
  2809. t += f1(bl,cl,dl) + hl[0];
  2810. } else if (i<32) {
  2811. t += f2(bl,cl,dl) + hl[1];
  2812. } else if (i<48) {
  2813. t += f3(bl,cl,dl) + hl[2];
  2814. } else if (i<64) {
  2815. t += f4(bl,cl,dl) + hl[3];
  2816. } else {// if (i<80) {
  2817. t += f5(bl,cl,dl) + hl[4];
  2818. }
  2819. t = t|0;
  2820. t = rotl(t,sl[i]);
  2821. t = (t+el)|0;
  2822. al = el;
  2823. el = dl;
  2824. dl = rotl(cl, 10);
  2825. cl = bl;
  2826. bl = t;
  2827. t = (ar + M[offset+zr[i]])|0;
  2828. if (i<16){
  2829. t += f5(br,cr,dr) + hr[0];
  2830. } else if (i<32) {
  2831. t += f4(br,cr,dr) + hr[1];
  2832. } else if (i<48) {
  2833. t += f3(br,cr,dr) + hr[2];
  2834. } else if (i<64) {
  2835. t += f2(br,cr,dr) + hr[3];
  2836. } else {// if (i<80) {
  2837. t += f1(br,cr,dr) + hr[4];
  2838. }
  2839. t = t|0;
  2840. t = rotl(t,sr[i]) ;
  2841. t = (t+er)|0;
  2842. ar = er;
  2843. er = dr;
  2844. dr = rotl(cr, 10);
  2845. cr = br;
  2846. br = t;
  2847. }
  2848. // Intermediate hash value
  2849. t = (H[1] + cl + dr)|0;
  2850. H[1] = (H[2] + dl + er)|0;
  2851. H[2] = (H[3] + el + ar)|0;
  2852. H[3] = (H[4] + al + br)|0;
  2853. H[4] = (H[0] + bl + cr)|0;
  2854. H[0] = t;
  2855. },
  2856. _doFinalize: function () {
  2857. // Shortcuts
  2858. var data = this._data;
  2859. var dataWords = data.words;
  2860. var nBitsTotal = this._nDataBytes * 8;
  2861. var nBitsLeft = data.sigBytes * 8;
  2862. // Add padding
  2863. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  2864. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  2865. (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
  2866. (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
  2867. );
  2868. data.sigBytes = (dataWords.length + 1) * 4;
  2869. // Hash final blocks
  2870. this._process();
  2871. // Shortcuts
  2872. var hash = this._hash;
  2873. var H = hash.words;
  2874. // Swap endian
  2875. for (var i = 0; i < 5; i++) {
  2876. // Shortcut
  2877. var H_i = H[i];
  2878. // Swap
  2879. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  2880. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
  2881. }
  2882. // Return final computed hash
  2883. return hash;
  2884. },
  2885. clone: function () {
  2886. var clone = Hasher.clone.call(this);
  2887. clone._hash = this._hash.clone();
  2888. return clone;
  2889. }
  2890. });
  2891. function f1(x, y, z) {
  2892. return ((x) ^ (y) ^ (z));
  2893. }
  2894. function f2(x, y, z) {
  2895. return (((x)&(y)) | ((~x)&(z)));
  2896. }
  2897. function f3(x, y, z) {
  2898. return (((x) | (~(y))) ^ (z));
  2899. }
  2900. function f4(x, y, z) {
  2901. return (((x) & (z)) | ((y)&(~(z))));
  2902. }
  2903. function f5(x, y, z) {
  2904. return ((x) ^ ((y) |(~(z))));
  2905. }
  2906. function rotl(x,n) {
  2907. return (x<<n) | (x>>>(32-n));
  2908. }
  2909. /**
  2910. * Shortcut function to the hasher's object interface.
  2911. *
  2912. * @param {WordArray|string} message The message to hash.
  2913. *
  2914. * @return {WordArray} The hash.
  2915. *
  2916. * @static
  2917. *
  2918. * @example
  2919. *
  2920. * var hash = CryptoJS.RIPEMD160('message');
  2921. * var hash = CryptoJS.RIPEMD160(wordArray);
  2922. */
  2923. C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
  2924. /**
  2925. * Shortcut function to the HMAC's object interface.
  2926. *
  2927. * @param {WordArray|string} message The message to hash.
  2928. * @param {WordArray|string} key The secret key.
  2929. *
  2930. * @return {WordArray} The HMAC.
  2931. *
  2932. * @static
  2933. *
  2934. * @example
  2935. *
  2936. * var hmac = CryptoJS.HmacRIPEMD160(message, key);
  2937. */
  2938. C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
  2939. }(Math));
  2940. return CryptoJS.RIPEMD160;
  2941. }));
  2942. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  2943. __DEFINE__(1679274193858, function(require, module, exports) {
  2944. ;(function (root, factory) {
  2945. if (typeof exports === "object") {
  2946. // CommonJS
  2947. module.exports = exports = factory(require("./core"));
  2948. }
  2949. else if (typeof define === "function" && define.amd) {
  2950. // AMD
  2951. define(["./core"], factory);
  2952. }
  2953. else {
  2954. // Global (browser)
  2955. factory(root.CryptoJS);
  2956. }
  2957. }(this, function (CryptoJS) {
  2958. (function () {
  2959. // Shortcuts
  2960. var C = CryptoJS;
  2961. var C_lib = C.lib;
  2962. var Base = C_lib.Base;
  2963. var C_enc = C.enc;
  2964. var Utf8 = C_enc.Utf8;
  2965. var C_algo = C.algo;
  2966. /**
  2967. * HMAC algorithm.
  2968. */
  2969. var HMAC = C_algo.HMAC = Base.extend({
  2970. /**
  2971. * Initializes a newly created HMAC.
  2972. *
  2973. * @param {Hasher} hasher The hash algorithm to use.
  2974. * @param {WordArray|string} key The secret key.
  2975. *
  2976. * @example
  2977. *
  2978. * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  2979. */
  2980. init: function (hasher, key) {
  2981. // Init hasher
  2982. hasher = this._hasher = new hasher.init();
  2983. // Convert string to WordArray, else assume WordArray already
  2984. if (typeof key == 'string') {
  2985. key = Utf8.parse(key);
  2986. }
  2987. // Shortcuts
  2988. var hasherBlockSize = hasher.blockSize;
  2989. var hasherBlockSizeBytes = hasherBlockSize * 4;
  2990. // Allow arbitrary length keys
  2991. if (key.sigBytes > hasherBlockSizeBytes) {
  2992. key = hasher.finalize(key);
  2993. }
  2994. // Clamp excess bits
  2995. key.clamp();
  2996. // Clone key for inner and outer pads
  2997. var oKey = this._oKey = key.clone();
  2998. var iKey = this._iKey = key.clone();
  2999. // Shortcuts
  3000. var oKeyWords = oKey.words;
  3001. var iKeyWords = iKey.words;
  3002. // XOR keys with pad constants
  3003. for (var i = 0; i < hasherBlockSize; i++) {
  3004. oKeyWords[i] ^= 0x5c5c5c5c;
  3005. iKeyWords[i] ^= 0x36363636;
  3006. }
  3007. oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  3008. // Set initial values
  3009. this.reset();
  3010. },
  3011. /**
  3012. * Resets this HMAC to its initial state.
  3013. *
  3014. * @example
  3015. *
  3016. * hmacHasher.reset();
  3017. */
  3018. reset: function () {
  3019. // Shortcut
  3020. var hasher = this._hasher;
  3021. // Reset
  3022. hasher.reset();
  3023. hasher.update(this._iKey);
  3024. },
  3025. /**
  3026. * Updates this HMAC with a message.
  3027. *
  3028. * @param {WordArray|string} messageUpdate The message to append.
  3029. *
  3030. * @return {HMAC} This HMAC instance.
  3031. *
  3032. * @example
  3033. *
  3034. * hmacHasher.update('message');
  3035. * hmacHasher.update(wordArray);
  3036. */
  3037. update: function (messageUpdate) {
  3038. this._hasher.update(messageUpdate);
  3039. // Chainable
  3040. return this;
  3041. },
  3042. /**
  3043. * Finalizes the HMAC computation.
  3044. * Note that the finalize operation is effectively a destructive, read-once operation.
  3045. *
  3046. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  3047. *
  3048. * @return {WordArray} The HMAC.
  3049. *
  3050. * @example
  3051. *
  3052. * var hmac = hmacHasher.finalize();
  3053. * var hmac = hmacHasher.finalize('message');
  3054. * var hmac = hmacHasher.finalize(wordArray);
  3055. */
  3056. finalize: function (messageUpdate) {
  3057. // Shortcut
  3058. var hasher = this._hasher;
  3059. // Compute HMAC
  3060. var innerHash = hasher.finalize(messageUpdate);
  3061. hasher.reset();
  3062. var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  3063. return hmac;
  3064. }
  3065. });
  3066. }());
  3067. }));
  3068. }, function(modId) { var map = {"./core":1679274193844}; return __REQUIRE__(map[modId], modId); })
  3069. __DEFINE__(1679274193859, function(require, module, exports) {
  3070. ;(function (root, factory, undef) {
  3071. if (typeof exports === "object") {
  3072. // CommonJS
  3073. module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  3074. }
  3075. else if (typeof define === "function" && define.amd) {
  3076. // AMD
  3077. define(["./core", "./sha1", "./hmac"], factory);
  3078. }
  3079. else {
  3080. // Global (browser)
  3081. factory(root.CryptoJS);
  3082. }
  3083. }(this, function (CryptoJS) {
  3084. (function () {
  3085. // Shortcuts
  3086. var C = CryptoJS;
  3087. var C_lib = C.lib;
  3088. var Base = C_lib.Base;
  3089. var WordArray = C_lib.WordArray;
  3090. var C_algo = C.algo;
  3091. var SHA1 = C_algo.SHA1;
  3092. var HMAC = C_algo.HMAC;
  3093. /**
  3094. * Password-Based Key Derivation Function 2 algorithm.
  3095. */
  3096. var PBKDF2 = C_algo.PBKDF2 = Base.extend({
  3097. /**
  3098. * Configuration options.
  3099. *
  3100. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  3101. * @property {Hasher} hasher The hasher to use. Default: SHA1
  3102. * @property {number} iterations The number of iterations to perform. Default: 1
  3103. */
  3104. cfg: Base.extend({
  3105. keySize: 128/32,
  3106. hasher: SHA1,
  3107. iterations: 1
  3108. }),
  3109. /**
  3110. * Initializes a newly created key derivation function.
  3111. *
  3112. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  3113. *
  3114. * @example
  3115. *
  3116. * var kdf = CryptoJS.algo.PBKDF2.create();
  3117. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
  3118. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
  3119. */
  3120. init: function (cfg) {
  3121. this.cfg = this.cfg.extend(cfg);
  3122. },
  3123. /**
  3124. * Computes the Password-Based Key Derivation Function 2.
  3125. *
  3126. * @param {WordArray|string} password The password.
  3127. * @param {WordArray|string} salt A salt.
  3128. *
  3129. * @return {WordArray} The derived key.
  3130. *
  3131. * @example
  3132. *
  3133. * var key = kdf.compute(password, salt);
  3134. */
  3135. compute: function (password, salt) {
  3136. // Shortcut
  3137. var cfg = this.cfg;
  3138. // Init HMAC
  3139. var hmac = HMAC.create(cfg.hasher, password);
  3140. // Initial values
  3141. var derivedKey = WordArray.create();
  3142. var blockIndex = WordArray.create([0x00000001]);
  3143. // Shortcuts
  3144. var derivedKeyWords = derivedKey.words;
  3145. var blockIndexWords = blockIndex.words;
  3146. var keySize = cfg.keySize;
  3147. var iterations = cfg.iterations;
  3148. // Generate key
  3149. while (derivedKeyWords.length < keySize) {
  3150. var block = hmac.update(salt).finalize(blockIndex);
  3151. hmac.reset();
  3152. // Shortcuts
  3153. var blockWords = block.words;
  3154. var blockWordsLength = blockWords.length;
  3155. // Iterations
  3156. var intermediate = block;
  3157. for (var i = 1; i < iterations; i++) {
  3158. intermediate = hmac.finalize(intermediate);
  3159. hmac.reset();
  3160. // Shortcut
  3161. var intermediateWords = intermediate.words;
  3162. // XOR intermediate with block
  3163. for (var j = 0; j < blockWordsLength; j++) {
  3164. blockWords[j] ^= intermediateWords[j];
  3165. }
  3166. }
  3167. derivedKey.concat(block);
  3168. blockIndexWords[0]++;
  3169. }
  3170. derivedKey.sigBytes = keySize * 4;
  3171. return derivedKey;
  3172. }
  3173. });
  3174. /**
  3175. * Computes the Password-Based Key Derivation Function 2.
  3176. *
  3177. * @param {WordArray|string} password The password.
  3178. * @param {WordArray|string} salt A salt.
  3179. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  3180. *
  3181. * @return {WordArray} The derived key.
  3182. *
  3183. * @static
  3184. *
  3185. * @example
  3186. *
  3187. * var key = CryptoJS.PBKDF2(password, salt);
  3188. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
  3189. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
  3190. */
  3191. C.PBKDF2 = function (password, salt, cfg) {
  3192. return PBKDF2.create(cfg).compute(password, salt);
  3193. };
  3194. }());
  3195. return CryptoJS.PBKDF2;
  3196. }));
  3197. }, function(modId) { var map = {"./core":1679274193844,"./sha1":1679274193851,"./hmac":1679274193858}; return __REQUIRE__(map[modId], modId); })
  3198. __DEFINE__(1679274193860, function(require, module, exports) {
  3199. ;(function (root, factory, undef) {
  3200. if (typeof exports === "object") {
  3201. // CommonJS
  3202. module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  3203. }
  3204. else if (typeof define === "function" && define.amd) {
  3205. // AMD
  3206. define(["./core", "./sha1", "./hmac"], factory);
  3207. }
  3208. else {
  3209. // Global (browser)
  3210. factory(root.CryptoJS);
  3211. }
  3212. }(this, function (CryptoJS) {
  3213. (function () {
  3214. // Shortcuts
  3215. var C = CryptoJS;
  3216. var C_lib = C.lib;
  3217. var Base = C_lib.Base;
  3218. var WordArray = C_lib.WordArray;
  3219. var C_algo = C.algo;
  3220. var MD5 = C_algo.MD5;
  3221. /**
  3222. * This key derivation function is meant to conform with EVP_BytesToKey.
  3223. * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  3224. */
  3225. var EvpKDF = C_algo.EvpKDF = Base.extend({
  3226. /**
  3227. * Configuration options.
  3228. *
  3229. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  3230. * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  3231. * @property {number} iterations The number of iterations to perform. Default: 1
  3232. */
  3233. cfg: Base.extend({
  3234. keySize: 128/32,
  3235. hasher: MD5,
  3236. iterations: 1
  3237. }),
  3238. /**
  3239. * Initializes a newly created key derivation function.
  3240. *
  3241. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  3242. *
  3243. * @example
  3244. *
  3245. * var kdf = CryptoJS.algo.EvpKDF.create();
  3246. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  3247. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  3248. */
  3249. init: function (cfg) {
  3250. this.cfg = this.cfg.extend(cfg);
  3251. },
  3252. /**
  3253. * Derives a key from a password.
  3254. *
  3255. * @param {WordArray|string} password The password.
  3256. * @param {WordArray|string} salt A salt.
  3257. *
  3258. * @return {WordArray} The derived key.
  3259. *
  3260. * @example
  3261. *
  3262. * var key = kdf.compute(password, salt);
  3263. */
  3264. compute: function (password, salt) {
  3265. var block;
  3266. // Shortcut
  3267. var cfg = this.cfg;
  3268. // Init hasher
  3269. var hasher = cfg.hasher.create();
  3270. // Initial values
  3271. var derivedKey = WordArray.create();
  3272. // Shortcuts
  3273. var derivedKeyWords = derivedKey.words;
  3274. var keySize = cfg.keySize;
  3275. var iterations = cfg.iterations;
  3276. // Generate key
  3277. while (derivedKeyWords.length < keySize) {
  3278. if (block) {
  3279. hasher.update(block);
  3280. }
  3281. block = hasher.update(password).finalize(salt);
  3282. hasher.reset();
  3283. // Iterations
  3284. for (var i = 1; i < iterations; i++) {
  3285. block = hasher.finalize(block);
  3286. hasher.reset();
  3287. }
  3288. derivedKey.concat(block);
  3289. }
  3290. derivedKey.sigBytes = keySize * 4;
  3291. return derivedKey;
  3292. }
  3293. });
  3294. /**
  3295. * Derives a key from a password.
  3296. *
  3297. * @param {WordArray|string} password The password.
  3298. * @param {WordArray|string} salt A salt.
  3299. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  3300. *
  3301. * @return {WordArray} The derived key.
  3302. *
  3303. * @static
  3304. *
  3305. * @example
  3306. *
  3307. * var key = CryptoJS.EvpKDF(password, salt);
  3308. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  3309. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  3310. */
  3311. C.EvpKDF = function (password, salt, cfg) {
  3312. return EvpKDF.create(cfg).compute(password, salt);
  3313. };
  3314. }());
  3315. return CryptoJS.EvpKDF;
  3316. }));
  3317. }, function(modId) { var map = {"./core":1679274193844,"./sha1":1679274193851,"./hmac":1679274193858}; return __REQUIRE__(map[modId], modId); })
  3318. __DEFINE__(1679274193861, function(require, module, exports) {
  3319. ;(function (root, factory, undef) {
  3320. if (typeof exports === "object") {
  3321. // CommonJS
  3322. module.exports = exports = factory(require("./core"), require("./evpkdf"));
  3323. }
  3324. else if (typeof define === "function" && define.amd) {
  3325. // AMD
  3326. define(["./core", "./evpkdf"], factory);
  3327. }
  3328. else {
  3329. // Global (browser)
  3330. factory(root.CryptoJS);
  3331. }
  3332. }(this, function (CryptoJS) {
  3333. /**
  3334. * Cipher core components.
  3335. */
  3336. CryptoJS.lib.Cipher || (function (undefined) {
  3337. // Shortcuts
  3338. var C = CryptoJS;
  3339. var C_lib = C.lib;
  3340. var Base = C_lib.Base;
  3341. var WordArray = C_lib.WordArray;
  3342. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  3343. var C_enc = C.enc;
  3344. var Utf8 = C_enc.Utf8;
  3345. var Base64 = C_enc.Base64;
  3346. var C_algo = C.algo;
  3347. var EvpKDF = C_algo.EvpKDF;
  3348. /**
  3349. * Abstract base cipher template.
  3350. *
  3351. * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  3352. * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  3353. * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  3354. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  3355. */
  3356. var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  3357. /**
  3358. * Configuration options.
  3359. *
  3360. * @property {WordArray} iv The IV to use for this operation.
  3361. */
  3362. cfg: Base.extend(),
  3363. /**
  3364. * Creates this cipher in encryption mode.
  3365. *
  3366. * @param {WordArray} key The key.
  3367. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3368. *
  3369. * @return {Cipher} A cipher instance.
  3370. *
  3371. * @static
  3372. *
  3373. * @example
  3374. *
  3375. * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  3376. */
  3377. createEncryptor: function (key, cfg) {
  3378. return this.create(this._ENC_XFORM_MODE, key, cfg);
  3379. },
  3380. /**
  3381. * Creates this cipher in decryption mode.
  3382. *
  3383. * @param {WordArray} key The key.
  3384. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3385. *
  3386. * @return {Cipher} A cipher instance.
  3387. *
  3388. * @static
  3389. *
  3390. * @example
  3391. *
  3392. * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  3393. */
  3394. createDecryptor: function (key, cfg) {
  3395. return this.create(this._DEC_XFORM_MODE, key, cfg);
  3396. },
  3397. /**
  3398. * Initializes a newly created cipher.
  3399. *
  3400. * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  3401. * @param {WordArray} key The key.
  3402. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3403. *
  3404. * @example
  3405. *
  3406. * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  3407. */
  3408. init: function (xformMode, key, cfg) {
  3409. // Apply config defaults
  3410. this.cfg = this.cfg.extend(cfg);
  3411. // Store transform mode and key
  3412. this._xformMode = xformMode;
  3413. this._key = key;
  3414. // Set initial values
  3415. this.reset();
  3416. },
  3417. /**
  3418. * Resets this cipher to its initial state.
  3419. *
  3420. * @example
  3421. *
  3422. * cipher.reset();
  3423. */
  3424. reset: function () {
  3425. // Reset data buffer
  3426. BufferedBlockAlgorithm.reset.call(this);
  3427. // Perform concrete-cipher logic
  3428. this._doReset();
  3429. },
  3430. /**
  3431. * Adds data to be encrypted or decrypted.
  3432. *
  3433. * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  3434. *
  3435. * @return {WordArray} The data after processing.
  3436. *
  3437. * @example
  3438. *
  3439. * var encrypted = cipher.process('data');
  3440. * var encrypted = cipher.process(wordArray);
  3441. */
  3442. process: function (dataUpdate) {
  3443. // Append
  3444. this._append(dataUpdate);
  3445. // Process available blocks
  3446. return this._process();
  3447. },
  3448. /**
  3449. * Finalizes the encryption or decryption process.
  3450. * Note that the finalize operation is effectively a destructive, read-once operation.
  3451. *
  3452. * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  3453. *
  3454. * @return {WordArray} The data after final processing.
  3455. *
  3456. * @example
  3457. *
  3458. * var encrypted = cipher.finalize();
  3459. * var encrypted = cipher.finalize('data');
  3460. * var encrypted = cipher.finalize(wordArray);
  3461. */
  3462. finalize: function (dataUpdate) {
  3463. // Final data update
  3464. if (dataUpdate) {
  3465. this._append(dataUpdate);
  3466. }
  3467. // Perform concrete-cipher logic
  3468. var finalProcessedData = this._doFinalize();
  3469. return finalProcessedData;
  3470. },
  3471. keySize: 128/32,
  3472. ivSize: 128/32,
  3473. _ENC_XFORM_MODE: 1,
  3474. _DEC_XFORM_MODE: 2,
  3475. /**
  3476. * Creates shortcut functions to a cipher's object interface.
  3477. *
  3478. * @param {Cipher} cipher The cipher to create a helper for.
  3479. *
  3480. * @return {Object} An object with encrypt and decrypt shortcut functions.
  3481. *
  3482. * @static
  3483. *
  3484. * @example
  3485. *
  3486. * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  3487. */
  3488. _createHelper: (function () {
  3489. function selectCipherStrategy(key) {
  3490. if (typeof key == 'string') {
  3491. return PasswordBasedCipher;
  3492. } else {
  3493. return SerializableCipher;
  3494. }
  3495. }
  3496. return function (cipher) {
  3497. return {
  3498. encrypt: function (message, key, cfg) {
  3499. return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  3500. },
  3501. decrypt: function (ciphertext, key, cfg) {
  3502. return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  3503. }
  3504. };
  3505. };
  3506. }())
  3507. });
  3508. /**
  3509. * Abstract base stream cipher template.
  3510. *
  3511. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  3512. */
  3513. var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  3514. _doFinalize: function () {
  3515. // Process partial blocks
  3516. var finalProcessedBlocks = this._process(!!'flush');
  3517. return finalProcessedBlocks;
  3518. },
  3519. blockSize: 1
  3520. });
  3521. /**
  3522. * Mode namespace.
  3523. */
  3524. var C_mode = C.mode = {};
  3525. /**
  3526. * Abstract base block cipher mode template.
  3527. */
  3528. var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  3529. /**
  3530. * Creates this mode for encryption.
  3531. *
  3532. * @param {Cipher} cipher A block cipher instance.
  3533. * @param {Array} iv The IV words.
  3534. *
  3535. * @static
  3536. *
  3537. * @example
  3538. *
  3539. * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  3540. */
  3541. createEncryptor: function (cipher, iv) {
  3542. return this.Encryptor.create(cipher, iv);
  3543. },
  3544. /**
  3545. * Creates this mode for decryption.
  3546. *
  3547. * @param {Cipher} cipher A block cipher instance.
  3548. * @param {Array} iv The IV words.
  3549. *
  3550. * @static
  3551. *
  3552. * @example
  3553. *
  3554. * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  3555. */
  3556. createDecryptor: function (cipher, iv) {
  3557. return this.Decryptor.create(cipher, iv);
  3558. },
  3559. /**
  3560. * Initializes a newly created mode.
  3561. *
  3562. * @param {Cipher} cipher A block cipher instance.
  3563. * @param {Array} iv The IV words.
  3564. *
  3565. * @example
  3566. *
  3567. * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  3568. */
  3569. init: function (cipher, iv) {
  3570. this._cipher = cipher;
  3571. this._iv = iv;
  3572. }
  3573. });
  3574. /**
  3575. * Cipher Block Chaining mode.
  3576. */
  3577. var CBC = C_mode.CBC = (function () {
  3578. /**
  3579. * Abstract base CBC mode.
  3580. */
  3581. var CBC = BlockCipherMode.extend();
  3582. /**
  3583. * CBC encryptor.
  3584. */
  3585. CBC.Encryptor = CBC.extend({
  3586. /**
  3587. * Processes the data block at offset.
  3588. *
  3589. * @param {Array} words The data words to operate on.
  3590. * @param {number} offset The offset where the block starts.
  3591. *
  3592. * @example
  3593. *
  3594. * mode.processBlock(data.words, offset);
  3595. */
  3596. processBlock: function (words, offset) {
  3597. // Shortcuts
  3598. var cipher = this._cipher;
  3599. var blockSize = cipher.blockSize;
  3600. // XOR and encrypt
  3601. xorBlock.call(this, words, offset, blockSize);
  3602. cipher.encryptBlock(words, offset);
  3603. // Remember this block to use with next block
  3604. this._prevBlock = words.slice(offset, offset + blockSize);
  3605. }
  3606. });
  3607. /**
  3608. * CBC decryptor.
  3609. */
  3610. CBC.Decryptor = CBC.extend({
  3611. /**
  3612. * Processes the data block at offset.
  3613. *
  3614. * @param {Array} words The data words to operate on.
  3615. * @param {number} offset The offset where the block starts.
  3616. *
  3617. * @example
  3618. *
  3619. * mode.processBlock(data.words, offset);
  3620. */
  3621. processBlock: function (words, offset) {
  3622. // Shortcuts
  3623. var cipher = this._cipher;
  3624. var blockSize = cipher.blockSize;
  3625. // Remember this block to use with next block
  3626. var thisBlock = words.slice(offset, offset + blockSize);
  3627. // Decrypt and XOR
  3628. cipher.decryptBlock(words, offset);
  3629. xorBlock.call(this, words, offset, blockSize);
  3630. // This block becomes the previous block
  3631. this._prevBlock = thisBlock;
  3632. }
  3633. });
  3634. function xorBlock(words, offset, blockSize) {
  3635. var block;
  3636. // Shortcut
  3637. var iv = this._iv;
  3638. // Choose mixing block
  3639. if (iv) {
  3640. block = iv;
  3641. // Remove IV for subsequent blocks
  3642. this._iv = undefined;
  3643. } else {
  3644. block = this._prevBlock;
  3645. }
  3646. // XOR blocks
  3647. for (var i = 0; i < blockSize; i++) {
  3648. words[offset + i] ^= block[i];
  3649. }
  3650. }
  3651. return CBC;
  3652. }());
  3653. /**
  3654. * Padding namespace.
  3655. */
  3656. var C_pad = C.pad = {};
  3657. /**
  3658. * PKCS #5/7 padding strategy.
  3659. */
  3660. var Pkcs7 = C_pad.Pkcs7 = {
  3661. /**
  3662. * Pads data using the algorithm defined in PKCS #5/7.
  3663. *
  3664. * @param {WordArray} data The data to pad.
  3665. * @param {number} blockSize The multiple that the data should be padded to.
  3666. *
  3667. * @static
  3668. *
  3669. * @example
  3670. *
  3671. * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  3672. */
  3673. pad: function (data, blockSize) {
  3674. // Shortcut
  3675. var blockSizeBytes = blockSize * 4;
  3676. // Count padding bytes
  3677. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  3678. // Create padding word
  3679. var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
  3680. // Create padding
  3681. var paddingWords = [];
  3682. for (var i = 0; i < nPaddingBytes; i += 4) {
  3683. paddingWords.push(paddingWord);
  3684. }
  3685. var padding = WordArray.create(paddingWords, nPaddingBytes);
  3686. // Add padding
  3687. data.concat(padding);
  3688. },
  3689. /**
  3690. * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  3691. *
  3692. * @param {WordArray} data The data to unpad.
  3693. *
  3694. * @static
  3695. *
  3696. * @example
  3697. *
  3698. * CryptoJS.pad.Pkcs7.unpad(wordArray);
  3699. */
  3700. unpad: function (data) {
  3701. // Get number of padding bytes from last byte
  3702. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  3703. // Remove padding
  3704. data.sigBytes -= nPaddingBytes;
  3705. }
  3706. };
  3707. /**
  3708. * Abstract base block cipher template.
  3709. *
  3710. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  3711. */
  3712. var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  3713. /**
  3714. * Configuration options.
  3715. *
  3716. * @property {Mode} mode The block mode to use. Default: CBC
  3717. * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  3718. */
  3719. cfg: Cipher.cfg.extend({
  3720. mode: CBC,
  3721. padding: Pkcs7
  3722. }),
  3723. reset: function () {
  3724. var modeCreator;
  3725. // Reset cipher
  3726. Cipher.reset.call(this);
  3727. // Shortcuts
  3728. var cfg = this.cfg;
  3729. var iv = cfg.iv;
  3730. var mode = cfg.mode;
  3731. // Reset block mode
  3732. if (this._xformMode == this._ENC_XFORM_MODE) {
  3733. modeCreator = mode.createEncryptor;
  3734. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  3735. modeCreator = mode.createDecryptor;
  3736. // Keep at least one block in the buffer for unpadding
  3737. this._minBufferSize = 1;
  3738. }
  3739. if (this._mode && this._mode.__creator == modeCreator) {
  3740. this._mode.init(this, iv && iv.words);
  3741. } else {
  3742. this._mode = modeCreator.call(mode, this, iv && iv.words);
  3743. this._mode.__creator = modeCreator;
  3744. }
  3745. },
  3746. _doProcessBlock: function (words, offset) {
  3747. this._mode.processBlock(words, offset);
  3748. },
  3749. _doFinalize: function () {
  3750. var finalProcessedBlocks;
  3751. // Shortcut
  3752. var padding = this.cfg.padding;
  3753. // Finalize
  3754. if (this._xformMode == this._ENC_XFORM_MODE) {
  3755. // Pad data
  3756. padding.pad(this._data, this.blockSize);
  3757. // Process final blocks
  3758. finalProcessedBlocks = this._process(!!'flush');
  3759. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  3760. // Process final blocks
  3761. finalProcessedBlocks = this._process(!!'flush');
  3762. // Unpad data
  3763. padding.unpad(finalProcessedBlocks);
  3764. }
  3765. return finalProcessedBlocks;
  3766. },
  3767. blockSize: 128/32
  3768. });
  3769. /**
  3770. * A collection of cipher parameters.
  3771. *
  3772. * @property {WordArray} ciphertext The raw ciphertext.
  3773. * @property {WordArray} key The key to this ciphertext.
  3774. * @property {WordArray} iv The IV used in the ciphering operation.
  3775. * @property {WordArray} salt The salt used with a key derivation function.
  3776. * @property {Cipher} algorithm The cipher algorithm.
  3777. * @property {Mode} mode The block mode used in the ciphering operation.
  3778. * @property {Padding} padding The padding scheme used in the ciphering operation.
  3779. * @property {number} blockSize The block size of the cipher.
  3780. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  3781. */
  3782. var CipherParams = C_lib.CipherParams = Base.extend({
  3783. /**
  3784. * Initializes a newly created cipher params object.
  3785. *
  3786. * @param {Object} cipherParams An object with any of the possible cipher parameters.
  3787. *
  3788. * @example
  3789. *
  3790. * var cipherParams = CryptoJS.lib.CipherParams.create({
  3791. * ciphertext: ciphertextWordArray,
  3792. * key: keyWordArray,
  3793. * iv: ivWordArray,
  3794. * salt: saltWordArray,
  3795. * algorithm: CryptoJS.algo.AES,
  3796. * mode: CryptoJS.mode.CBC,
  3797. * padding: CryptoJS.pad.PKCS7,
  3798. * blockSize: 4,
  3799. * formatter: CryptoJS.format.OpenSSL
  3800. * });
  3801. */
  3802. init: function (cipherParams) {
  3803. this.mixIn(cipherParams);
  3804. },
  3805. /**
  3806. * Converts this cipher params object to a string.
  3807. *
  3808. * @param {Format} formatter (Optional) The formatting strategy to use.
  3809. *
  3810. * @return {string} The stringified cipher params.
  3811. *
  3812. * @throws Error If neither the formatter nor the default formatter is set.
  3813. *
  3814. * @example
  3815. *
  3816. * var string = cipherParams + '';
  3817. * var string = cipherParams.toString();
  3818. * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  3819. */
  3820. toString: function (formatter) {
  3821. return (formatter || this.formatter).stringify(this);
  3822. }
  3823. });
  3824. /**
  3825. * Format namespace.
  3826. */
  3827. var C_format = C.format = {};
  3828. /**
  3829. * OpenSSL formatting strategy.
  3830. */
  3831. var OpenSSLFormatter = C_format.OpenSSL = {
  3832. /**
  3833. * Converts a cipher params object to an OpenSSL-compatible string.
  3834. *
  3835. * @param {CipherParams} cipherParams The cipher params object.
  3836. *
  3837. * @return {string} The OpenSSL-compatible string.
  3838. *
  3839. * @static
  3840. *
  3841. * @example
  3842. *
  3843. * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  3844. */
  3845. stringify: function (cipherParams) {
  3846. var wordArray;
  3847. // Shortcuts
  3848. var ciphertext = cipherParams.ciphertext;
  3849. var salt = cipherParams.salt;
  3850. // Format
  3851. if (salt) {
  3852. wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  3853. } else {
  3854. wordArray = ciphertext;
  3855. }
  3856. return wordArray.toString(Base64);
  3857. },
  3858. /**
  3859. * Converts an OpenSSL-compatible string to a cipher params object.
  3860. *
  3861. * @param {string} openSSLStr The OpenSSL-compatible string.
  3862. *
  3863. * @return {CipherParams} The cipher params object.
  3864. *
  3865. * @static
  3866. *
  3867. * @example
  3868. *
  3869. * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  3870. */
  3871. parse: function (openSSLStr) {
  3872. var salt;
  3873. // Parse base64
  3874. var ciphertext = Base64.parse(openSSLStr);
  3875. // Shortcut
  3876. var ciphertextWords = ciphertext.words;
  3877. // Test for salt
  3878. if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  3879. // Extract salt
  3880. salt = WordArray.create(ciphertextWords.slice(2, 4));
  3881. // Remove salt from ciphertext
  3882. ciphertextWords.splice(0, 4);
  3883. ciphertext.sigBytes -= 16;
  3884. }
  3885. return CipherParams.create({ ciphertext: ciphertext, salt: salt });
  3886. }
  3887. };
  3888. /**
  3889. * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  3890. */
  3891. var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  3892. /**
  3893. * Configuration options.
  3894. *
  3895. * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  3896. */
  3897. cfg: Base.extend({
  3898. format: OpenSSLFormatter
  3899. }),
  3900. /**
  3901. * Encrypts a message.
  3902. *
  3903. * @param {Cipher} cipher The cipher algorithm to use.
  3904. * @param {WordArray|string} message The message to encrypt.
  3905. * @param {WordArray} key The key.
  3906. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3907. *
  3908. * @return {CipherParams} A cipher params object.
  3909. *
  3910. * @static
  3911. *
  3912. * @example
  3913. *
  3914. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  3915. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  3916. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3917. */
  3918. encrypt: function (cipher, message, key, cfg) {
  3919. // Apply config defaults
  3920. cfg = this.cfg.extend(cfg);
  3921. // Encrypt
  3922. var encryptor = cipher.createEncryptor(key, cfg);
  3923. var ciphertext = encryptor.finalize(message);
  3924. // Shortcut
  3925. var cipherCfg = encryptor.cfg;
  3926. // Create and return serializable cipher params
  3927. return CipherParams.create({
  3928. ciphertext: ciphertext,
  3929. key: key,
  3930. iv: cipherCfg.iv,
  3931. algorithm: cipher,
  3932. mode: cipherCfg.mode,
  3933. padding: cipherCfg.padding,
  3934. blockSize: cipher.blockSize,
  3935. formatter: cfg.format
  3936. });
  3937. },
  3938. /**
  3939. * Decrypts serialized ciphertext.
  3940. *
  3941. * @param {Cipher} cipher The cipher algorithm to use.
  3942. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  3943. * @param {WordArray} key The key.
  3944. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3945. *
  3946. * @return {WordArray} The plaintext.
  3947. *
  3948. * @static
  3949. *
  3950. * @example
  3951. *
  3952. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3953. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3954. */
  3955. decrypt: function (cipher, ciphertext, key, cfg) {
  3956. // Apply config defaults
  3957. cfg = this.cfg.extend(cfg);
  3958. // Convert string to CipherParams
  3959. ciphertext = this._parse(ciphertext, cfg.format);
  3960. // Decrypt
  3961. var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  3962. return plaintext;
  3963. },
  3964. /**
  3965. * Converts serialized ciphertext to CipherParams,
  3966. * else assumed CipherParams already and returns ciphertext unchanged.
  3967. *
  3968. * @param {CipherParams|string} ciphertext The ciphertext.
  3969. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  3970. *
  3971. * @return {CipherParams} The unserialized ciphertext.
  3972. *
  3973. * @static
  3974. *
  3975. * @example
  3976. *
  3977. * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  3978. */
  3979. _parse: function (ciphertext, format) {
  3980. if (typeof ciphertext == 'string') {
  3981. return format.parse(ciphertext, this);
  3982. } else {
  3983. return ciphertext;
  3984. }
  3985. }
  3986. });
  3987. /**
  3988. * Key derivation function namespace.
  3989. */
  3990. var C_kdf = C.kdf = {};
  3991. /**
  3992. * OpenSSL key derivation function.
  3993. */
  3994. var OpenSSLKdf = C_kdf.OpenSSL = {
  3995. /**
  3996. * Derives a key and IV from a password.
  3997. *
  3998. * @param {string} password The password to derive from.
  3999. * @param {number} keySize The size in words of the key to generate.
  4000. * @param {number} ivSize The size in words of the IV to generate.
  4001. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  4002. *
  4003. * @return {CipherParams} A cipher params object with the key, IV, and salt.
  4004. *
  4005. * @static
  4006. *
  4007. * @example
  4008. *
  4009. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  4010. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  4011. */
  4012. execute: function (password, keySize, ivSize, salt) {
  4013. // Generate random salt
  4014. if (!salt) {
  4015. salt = WordArray.random(64/8);
  4016. }
  4017. // Derive key and IV
  4018. var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
  4019. // Separate key and IV
  4020. var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  4021. key.sigBytes = keySize * 4;
  4022. // Return params
  4023. return CipherParams.create({ key: key, iv: iv, salt: salt });
  4024. }
  4025. };
  4026. /**
  4027. * A serializable cipher wrapper that derives the key from a password,
  4028. * and returns ciphertext as a serializable cipher params object.
  4029. */
  4030. var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  4031. /**
  4032. * Configuration options.
  4033. *
  4034. * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  4035. */
  4036. cfg: SerializableCipher.cfg.extend({
  4037. kdf: OpenSSLKdf
  4038. }),
  4039. /**
  4040. * Encrypts a message using a password.
  4041. *
  4042. * @param {Cipher} cipher The cipher algorithm to use.
  4043. * @param {WordArray|string} message The message to encrypt.
  4044. * @param {string} password The password.
  4045. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  4046. *
  4047. * @return {CipherParams} A cipher params object.
  4048. *
  4049. * @static
  4050. *
  4051. * @example
  4052. *
  4053. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  4054. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  4055. */
  4056. encrypt: function (cipher, message, password, cfg) {
  4057. // Apply config defaults
  4058. cfg = this.cfg.extend(cfg);
  4059. // Derive key and other params
  4060. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
  4061. // Add IV to config
  4062. cfg.iv = derivedParams.iv;
  4063. // Encrypt
  4064. var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  4065. // Mix in derived params
  4066. ciphertext.mixIn(derivedParams);
  4067. return ciphertext;
  4068. },
  4069. /**
  4070. * Decrypts serialized ciphertext using a password.
  4071. *
  4072. * @param {Cipher} cipher The cipher algorithm to use.
  4073. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  4074. * @param {string} password The password.
  4075. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  4076. *
  4077. * @return {WordArray} The plaintext.
  4078. *
  4079. * @static
  4080. *
  4081. * @example
  4082. *
  4083. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  4084. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  4085. */
  4086. decrypt: function (cipher, ciphertext, password, cfg) {
  4087. // Apply config defaults
  4088. cfg = this.cfg.extend(cfg);
  4089. // Convert string to CipherParams
  4090. ciphertext = this._parse(ciphertext, cfg.format);
  4091. // Derive key and other params
  4092. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
  4093. // Add IV to config
  4094. cfg.iv = derivedParams.iv;
  4095. // Decrypt
  4096. var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  4097. return plaintext;
  4098. }
  4099. });
  4100. }());
  4101. }));
  4102. }, function(modId) { var map = {"./core":1679274193844,"./evpkdf":1679274193860}; return __REQUIRE__(map[modId], modId); })
  4103. __DEFINE__(1679274193862, function(require, module, exports) {
  4104. ;(function (root, factory, undef) {
  4105. if (typeof exports === "object") {
  4106. // CommonJS
  4107. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4108. }
  4109. else if (typeof define === "function" && define.amd) {
  4110. // AMD
  4111. define(["./core", "./cipher-core"], factory);
  4112. }
  4113. else {
  4114. // Global (browser)
  4115. factory(root.CryptoJS);
  4116. }
  4117. }(this, function (CryptoJS) {
  4118. /**
  4119. * Cipher Feedback block mode.
  4120. */
  4121. CryptoJS.mode.CFB = (function () {
  4122. var CFB = CryptoJS.lib.BlockCipherMode.extend();
  4123. CFB.Encryptor = CFB.extend({
  4124. processBlock: function (words, offset) {
  4125. // Shortcuts
  4126. var cipher = this._cipher;
  4127. var blockSize = cipher.blockSize;
  4128. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  4129. // Remember this block to use with next block
  4130. this._prevBlock = words.slice(offset, offset + blockSize);
  4131. }
  4132. });
  4133. CFB.Decryptor = CFB.extend({
  4134. processBlock: function (words, offset) {
  4135. // Shortcuts
  4136. var cipher = this._cipher;
  4137. var blockSize = cipher.blockSize;
  4138. // Remember this block to use with next block
  4139. var thisBlock = words.slice(offset, offset + blockSize);
  4140. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  4141. // This block becomes the previous block
  4142. this._prevBlock = thisBlock;
  4143. }
  4144. });
  4145. function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
  4146. var keystream;
  4147. // Shortcut
  4148. var iv = this._iv;
  4149. // Generate keystream
  4150. if (iv) {
  4151. keystream = iv.slice(0);
  4152. // Remove IV for subsequent blocks
  4153. this._iv = undefined;
  4154. } else {
  4155. keystream = this._prevBlock;
  4156. }
  4157. cipher.encryptBlock(keystream, 0);
  4158. // Encrypt
  4159. for (var i = 0; i < blockSize; i++) {
  4160. words[offset + i] ^= keystream[i];
  4161. }
  4162. }
  4163. return CFB;
  4164. }());
  4165. return CryptoJS.mode.CFB;
  4166. }));
  4167. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4168. __DEFINE__(1679274193863, function(require, module, exports) {
  4169. ;(function (root, factory, undef) {
  4170. if (typeof exports === "object") {
  4171. // CommonJS
  4172. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4173. }
  4174. else if (typeof define === "function" && define.amd) {
  4175. // AMD
  4176. define(["./core", "./cipher-core"], factory);
  4177. }
  4178. else {
  4179. // Global (browser)
  4180. factory(root.CryptoJS);
  4181. }
  4182. }(this, function (CryptoJS) {
  4183. /**
  4184. * Counter block mode.
  4185. */
  4186. CryptoJS.mode.CTR = (function () {
  4187. var CTR = CryptoJS.lib.BlockCipherMode.extend();
  4188. var Encryptor = CTR.Encryptor = CTR.extend({
  4189. processBlock: function (words, offset) {
  4190. // Shortcuts
  4191. var cipher = this._cipher
  4192. var blockSize = cipher.blockSize;
  4193. var iv = this._iv;
  4194. var counter = this._counter;
  4195. // Generate keystream
  4196. if (iv) {
  4197. counter = this._counter = iv.slice(0);
  4198. // Remove IV for subsequent blocks
  4199. this._iv = undefined;
  4200. }
  4201. var keystream = counter.slice(0);
  4202. cipher.encryptBlock(keystream, 0);
  4203. // Increment counter
  4204. counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
  4205. // Encrypt
  4206. for (var i = 0; i < blockSize; i++) {
  4207. words[offset + i] ^= keystream[i];
  4208. }
  4209. }
  4210. });
  4211. CTR.Decryptor = Encryptor;
  4212. return CTR;
  4213. }());
  4214. return CryptoJS.mode.CTR;
  4215. }));
  4216. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4217. __DEFINE__(1679274193864, function(require, module, exports) {
  4218. ;(function (root, factory, undef) {
  4219. if (typeof exports === "object") {
  4220. // CommonJS
  4221. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4222. }
  4223. else if (typeof define === "function" && define.amd) {
  4224. // AMD
  4225. define(["./core", "./cipher-core"], factory);
  4226. }
  4227. else {
  4228. // Global (browser)
  4229. factory(root.CryptoJS);
  4230. }
  4231. }(this, function (CryptoJS) {
  4232. /** @preserve
  4233. * Counter block mode compatible with Dr Brian Gladman fileenc.c
  4234. * derived from CryptoJS.mode.CTR
  4235. * Jan Hruby jhruby.web@gmail.com
  4236. */
  4237. CryptoJS.mode.CTRGladman = (function () {
  4238. var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
  4239. function incWord(word)
  4240. {
  4241. if (((word >> 24) & 0xff) === 0xff) { //overflow
  4242. var b1 = (word >> 16)&0xff;
  4243. var b2 = (word >> 8)&0xff;
  4244. var b3 = word & 0xff;
  4245. if (b1 === 0xff) // overflow b1
  4246. {
  4247. b1 = 0;
  4248. if (b2 === 0xff)
  4249. {
  4250. b2 = 0;
  4251. if (b3 === 0xff)
  4252. {
  4253. b3 = 0;
  4254. }
  4255. else
  4256. {
  4257. ++b3;
  4258. }
  4259. }
  4260. else
  4261. {
  4262. ++b2;
  4263. }
  4264. }
  4265. else
  4266. {
  4267. ++b1;
  4268. }
  4269. word = 0;
  4270. word += (b1 << 16);
  4271. word += (b2 << 8);
  4272. word += b3;
  4273. }
  4274. else
  4275. {
  4276. word += (0x01 << 24);
  4277. }
  4278. return word;
  4279. }
  4280. function incCounter(counter)
  4281. {
  4282. if ((counter[0] = incWord(counter[0])) === 0)
  4283. {
  4284. // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
  4285. counter[1] = incWord(counter[1]);
  4286. }
  4287. return counter;
  4288. }
  4289. var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
  4290. processBlock: function (words, offset) {
  4291. // Shortcuts
  4292. var cipher = this._cipher
  4293. var blockSize = cipher.blockSize;
  4294. var iv = this._iv;
  4295. var counter = this._counter;
  4296. // Generate keystream
  4297. if (iv) {
  4298. counter = this._counter = iv.slice(0);
  4299. // Remove IV for subsequent blocks
  4300. this._iv = undefined;
  4301. }
  4302. incCounter(counter);
  4303. var keystream = counter.slice(0);
  4304. cipher.encryptBlock(keystream, 0);
  4305. // Encrypt
  4306. for (var i = 0; i < blockSize; i++) {
  4307. words[offset + i] ^= keystream[i];
  4308. }
  4309. }
  4310. });
  4311. CTRGladman.Decryptor = Encryptor;
  4312. return CTRGladman;
  4313. }());
  4314. return CryptoJS.mode.CTRGladman;
  4315. }));
  4316. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4317. __DEFINE__(1679274193865, function(require, module, exports) {
  4318. ;(function (root, factory, undef) {
  4319. if (typeof exports === "object") {
  4320. // CommonJS
  4321. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4322. }
  4323. else if (typeof define === "function" && define.amd) {
  4324. // AMD
  4325. define(["./core", "./cipher-core"], factory);
  4326. }
  4327. else {
  4328. // Global (browser)
  4329. factory(root.CryptoJS);
  4330. }
  4331. }(this, function (CryptoJS) {
  4332. /**
  4333. * Output Feedback block mode.
  4334. */
  4335. CryptoJS.mode.OFB = (function () {
  4336. var OFB = CryptoJS.lib.BlockCipherMode.extend();
  4337. var Encryptor = OFB.Encryptor = OFB.extend({
  4338. processBlock: function (words, offset) {
  4339. // Shortcuts
  4340. var cipher = this._cipher
  4341. var blockSize = cipher.blockSize;
  4342. var iv = this._iv;
  4343. var keystream = this._keystream;
  4344. // Generate keystream
  4345. if (iv) {
  4346. keystream = this._keystream = iv.slice(0);
  4347. // Remove IV for subsequent blocks
  4348. this._iv = undefined;
  4349. }
  4350. cipher.encryptBlock(keystream, 0);
  4351. // Encrypt
  4352. for (var i = 0; i < blockSize; i++) {
  4353. words[offset + i] ^= keystream[i];
  4354. }
  4355. }
  4356. });
  4357. OFB.Decryptor = Encryptor;
  4358. return OFB;
  4359. }());
  4360. return CryptoJS.mode.OFB;
  4361. }));
  4362. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4363. __DEFINE__(1679274193866, function(require, module, exports) {
  4364. ;(function (root, factory, undef) {
  4365. if (typeof exports === "object") {
  4366. // CommonJS
  4367. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4368. }
  4369. else if (typeof define === "function" && define.amd) {
  4370. // AMD
  4371. define(["./core", "./cipher-core"], factory);
  4372. }
  4373. else {
  4374. // Global (browser)
  4375. factory(root.CryptoJS);
  4376. }
  4377. }(this, function (CryptoJS) {
  4378. /**
  4379. * Electronic Codebook block mode.
  4380. */
  4381. CryptoJS.mode.ECB = (function () {
  4382. var ECB = CryptoJS.lib.BlockCipherMode.extend();
  4383. ECB.Encryptor = ECB.extend({
  4384. processBlock: function (words, offset) {
  4385. this._cipher.encryptBlock(words, offset);
  4386. }
  4387. });
  4388. ECB.Decryptor = ECB.extend({
  4389. processBlock: function (words, offset) {
  4390. this._cipher.decryptBlock(words, offset);
  4391. }
  4392. });
  4393. return ECB;
  4394. }());
  4395. return CryptoJS.mode.ECB;
  4396. }));
  4397. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4398. __DEFINE__(1679274193867, function(require, module, exports) {
  4399. ;(function (root, factory, undef) {
  4400. if (typeof exports === "object") {
  4401. // CommonJS
  4402. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4403. }
  4404. else if (typeof define === "function" && define.amd) {
  4405. // AMD
  4406. define(["./core", "./cipher-core"], factory);
  4407. }
  4408. else {
  4409. // Global (browser)
  4410. factory(root.CryptoJS);
  4411. }
  4412. }(this, function (CryptoJS) {
  4413. /**
  4414. * ANSI X.923 padding strategy.
  4415. */
  4416. CryptoJS.pad.AnsiX923 = {
  4417. pad: function (data, blockSize) {
  4418. // Shortcuts
  4419. var dataSigBytes = data.sigBytes;
  4420. var blockSizeBytes = blockSize * 4;
  4421. // Count padding bytes
  4422. var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
  4423. // Compute last byte position
  4424. var lastBytePos = dataSigBytes + nPaddingBytes - 1;
  4425. // Pad
  4426. data.clamp();
  4427. data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
  4428. data.sigBytes += nPaddingBytes;
  4429. },
  4430. unpad: function (data) {
  4431. // Get number of padding bytes from last byte
  4432. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  4433. // Remove padding
  4434. data.sigBytes -= nPaddingBytes;
  4435. }
  4436. };
  4437. return CryptoJS.pad.Ansix923;
  4438. }));
  4439. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4440. __DEFINE__(1679274193868, function(require, module, exports) {
  4441. ;(function (root, factory, undef) {
  4442. if (typeof exports === "object") {
  4443. // CommonJS
  4444. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4445. }
  4446. else if (typeof define === "function" && define.amd) {
  4447. // AMD
  4448. define(["./core", "./cipher-core"], factory);
  4449. }
  4450. else {
  4451. // Global (browser)
  4452. factory(root.CryptoJS);
  4453. }
  4454. }(this, function (CryptoJS) {
  4455. /**
  4456. * ISO 10126 padding strategy.
  4457. */
  4458. CryptoJS.pad.Iso10126 = {
  4459. pad: function (data, blockSize) {
  4460. // Shortcut
  4461. var blockSizeBytes = blockSize * 4;
  4462. // Count padding bytes
  4463. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  4464. // Pad
  4465. data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
  4466. concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
  4467. },
  4468. unpad: function (data) {
  4469. // Get number of padding bytes from last byte
  4470. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  4471. // Remove padding
  4472. data.sigBytes -= nPaddingBytes;
  4473. }
  4474. };
  4475. return CryptoJS.pad.Iso10126;
  4476. }));
  4477. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4478. __DEFINE__(1679274193869, function(require, module, exports) {
  4479. ;(function (root, factory, undef) {
  4480. if (typeof exports === "object") {
  4481. // CommonJS
  4482. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4483. }
  4484. else if (typeof define === "function" && define.amd) {
  4485. // AMD
  4486. define(["./core", "./cipher-core"], factory);
  4487. }
  4488. else {
  4489. // Global (browser)
  4490. factory(root.CryptoJS);
  4491. }
  4492. }(this, function (CryptoJS) {
  4493. /**
  4494. * ISO/IEC 9797-1 Padding Method 2.
  4495. */
  4496. CryptoJS.pad.Iso97971 = {
  4497. pad: function (data, blockSize) {
  4498. // Add 0x80 byte
  4499. data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
  4500. // Zero pad the rest
  4501. CryptoJS.pad.ZeroPadding.pad(data, blockSize);
  4502. },
  4503. unpad: function (data) {
  4504. // Remove zero padding
  4505. CryptoJS.pad.ZeroPadding.unpad(data);
  4506. // Remove one more byte -- the 0x80 byte
  4507. data.sigBytes--;
  4508. }
  4509. };
  4510. return CryptoJS.pad.Iso97971;
  4511. }));
  4512. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4513. __DEFINE__(1679274193870, function(require, module, exports) {
  4514. ;(function (root, factory, undef) {
  4515. if (typeof exports === "object") {
  4516. // CommonJS
  4517. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4518. }
  4519. else if (typeof define === "function" && define.amd) {
  4520. // AMD
  4521. define(["./core", "./cipher-core"], factory);
  4522. }
  4523. else {
  4524. // Global (browser)
  4525. factory(root.CryptoJS);
  4526. }
  4527. }(this, function (CryptoJS) {
  4528. /**
  4529. * Zero padding strategy.
  4530. */
  4531. CryptoJS.pad.ZeroPadding = {
  4532. pad: function (data, blockSize) {
  4533. // Shortcut
  4534. var blockSizeBytes = blockSize * 4;
  4535. // Pad
  4536. data.clamp();
  4537. data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
  4538. },
  4539. unpad: function (data) {
  4540. // Shortcut
  4541. var dataWords = data.words;
  4542. // Unpad
  4543. var i = data.sigBytes - 1;
  4544. for (var i = data.sigBytes - 1; i >= 0; i--) {
  4545. if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
  4546. data.sigBytes = i + 1;
  4547. break;
  4548. }
  4549. }
  4550. }
  4551. };
  4552. return CryptoJS.pad.ZeroPadding;
  4553. }));
  4554. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4555. __DEFINE__(1679274193871, function(require, module, exports) {
  4556. ;(function (root, factory, undef) {
  4557. if (typeof exports === "object") {
  4558. // CommonJS
  4559. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4560. }
  4561. else if (typeof define === "function" && define.amd) {
  4562. // AMD
  4563. define(["./core", "./cipher-core"], factory);
  4564. }
  4565. else {
  4566. // Global (browser)
  4567. factory(root.CryptoJS);
  4568. }
  4569. }(this, function (CryptoJS) {
  4570. /**
  4571. * A noop padding strategy.
  4572. */
  4573. CryptoJS.pad.NoPadding = {
  4574. pad: function () {
  4575. },
  4576. unpad: function () {
  4577. }
  4578. };
  4579. return CryptoJS.pad.NoPadding;
  4580. }));
  4581. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4582. __DEFINE__(1679274193872, function(require, module, exports) {
  4583. ;(function (root, factory, undef) {
  4584. if (typeof exports === "object") {
  4585. // CommonJS
  4586. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4587. }
  4588. else if (typeof define === "function" && define.amd) {
  4589. // AMD
  4590. define(["./core", "./cipher-core"], factory);
  4591. }
  4592. else {
  4593. // Global (browser)
  4594. factory(root.CryptoJS);
  4595. }
  4596. }(this, function (CryptoJS) {
  4597. (function (undefined) {
  4598. // Shortcuts
  4599. var C = CryptoJS;
  4600. var C_lib = C.lib;
  4601. var CipherParams = C_lib.CipherParams;
  4602. var C_enc = C.enc;
  4603. var Hex = C_enc.Hex;
  4604. var C_format = C.format;
  4605. var HexFormatter = C_format.Hex = {
  4606. /**
  4607. * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  4608. *
  4609. * @param {CipherParams} cipherParams The cipher params object.
  4610. *
  4611. * @return {string} The hexadecimally encoded string.
  4612. *
  4613. * @static
  4614. *
  4615. * @example
  4616. *
  4617. * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  4618. */
  4619. stringify: function (cipherParams) {
  4620. return cipherParams.ciphertext.toString(Hex);
  4621. },
  4622. /**
  4623. * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  4624. *
  4625. * @param {string} input The hexadecimally encoded string.
  4626. *
  4627. * @return {CipherParams} The cipher params object.
  4628. *
  4629. * @static
  4630. *
  4631. * @example
  4632. *
  4633. * var cipherParams = CryptoJS.format.Hex.parse(hexString);
  4634. */
  4635. parse: function (input) {
  4636. var ciphertext = Hex.parse(input);
  4637. return CipherParams.create({ ciphertext: ciphertext });
  4638. }
  4639. };
  4640. }());
  4641. return CryptoJS.format.Hex;
  4642. }));
  4643. }, function(modId) { var map = {"./core":1679274193844,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4644. __DEFINE__(1679274193873, function(require, module, exports) {
  4645. ;(function (root, factory, undef) {
  4646. if (typeof exports === "object") {
  4647. // CommonJS
  4648. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  4649. }
  4650. else if (typeof define === "function" && define.amd) {
  4651. // AMD
  4652. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  4653. }
  4654. else {
  4655. // Global (browser)
  4656. factory(root.CryptoJS);
  4657. }
  4658. }(this, function (CryptoJS) {
  4659. (function () {
  4660. // Shortcuts
  4661. var C = CryptoJS;
  4662. var C_lib = C.lib;
  4663. var BlockCipher = C_lib.BlockCipher;
  4664. var C_algo = C.algo;
  4665. // Lookup tables
  4666. var SBOX = [];
  4667. var INV_SBOX = [];
  4668. var SUB_MIX_0 = [];
  4669. var SUB_MIX_1 = [];
  4670. var SUB_MIX_2 = [];
  4671. var SUB_MIX_3 = [];
  4672. var INV_SUB_MIX_0 = [];
  4673. var INV_SUB_MIX_1 = [];
  4674. var INV_SUB_MIX_2 = [];
  4675. var INV_SUB_MIX_3 = [];
  4676. // Compute lookup tables
  4677. (function () {
  4678. // Compute double table
  4679. var d = [];
  4680. for (var i = 0; i < 256; i++) {
  4681. if (i < 128) {
  4682. d[i] = i << 1;
  4683. } else {
  4684. d[i] = (i << 1) ^ 0x11b;
  4685. }
  4686. }
  4687. // Walk GF(2^8)
  4688. var x = 0;
  4689. var xi = 0;
  4690. for (var i = 0; i < 256; i++) {
  4691. // Compute sbox
  4692. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  4693. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  4694. SBOX[x] = sx;
  4695. INV_SBOX[sx] = x;
  4696. // Compute multiplication
  4697. var x2 = d[x];
  4698. var x4 = d[x2];
  4699. var x8 = d[x4];
  4700. // Compute sub bytes, mix columns tables
  4701. var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  4702. SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  4703. SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  4704. SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  4705. SUB_MIX_3[x] = t;
  4706. // Compute inv sub bytes, inv mix columns tables
  4707. var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  4708. INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  4709. INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  4710. INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  4711. INV_SUB_MIX_3[sx] = t;
  4712. // Compute next counter
  4713. if (!x) {
  4714. x = xi = 1;
  4715. } else {
  4716. x = x2 ^ d[d[d[x8 ^ x2]]];
  4717. xi ^= d[d[xi]];
  4718. }
  4719. }
  4720. }());
  4721. // Precomputed Rcon lookup
  4722. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  4723. /**
  4724. * AES block cipher algorithm.
  4725. */
  4726. var AES = C_algo.AES = BlockCipher.extend({
  4727. _doReset: function () {
  4728. var t;
  4729. // Skip reset of nRounds has been set before and key did not change
  4730. if (this._nRounds && this._keyPriorReset === this._key) {
  4731. return;
  4732. }
  4733. // Shortcuts
  4734. var key = this._keyPriorReset = this._key;
  4735. var keyWords = key.words;
  4736. var keySize = key.sigBytes / 4;
  4737. // Compute number of rounds
  4738. var nRounds = this._nRounds = keySize + 6;
  4739. // Compute number of key schedule rows
  4740. var ksRows = (nRounds + 1) * 4;
  4741. // Compute key schedule
  4742. var keySchedule = this._keySchedule = [];
  4743. for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  4744. if (ksRow < keySize) {
  4745. keySchedule[ksRow] = keyWords[ksRow];
  4746. } else {
  4747. t = keySchedule[ksRow - 1];
  4748. if (!(ksRow % keySize)) {
  4749. // Rot word
  4750. t = (t << 8) | (t >>> 24);
  4751. // Sub word
  4752. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  4753. // Mix Rcon
  4754. t ^= RCON[(ksRow / keySize) | 0] << 24;
  4755. } else if (keySize > 6 && ksRow % keySize == 4) {
  4756. // Sub word
  4757. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  4758. }
  4759. keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  4760. }
  4761. }
  4762. // Compute inv key schedule
  4763. var invKeySchedule = this._invKeySchedule = [];
  4764. for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  4765. var ksRow = ksRows - invKsRow;
  4766. if (invKsRow % 4) {
  4767. var t = keySchedule[ksRow];
  4768. } else {
  4769. var t = keySchedule[ksRow - 4];
  4770. }
  4771. if (invKsRow < 4 || ksRow <= 4) {
  4772. invKeySchedule[invKsRow] = t;
  4773. } else {
  4774. invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  4775. INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  4776. }
  4777. }
  4778. },
  4779. encryptBlock: function (M, offset) {
  4780. this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  4781. },
  4782. decryptBlock: function (M, offset) {
  4783. // Swap 2nd and 4th rows
  4784. var t = M[offset + 1];
  4785. M[offset + 1] = M[offset + 3];
  4786. M[offset + 3] = t;
  4787. this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  4788. // Inv swap 2nd and 4th rows
  4789. var t = M[offset + 1];
  4790. M[offset + 1] = M[offset + 3];
  4791. M[offset + 3] = t;
  4792. },
  4793. _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  4794. // Shortcut
  4795. var nRounds = this._nRounds;
  4796. // Get input, add round key
  4797. var s0 = M[offset] ^ keySchedule[0];
  4798. var s1 = M[offset + 1] ^ keySchedule[1];
  4799. var s2 = M[offset + 2] ^ keySchedule[2];
  4800. var s3 = M[offset + 3] ^ keySchedule[3];
  4801. // Key schedule row counter
  4802. var ksRow = 4;
  4803. // Rounds
  4804. for (var round = 1; round < nRounds; round++) {
  4805. // Shift rows, sub bytes, mix columns, add round key
  4806. 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++];
  4807. 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++];
  4808. 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++];
  4809. 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++];
  4810. // Update state
  4811. s0 = t0;
  4812. s1 = t1;
  4813. s2 = t2;
  4814. s3 = t3;
  4815. }
  4816. // Shift rows, sub bytes, add round key
  4817. var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  4818. var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  4819. var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  4820. var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  4821. // Set output
  4822. M[offset] = t0;
  4823. M[offset + 1] = t1;
  4824. M[offset + 2] = t2;
  4825. M[offset + 3] = t3;
  4826. },
  4827. keySize: 256/32
  4828. });
  4829. /**
  4830. * Shortcut functions to the cipher's object interface.
  4831. *
  4832. * @example
  4833. *
  4834. * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  4835. * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  4836. */
  4837. C.AES = BlockCipher._createHelper(AES);
  4838. }());
  4839. return CryptoJS.AES;
  4840. }));
  4841. }, function(modId) { var map = {"./core":1679274193844,"./enc-base64":1679274193848,"./md5":1679274193850,"./evpkdf":1679274193860,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  4842. __DEFINE__(1679274193874, function(require, module, exports) {
  4843. ;(function (root, factory, undef) {
  4844. if (typeof exports === "object") {
  4845. // CommonJS
  4846. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  4847. }
  4848. else if (typeof define === "function" && define.amd) {
  4849. // AMD
  4850. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  4851. }
  4852. else {
  4853. // Global (browser)
  4854. factory(root.CryptoJS);
  4855. }
  4856. }(this, function (CryptoJS) {
  4857. (function () {
  4858. // Shortcuts
  4859. var C = CryptoJS;
  4860. var C_lib = C.lib;
  4861. var WordArray = C_lib.WordArray;
  4862. var BlockCipher = C_lib.BlockCipher;
  4863. var C_algo = C.algo;
  4864. // Permuted Choice 1 constants
  4865. var PC1 = [
  4866. 57, 49, 41, 33, 25, 17, 9, 1,
  4867. 58, 50, 42, 34, 26, 18, 10, 2,
  4868. 59, 51, 43, 35, 27, 19, 11, 3,
  4869. 60, 52, 44, 36, 63, 55, 47, 39,
  4870. 31, 23, 15, 7, 62, 54, 46, 38,
  4871. 30, 22, 14, 6, 61, 53, 45, 37,
  4872. 29, 21, 13, 5, 28, 20, 12, 4
  4873. ];
  4874. // Permuted Choice 2 constants
  4875. var PC2 = [
  4876. 14, 17, 11, 24, 1, 5,
  4877. 3, 28, 15, 6, 21, 10,
  4878. 23, 19, 12, 4, 26, 8,
  4879. 16, 7, 27, 20, 13, 2,
  4880. 41, 52, 31, 37, 47, 55,
  4881. 30, 40, 51, 45, 33, 48,
  4882. 44, 49, 39, 56, 34, 53,
  4883. 46, 42, 50, 36, 29, 32
  4884. ];
  4885. // Cumulative bit shift constants
  4886. var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
  4887. // SBOXes and round permutation constants
  4888. var SBOX_P = [
  4889. {
  4890. 0x0: 0x808200,
  4891. 0x10000000: 0x8000,
  4892. 0x20000000: 0x808002,
  4893. 0x30000000: 0x2,
  4894. 0x40000000: 0x200,
  4895. 0x50000000: 0x808202,
  4896. 0x60000000: 0x800202,
  4897. 0x70000000: 0x800000,
  4898. 0x80000000: 0x202,
  4899. 0x90000000: 0x800200,
  4900. 0xa0000000: 0x8200,
  4901. 0xb0000000: 0x808000,
  4902. 0xc0000000: 0x8002,
  4903. 0xd0000000: 0x800002,
  4904. 0xe0000000: 0x0,
  4905. 0xf0000000: 0x8202,
  4906. 0x8000000: 0x0,
  4907. 0x18000000: 0x808202,
  4908. 0x28000000: 0x8202,
  4909. 0x38000000: 0x8000,
  4910. 0x48000000: 0x808200,
  4911. 0x58000000: 0x200,
  4912. 0x68000000: 0x808002,
  4913. 0x78000000: 0x2,
  4914. 0x88000000: 0x800200,
  4915. 0x98000000: 0x8200,
  4916. 0xa8000000: 0x808000,
  4917. 0xb8000000: 0x800202,
  4918. 0xc8000000: 0x800002,
  4919. 0xd8000000: 0x8002,
  4920. 0xe8000000: 0x202,
  4921. 0xf8000000: 0x800000,
  4922. 0x1: 0x8000,
  4923. 0x10000001: 0x2,
  4924. 0x20000001: 0x808200,
  4925. 0x30000001: 0x800000,
  4926. 0x40000001: 0x808002,
  4927. 0x50000001: 0x8200,
  4928. 0x60000001: 0x200,
  4929. 0x70000001: 0x800202,
  4930. 0x80000001: 0x808202,
  4931. 0x90000001: 0x808000,
  4932. 0xa0000001: 0x800002,
  4933. 0xb0000001: 0x8202,
  4934. 0xc0000001: 0x202,
  4935. 0xd0000001: 0x800200,
  4936. 0xe0000001: 0x8002,
  4937. 0xf0000001: 0x0,
  4938. 0x8000001: 0x808202,
  4939. 0x18000001: 0x808000,
  4940. 0x28000001: 0x800000,
  4941. 0x38000001: 0x200,
  4942. 0x48000001: 0x8000,
  4943. 0x58000001: 0x800002,
  4944. 0x68000001: 0x2,
  4945. 0x78000001: 0x8202,
  4946. 0x88000001: 0x8002,
  4947. 0x98000001: 0x800202,
  4948. 0xa8000001: 0x202,
  4949. 0xb8000001: 0x808200,
  4950. 0xc8000001: 0x800200,
  4951. 0xd8000001: 0x0,
  4952. 0xe8000001: 0x8200,
  4953. 0xf8000001: 0x808002
  4954. },
  4955. {
  4956. 0x0: 0x40084010,
  4957. 0x1000000: 0x4000,
  4958. 0x2000000: 0x80000,
  4959. 0x3000000: 0x40080010,
  4960. 0x4000000: 0x40000010,
  4961. 0x5000000: 0x40084000,
  4962. 0x6000000: 0x40004000,
  4963. 0x7000000: 0x10,
  4964. 0x8000000: 0x84000,
  4965. 0x9000000: 0x40004010,
  4966. 0xa000000: 0x40000000,
  4967. 0xb000000: 0x84010,
  4968. 0xc000000: 0x80010,
  4969. 0xd000000: 0x0,
  4970. 0xe000000: 0x4010,
  4971. 0xf000000: 0x40080000,
  4972. 0x800000: 0x40004000,
  4973. 0x1800000: 0x84010,
  4974. 0x2800000: 0x10,
  4975. 0x3800000: 0x40004010,
  4976. 0x4800000: 0x40084010,
  4977. 0x5800000: 0x40000000,
  4978. 0x6800000: 0x80000,
  4979. 0x7800000: 0x40080010,
  4980. 0x8800000: 0x80010,
  4981. 0x9800000: 0x0,
  4982. 0xa800000: 0x4000,
  4983. 0xb800000: 0x40080000,
  4984. 0xc800000: 0x40000010,
  4985. 0xd800000: 0x84000,
  4986. 0xe800000: 0x40084000,
  4987. 0xf800000: 0x4010,
  4988. 0x10000000: 0x0,
  4989. 0x11000000: 0x40080010,
  4990. 0x12000000: 0x40004010,
  4991. 0x13000000: 0x40084000,
  4992. 0x14000000: 0x40080000,
  4993. 0x15000000: 0x10,
  4994. 0x16000000: 0x84010,
  4995. 0x17000000: 0x4000,
  4996. 0x18000000: 0x4010,
  4997. 0x19000000: 0x80000,
  4998. 0x1a000000: 0x80010,
  4999. 0x1b000000: 0x40000010,
  5000. 0x1c000000: 0x84000,
  5001. 0x1d000000: 0x40004000,
  5002. 0x1e000000: 0x40000000,
  5003. 0x1f000000: 0x40084010,
  5004. 0x10800000: 0x84010,
  5005. 0x11800000: 0x80000,
  5006. 0x12800000: 0x40080000,
  5007. 0x13800000: 0x4000,
  5008. 0x14800000: 0x40004000,
  5009. 0x15800000: 0x40084010,
  5010. 0x16800000: 0x10,
  5011. 0x17800000: 0x40000000,
  5012. 0x18800000: 0x40084000,
  5013. 0x19800000: 0x40000010,
  5014. 0x1a800000: 0x40004010,
  5015. 0x1b800000: 0x80010,
  5016. 0x1c800000: 0x0,
  5017. 0x1d800000: 0x4010,
  5018. 0x1e800000: 0x40080010,
  5019. 0x1f800000: 0x84000
  5020. },
  5021. {
  5022. 0x0: 0x104,
  5023. 0x100000: 0x0,
  5024. 0x200000: 0x4000100,
  5025. 0x300000: 0x10104,
  5026. 0x400000: 0x10004,
  5027. 0x500000: 0x4000004,
  5028. 0x600000: 0x4010104,
  5029. 0x700000: 0x4010000,
  5030. 0x800000: 0x4000000,
  5031. 0x900000: 0x4010100,
  5032. 0xa00000: 0x10100,
  5033. 0xb00000: 0x4010004,
  5034. 0xc00000: 0x4000104,
  5035. 0xd00000: 0x10000,
  5036. 0xe00000: 0x4,
  5037. 0xf00000: 0x100,
  5038. 0x80000: 0x4010100,
  5039. 0x180000: 0x4010004,
  5040. 0x280000: 0x0,
  5041. 0x380000: 0x4000100,
  5042. 0x480000: 0x4000004,
  5043. 0x580000: 0x10000,
  5044. 0x680000: 0x10004,
  5045. 0x780000: 0x104,
  5046. 0x880000: 0x4,
  5047. 0x980000: 0x100,
  5048. 0xa80000: 0x4010000,
  5049. 0xb80000: 0x10104,
  5050. 0xc80000: 0x10100,
  5051. 0xd80000: 0x4000104,
  5052. 0xe80000: 0x4010104,
  5053. 0xf80000: 0x4000000,
  5054. 0x1000000: 0x4010100,
  5055. 0x1100000: 0x10004,
  5056. 0x1200000: 0x10000,
  5057. 0x1300000: 0x4000100,
  5058. 0x1400000: 0x100,
  5059. 0x1500000: 0x4010104,
  5060. 0x1600000: 0x4000004,
  5061. 0x1700000: 0x0,
  5062. 0x1800000: 0x4000104,
  5063. 0x1900000: 0x4000000,
  5064. 0x1a00000: 0x4,
  5065. 0x1b00000: 0x10100,
  5066. 0x1c00000: 0x4010000,
  5067. 0x1d00000: 0x104,
  5068. 0x1e00000: 0x10104,
  5069. 0x1f00000: 0x4010004,
  5070. 0x1080000: 0x4000000,
  5071. 0x1180000: 0x104,
  5072. 0x1280000: 0x4010100,
  5073. 0x1380000: 0x0,
  5074. 0x1480000: 0x10004,
  5075. 0x1580000: 0x4000100,
  5076. 0x1680000: 0x100,
  5077. 0x1780000: 0x4010004,
  5078. 0x1880000: 0x10000,
  5079. 0x1980000: 0x4010104,
  5080. 0x1a80000: 0x10104,
  5081. 0x1b80000: 0x4000004,
  5082. 0x1c80000: 0x4000104,
  5083. 0x1d80000: 0x4010000,
  5084. 0x1e80000: 0x4,
  5085. 0x1f80000: 0x10100
  5086. },
  5087. {
  5088. 0x0: 0x80401000,
  5089. 0x10000: 0x80001040,
  5090. 0x20000: 0x401040,
  5091. 0x30000: 0x80400000,
  5092. 0x40000: 0x0,
  5093. 0x50000: 0x401000,
  5094. 0x60000: 0x80000040,
  5095. 0x70000: 0x400040,
  5096. 0x80000: 0x80000000,
  5097. 0x90000: 0x400000,
  5098. 0xa0000: 0x40,
  5099. 0xb0000: 0x80001000,
  5100. 0xc0000: 0x80400040,
  5101. 0xd0000: 0x1040,
  5102. 0xe0000: 0x1000,
  5103. 0xf0000: 0x80401040,
  5104. 0x8000: 0x80001040,
  5105. 0x18000: 0x40,
  5106. 0x28000: 0x80400040,
  5107. 0x38000: 0x80001000,
  5108. 0x48000: 0x401000,
  5109. 0x58000: 0x80401040,
  5110. 0x68000: 0x0,
  5111. 0x78000: 0x80400000,
  5112. 0x88000: 0x1000,
  5113. 0x98000: 0x80401000,
  5114. 0xa8000: 0x400000,
  5115. 0xb8000: 0x1040,
  5116. 0xc8000: 0x80000000,
  5117. 0xd8000: 0x400040,
  5118. 0xe8000: 0x401040,
  5119. 0xf8000: 0x80000040,
  5120. 0x100000: 0x400040,
  5121. 0x110000: 0x401000,
  5122. 0x120000: 0x80000040,
  5123. 0x130000: 0x0,
  5124. 0x140000: 0x1040,
  5125. 0x150000: 0x80400040,
  5126. 0x160000: 0x80401000,
  5127. 0x170000: 0x80001040,
  5128. 0x180000: 0x80401040,
  5129. 0x190000: 0x80000000,
  5130. 0x1a0000: 0x80400000,
  5131. 0x1b0000: 0x401040,
  5132. 0x1c0000: 0x80001000,
  5133. 0x1d0000: 0x400000,
  5134. 0x1e0000: 0x40,
  5135. 0x1f0000: 0x1000,
  5136. 0x108000: 0x80400000,
  5137. 0x118000: 0x80401040,
  5138. 0x128000: 0x0,
  5139. 0x138000: 0x401000,
  5140. 0x148000: 0x400040,
  5141. 0x158000: 0x80000000,
  5142. 0x168000: 0x80001040,
  5143. 0x178000: 0x40,
  5144. 0x188000: 0x80000040,
  5145. 0x198000: 0x1000,
  5146. 0x1a8000: 0x80001000,
  5147. 0x1b8000: 0x80400040,
  5148. 0x1c8000: 0x1040,
  5149. 0x1d8000: 0x80401000,
  5150. 0x1e8000: 0x400000,
  5151. 0x1f8000: 0x401040
  5152. },
  5153. {
  5154. 0x0: 0x80,
  5155. 0x1000: 0x1040000,
  5156. 0x2000: 0x40000,
  5157. 0x3000: 0x20000000,
  5158. 0x4000: 0x20040080,
  5159. 0x5000: 0x1000080,
  5160. 0x6000: 0x21000080,
  5161. 0x7000: 0x40080,
  5162. 0x8000: 0x1000000,
  5163. 0x9000: 0x20040000,
  5164. 0xa000: 0x20000080,
  5165. 0xb000: 0x21040080,
  5166. 0xc000: 0x21040000,
  5167. 0xd000: 0x0,
  5168. 0xe000: 0x1040080,
  5169. 0xf000: 0x21000000,
  5170. 0x800: 0x1040080,
  5171. 0x1800: 0x21000080,
  5172. 0x2800: 0x80,
  5173. 0x3800: 0x1040000,
  5174. 0x4800: 0x40000,
  5175. 0x5800: 0x20040080,
  5176. 0x6800: 0x21040000,
  5177. 0x7800: 0x20000000,
  5178. 0x8800: 0x20040000,
  5179. 0x9800: 0x0,
  5180. 0xa800: 0x21040080,
  5181. 0xb800: 0x1000080,
  5182. 0xc800: 0x20000080,
  5183. 0xd800: 0x21000000,
  5184. 0xe800: 0x1000000,
  5185. 0xf800: 0x40080,
  5186. 0x10000: 0x40000,
  5187. 0x11000: 0x80,
  5188. 0x12000: 0x20000000,
  5189. 0x13000: 0x21000080,
  5190. 0x14000: 0x1000080,
  5191. 0x15000: 0x21040000,
  5192. 0x16000: 0x20040080,
  5193. 0x17000: 0x1000000,
  5194. 0x18000: 0x21040080,
  5195. 0x19000: 0x21000000,
  5196. 0x1a000: 0x1040000,
  5197. 0x1b000: 0x20040000,
  5198. 0x1c000: 0x40080,
  5199. 0x1d000: 0x20000080,
  5200. 0x1e000: 0x0,
  5201. 0x1f000: 0x1040080,
  5202. 0x10800: 0x21000080,
  5203. 0x11800: 0x1000000,
  5204. 0x12800: 0x1040000,
  5205. 0x13800: 0x20040080,
  5206. 0x14800: 0x20000000,
  5207. 0x15800: 0x1040080,
  5208. 0x16800: 0x80,
  5209. 0x17800: 0x21040000,
  5210. 0x18800: 0x40080,
  5211. 0x19800: 0x21040080,
  5212. 0x1a800: 0x0,
  5213. 0x1b800: 0x21000000,
  5214. 0x1c800: 0x1000080,
  5215. 0x1d800: 0x40000,
  5216. 0x1e800: 0x20040000,
  5217. 0x1f800: 0x20000080
  5218. },
  5219. {
  5220. 0x0: 0x10000008,
  5221. 0x100: 0x2000,
  5222. 0x200: 0x10200000,
  5223. 0x300: 0x10202008,
  5224. 0x400: 0x10002000,
  5225. 0x500: 0x200000,
  5226. 0x600: 0x200008,
  5227. 0x700: 0x10000000,
  5228. 0x800: 0x0,
  5229. 0x900: 0x10002008,
  5230. 0xa00: 0x202000,
  5231. 0xb00: 0x8,
  5232. 0xc00: 0x10200008,
  5233. 0xd00: 0x202008,
  5234. 0xe00: 0x2008,
  5235. 0xf00: 0x10202000,
  5236. 0x80: 0x10200000,
  5237. 0x180: 0x10202008,
  5238. 0x280: 0x8,
  5239. 0x380: 0x200000,
  5240. 0x480: 0x202008,
  5241. 0x580: 0x10000008,
  5242. 0x680: 0x10002000,
  5243. 0x780: 0x2008,
  5244. 0x880: 0x200008,
  5245. 0x980: 0x2000,
  5246. 0xa80: 0x10002008,
  5247. 0xb80: 0x10200008,
  5248. 0xc80: 0x0,
  5249. 0xd80: 0x10202000,
  5250. 0xe80: 0x202000,
  5251. 0xf80: 0x10000000,
  5252. 0x1000: 0x10002000,
  5253. 0x1100: 0x10200008,
  5254. 0x1200: 0x10202008,
  5255. 0x1300: 0x2008,
  5256. 0x1400: 0x200000,
  5257. 0x1500: 0x10000000,
  5258. 0x1600: 0x10000008,
  5259. 0x1700: 0x202000,
  5260. 0x1800: 0x202008,
  5261. 0x1900: 0x0,
  5262. 0x1a00: 0x8,
  5263. 0x1b00: 0x10200000,
  5264. 0x1c00: 0x2000,
  5265. 0x1d00: 0x10002008,
  5266. 0x1e00: 0x10202000,
  5267. 0x1f00: 0x200008,
  5268. 0x1080: 0x8,
  5269. 0x1180: 0x202000,
  5270. 0x1280: 0x200000,
  5271. 0x1380: 0x10000008,
  5272. 0x1480: 0x10002000,
  5273. 0x1580: 0x2008,
  5274. 0x1680: 0x10202008,
  5275. 0x1780: 0x10200000,
  5276. 0x1880: 0x10202000,
  5277. 0x1980: 0x10200008,
  5278. 0x1a80: 0x2000,
  5279. 0x1b80: 0x202008,
  5280. 0x1c80: 0x200008,
  5281. 0x1d80: 0x0,
  5282. 0x1e80: 0x10000000,
  5283. 0x1f80: 0x10002008
  5284. },
  5285. {
  5286. 0x0: 0x100000,
  5287. 0x10: 0x2000401,
  5288. 0x20: 0x400,
  5289. 0x30: 0x100401,
  5290. 0x40: 0x2100401,
  5291. 0x50: 0x0,
  5292. 0x60: 0x1,
  5293. 0x70: 0x2100001,
  5294. 0x80: 0x2000400,
  5295. 0x90: 0x100001,
  5296. 0xa0: 0x2000001,
  5297. 0xb0: 0x2100400,
  5298. 0xc0: 0x2100000,
  5299. 0xd0: 0x401,
  5300. 0xe0: 0x100400,
  5301. 0xf0: 0x2000000,
  5302. 0x8: 0x2100001,
  5303. 0x18: 0x0,
  5304. 0x28: 0x2000401,
  5305. 0x38: 0x2100400,
  5306. 0x48: 0x100000,
  5307. 0x58: 0x2000001,
  5308. 0x68: 0x2000000,
  5309. 0x78: 0x401,
  5310. 0x88: 0x100401,
  5311. 0x98: 0x2000400,
  5312. 0xa8: 0x2100000,
  5313. 0xb8: 0x100001,
  5314. 0xc8: 0x400,
  5315. 0xd8: 0x2100401,
  5316. 0xe8: 0x1,
  5317. 0xf8: 0x100400,
  5318. 0x100: 0x2000000,
  5319. 0x110: 0x100000,
  5320. 0x120: 0x2000401,
  5321. 0x130: 0x2100001,
  5322. 0x140: 0x100001,
  5323. 0x150: 0x2000400,
  5324. 0x160: 0x2100400,
  5325. 0x170: 0x100401,
  5326. 0x180: 0x401,
  5327. 0x190: 0x2100401,
  5328. 0x1a0: 0x100400,
  5329. 0x1b0: 0x1,
  5330. 0x1c0: 0x0,
  5331. 0x1d0: 0x2100000,
  5332. 0x1e0: 0x2000001,
  5333. 0x1f0: 0x400,
  5334. 0x108: 0x100400,
  5335. 0x118: 0x2000401,
  5336. 0x128: 0x2100001,
  5337. 0x138: 0x1,
  5338. 0x148: 0x2000000,
  5339. 0x158: 0x100000,
  5340. 0x168: 0x401,
  5341. 0x178: 0x2100400,
  5342. 0x188: 0x2000001,
  5343. 0x198: 0x2100000,
  5344. 0x1a8: 0x0,
  5345. 0x1b8: 0x2100401,
  5346. 0x1c8: 0x100401,
  5347. 0x1d8: 0x400,
  5348. 0x1e8: 0x2000400,
  5349. 0x1f8: 0x100001
  5350. },
  5351. {
  5352. 0x0: 0x8000820,
  5353. 0x1: 0x20000,
  5354. 0x2: 0x8000000,
  5355. 0x3: 0x20,
  5356. 0x4: 0x20020,
  5357. 0x5: 0x8020820,
  5358. 0x6: 0x8020800,
  5359. 0x7: 0x800,
  5360. 0x8: 0x8020000,
  5361. 0x9: 0x8000800,
  5362. 0xa: 0x20800,
  5363. 0xb: 0x8020020,
  5364. 0xc: 0x820,
  5365. 0xd: 0x0,
  5366. 0xe: 0x8000020,
  5367. 0xf: 0x20820,
  5368. 0x80000000: 0x800,
  5369. 0x80000001: 0x8020820,
  5370. 0x80000002: 0x8000820,
  5371. 0x80000003: 0x8000000,
  5372. 0x80000004: 0x8020000,
  5373. 0x80000005: 0x20800,
  5374. 0x80000006: 0x20820,
  5375. 0x80000007: 0x20,
  5376. 0x80000008: 0x8000020,
  5377. 0x80000009: 0x820,
  5378. 0x8000000a: 0x20020,
  5379. 0x8000000b: 0x8020800,
  5380. 0x8000000c: 0x0,
  5381. 0x8000000d: 0x8020020,
  5382. 0x8000000e: 0x8000800,
  5383. 0x8000000f: 0x20000,
  5384. 0x10: 0x20820,
  5385. 0x11: 0x8020800,
  5386. 0x12: 0x20,
  5387. 0x13: 0x800,
  5388. 0x14: 0x8000800,
  5389. 0x15: 0x8000020,
  5390. 0x16: 0x8020020,
  5391. 0x17: 0x20000,
  5392. 0x18: 0x0,
  5393. 0x19: 0x20020,
  5394. 0x1a: 0x8020000,
  5395. 0x1b: 0x8000820,
  5396. 0x1c: 0x8020820,
  5397. 0x1d: 0x20800,
  5398. 0x1e: 0x820,
  5399. 0x1f: 0x8000000,
  5400. 0x80000010: 0x20000,
  5401. 0x80000011: 0x800,
  5402. 0x80000012: 0x8020020,
  5403. 0x80000013: 0x20820,
  5404. 0x80000014: 0x20,
  5405. 0x80000015: 0x8020000,
  5406. 0x80000016: 0x8000000,
  5407. 0x80000017: 0x8000820,
  5408. 0x80000018: 0x8020820,
  5409. 0x80000019: 0x8000020,
  5410. 0x8000001a: 0x8000800,
  5411. 0x8000001b: 0x0,
  5412. 0x8000001c: 0x20800,
  5413. 0x8000001d: 0x820,
  5414. 0x8000001e: 0x20020,
  5415. 0x8000001f: 0x8020800
  5416. }
  5417. ];
  5418. // Masks that select the SBOX input
  5419. var SBOX_MASK = [
  5420. 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
  5421. 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
  5422. ];
  5423. /**
  5424. * DES block cipher algorithm.
  5425. */
  5426. var DES = C_algo.DES = BlockCipher.extend({
  5427. _doReset: function () {
  5428. // Shortcuts
  5429. var key = this._key;
  5430. var keyWords = key.words;
  5431. // Select 56 bits according to PC1
  5432. var keyBits = [];
  5433. for (var i = 0; i < 56; i++) {
  5434. var keyBitPos = PC1[i] - 1;
  5435. keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
  5436. }
  5437. // Assemble 16 subkeys
  5438. var subKeys = this._subKeys = [];
  5439. for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
  5440. // Create subkey
  5441. var subKey = subKeys[nSubKey] = [];
  5442. // Shortcut
  5443. var bitShift = BIT_SHIFTS[nSubKey];
  5444. // Select 48 bits according to PC2
  5445. for (var i = 0; i < 24; i++) {
  5446. // Select from the left 28 key bits
  5447. subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
  5448. // Select from the right 28 key bits
  5449. subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
  5450. }
  5451. // Since each subkey is applied to an expanded 32-bit input,
  5452. // the subkey can be broken into 8 values scaled to 32-bits,
  5453. // which allows the key to be used without expansion
  5454. subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
  5455. for (var i = 1; i < 7; i++) {
  5456. subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
  5457. }
  5458. subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
  5459. }
  5460. // Compute inverse subkeys
  5461. var invSubKeys = this._invSubKeys = [];
  5462. for (var i = 0; i < 16; i++) {
  5463. invSubKeys[i] = subKeys[15 - i];
  5464. }
  5465. },
  5466. encryptBlock: function (M, offset) {
  5467. this._doCryptBlock(M, offset, this._subKeys);
  5468. },
  5469. decryptBlock: function (M, offset) {
  5470. this._doCryptBlock(M, offset, this._invSubKeys);
  5471. },
  5472. _doCryptBlock: function (M, offset, subKeys) {
  5473. // Get input
  5474. this._lBlock = M[offset];
  5475. this._rBlock = M[offset + 1];
  5476. // Initial permutation
  5477. exchangeLR.call(this, 4, 0x0f0f0f0f);
  5478. exchangeLR.call(this, 16, 0x0000ffff);
  5479. exchangeRL.call(this, 2, 0x33333333);
  5480. exchangeRL.call(this, 8, 0x00ff00ff);
  5481. exchangeLR.call(this, 1, 0x55555555);
  5482. // Rounds
  5483. for (var round = 0; round < 16; round++) {
  5484. // Shortcuts
  5485. var subKey = subKeys[round];
  5486. var lBlock = this._lBlock;
  5487. var rBlock = this._rBlock;
  5488. // Feistel function
  5489. var f = 0;
  5490. for (var i = 0; i < 8; i++) {
  5491. f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
  5492. }
  5493. this._lBlock = rBlock;
  5494. this._rBlock = lBlock ^ f;
  5495. }
  5496. // Undo swap from last round
  5497. var t = this._lBlock;
  5498. this._lBlock = this._rBlock;
  5499. this._rBlock = t;
  5500. // Final permutation
  5501. exchangeLR.call(this, 1, 0x55555555);
  5502. exchangeRL.call(this, 8, 0x00ff00ff);
  5503. exchangeRL.call(this, 2, 0x33333333);
  5504. exchangeLR.call(this, 16, 0x0000ffff);
  5505. exchangeLR.call(this, 4, 0x0f0f0f0f);
  5506. // Set output
  5507. M[offset] = this._lBlock;
  5508. M[offset + 1] = this._rBlock;
  5509. },
  5510. keySize: 64/32,
  5511. ivSize: 64/32,
  5512. blockSize: 64/32
  5513. });
  5514. // Swap bits across the left and right words
  5515. function exchangeLR(offset, mask) {
  5516. var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
  5517. this._rBlock ^= t;
  5518. this._lBlock ^= t << offset;
  5519. }
  5520. function exchangeRL(offset, mask) {
  5521. var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
  5522. this._lBlock ^= t;
  5523. this._rBlock ^= t << offset;
  5524. }
  5525. /**
  5526. * Shortcut functions to the cipher's object interface.
  5527. *
  5528. * @example
  5529. *
  5530. * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
  5531. * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
  5532. */
  5533. C.DES = BlockCipher._createHelper(DES);
  5534. /**
  5535. * Triple-DES block cipher algorithm.
  5536. */
  5537. var TripleDES = C_algo.TripleDES = BlockCipher.extend({
  5538. _doReset: function () {
  5539. // Shortcuts
  5540. var key = this._key;
  5541. var keyWords = key.words;
  5542. // Make sure the key length is valid (64, 128 or >= 192 bit)
  5543. if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
  5544. throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
  5545. }
  5546. // Extend the key according to the keying options defined in 3DES standard
  5547. var key1 = keyWords.slice(0, 2);
  5548. var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
  5549. var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
  5550. // Create DES instances
  5551. this._des1 = DES.createEncryptor(WordArray.create(key1));
  5552. this._des2 = DES.createEncryptor(WordArray.create(key2));
  5553. this._des3 = DES.createEncryptor(WordArray.create(key3));
  5554. },
  5555. encryptBlock: function (M, offset) {
  5556. this._des1.encryptBlock(M, offset);
  5557. this._des2.decryptBlock(M, offset);
  5558. this._des3.encryptBlock(M, offset);
  5559. },
  5560. decryptBlock: function (M, offset) {
  5561. this._des3.decryptBlock(M, offset);
  5562. this._des2.encryptBlock(M, offset);
  5563. this._des1.decryptBlock(M, offset);
  5564. },
  5565. keySize: 192/32,
  5566. ivSize: 64/32,
  5567. blockSize: 64/32
  5568. });
  5569. /**
  5570. * Shortcut functions to the cipher's object interface.
  5571. *
  5572. * @example
  5573. *
  5574. * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
  5575. * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
  5576. */
  5577. C.TripleDES = BlockCipher._createHelper(TripleDES);
  5578. }());
  5579. return CryptoJS.TripleDES;
  5580. }));
  5581. }, function(modId) { var map = {"./core":1679274193844,"./enc-base64":1679274193848,"./md5":1679274193850,"./evpkdf":1679274193860,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  5582. __DEFINE__(1679274193875, function(require, module, exports) {
  5583. ;(function (root, factory, undef) {
  5584. if (typeof exports === "object") {
  5585. // CommonJS
  5586. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5587. }
  5588. else if (typeof define === "function" && define.amd) {
  5589. // AMD
  5590. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5591. }
  5592. else {
  5593. // Global (browser)
  5594. factory(root.CryptoJS);
  5595. }
  5596. }(this, function (CryptoJS) {
  5597. (function () {
  5598. // Shortcuts
  5599. var C = CryptoJS;
  5600. var C_lib = C.lib;
  5601. var StreamCipher = C_lib.StreamCipher;
  5602. var C_algo = C.algo;
  5603. /**
  5604. * RC4 stream cipher algorithm.
  5605. */
  5606. var RC4 = C_algo.RC4 = StreamCipher.extend({
  5607. _doReset: function () {
  5608. // Shortcuts
  5609. var key = this._key;
  5610. var keyWords = key.words;
  5611. var keySigBytes = key.sigBytes;
  5612. // Init sbox
  5613. var S = this._S = [];
  5614. for (var i = 0; i < 256; i++) {
  5615. S[i] = i;
  5616. }
  5617. // Key setup
  5618. for (var i = 0, j = 0; i < 256; i++) {
  5619. var keyByteIndex = i % keySigBytes;
  5620. var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
  5621. j = (j + S[i] + keyByte) % 256;
  5622. // Swap
  5623. var t = S[i];
  5624. S[i] = S[j];
  5625. S[j] = t;
  5626. }
  5627. // Counters
  5628. this._i = this._j = 0;
  5629. },
  5630. _doProcessBlock: function (M, offset) {
  5631. M[offset] ^= generateKeystreamWord.call(this);
  5632. },
  5633. keySize: 256/32,
  5634. ivSize: 0
  5635. });
  5636. function generateKeystreamWord() {
  5637. // Shortcuts
  5638. var S = this._S;
  5639. var i = this._i;
  5640. var j = this._j;
  5641. // Generate keystream word
  5642. var keystreamWord = 0;
  5643. for (var n = 0; n < 4; n++) {
  5644. i = (i + 1) % 256;
  5645. j = (j + S[i]) % 256;
  5646. // Swap
  5647. var t = S[i];
  5648. S[i] = S[j];
  5649. S[j] = t;
  5650. keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
  5651. }
  5652. // Update counters
  5653. this._i = i;
  5654. this._j = j;
  5655. return keystreamWord;
  5656. }
  5657. /**
  5658. * Shortcut functions to the cipher's object interface.
  5659. *
  5660. * @example
  5661. *
  5662. * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
  5663. * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
  5664. */
  5665. C.RC4 = StreamCipher._createHelper(RC4);
  5666. /**
  5667. * Modified RC4 stream cipher algorithm.
  5668. */
  5669. var RC4Drop = C_algo.RC4Drop = RC4.extend({
  5670. /**
  5671. * Configuration options.
  5672. *
  5673. * @property {number} drop The number of keystream words to drop. Default 192
  5674. */
  5675. cfg: RC4.cfg.extend({
  5676. drop: 192
  5677. }),
  5678. _doReset: function () {
  5679. RC4._doReset.call(this);
  5680. // Drop
  5681. for (var i = this.cfg.drop; i > 0; i--) {
  5682. generateKeystreamWord.call(this);
  5683. }
  5684. }
  5685. });
  5686. /**
  5687. * Shortcut functions to the cipher's object interface.
  5688. *
  5689. * @example
  5690. *
  5691. * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
  5692. * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
  5693. */
  5694. C.RC4Drop = StreamCipher._createHelper(RC4Drop);
  5695. }());
  5696. return CryptoJS.RC4;
  5697. }));
  5698. }, function(modId) { var map = {"./core":1679274193844,"./enc-base64":1679274193848,"./md5":1679274193850,"./evpkdf":1679274193860,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  5699. __DEFINE__(1679274193876, function(require, module, exports) {
  5700. ;(function (root, factory, undef) {
  5701. if (typeof exports === "object") {
  5702. // CommonJS
  5703. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5704. }
  5705. else if (typeof define === "function" && define.amd) {
  5706. // AMD
  5707. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5708. }
  5709. else {
  5710. // Global (browser)
  5711. factory(root.CryptoJS);
  5712. }
  5713. }(this, function (CryptoJS) {
  5714. (function () {
  5715. // Shortcuts
  5716. var C = CryptoJS;
  5717. var C_lib = C.lib;
  5718. var StreamCipher = C_lib.StreamCipher;
  5719. var C_algo = C.algo;
  5720. // Reusable objects
  5721. var S = [];
  5722. var C_ = [];
  5723. var G = [];
  5724. /**
  5725. * Rabbit stream cipher algorithm
  5726. */
  5727. var Rabbit = C_algo.Rabbit = StreamCipher.extend({
  5728. _doReset: function () {
  5729. // Shortcuts
  5730. var K = this._key.words;
  5731. var iv = this.cfg.iv;
  5732. // Swap endian
  5733. for (var i = 0; i < 4; i++) {
  5734. K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
  5735. (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
  5736. }
  5737. // Generate initial state values
  5738. var X = this._X = [
  5739. K[0], (K[3] << 16) | (K[2] >>> 16),
  5740. K[1], (K[0] << 16) | (K[3] >>> 16),
  5741. K[2], (K[1] << 16) | (K[0] >>> 16),
  5742. K[3], (K[2] << 16) | (K[1] >>> 16)
  5743. ];
  5744. // Generate initial counter values
  5745. var C = this._C = [
  5746. (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
  5747. (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
  5748. (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
  5749. (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
  5750. ];
  5751. // Carry bit
  5752. this._b = 0;
  5753. // Iterate the system four times
  5754. for (var i = 0; i < 4; i++) {
  5755. nextState.call(this);
  5756. }
  5757. // Modify the counters
  5758. for (var i = 0; i < 8; i++) {
  5759. C[i] ^= X[(i + 4) & 7];
  5760. }
  5761. // IV setup
  5762. if (iv) {
  5763. // Shortcuts
  5764. var IV = iv.words;
  5765. var IV_0 = IV[0];
  5766. var IV_1 = IV[1];
  5767. // Generate four subvectors
  5768. var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
  5769. var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
  5770. var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
  5771. var i3 = (i2 << 16) | (i0 & 0x0000ffff);
  5772. // Modify counter values
  5773. C[0] ^= i0;
  5774. C[1] ^= i1;
  5775. C[2] ^= i2;
  5776. C[3] ^= i3;
  5777. C[4] ^= i0;
  5778. C[5] ^= i1;
  5779. C[6] ^= i2;
  5780. C[7] ^= i3;
  5781. // Iterate the system four times
  5782. for (var i = 0; i < 4; i++) {
  5783. nextState.call(this);
  5784. }
  5785. }
  5786. },
  5787. _doProcessBlock: function (M, offset) {
  5788. // Shortcut
  5789. var X = this._X;
  5790. // Iterate the system
  5791. nextState.call(this);
  5792. // Generate four keystream words
  5793. S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
  5794. S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
  5795. S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
  5796. S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
  5797. for (var i = 0; i < 4; i++) {
  5798. // Swap endian
  5799. S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
  5800. (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
  5801. // Encrypt
  5802. M[offset + i] ^= S[i];
  5803. }
  5804. },
  5805. blockSize: 128/32,
  5806. ivSize: 64/32
  5807. });
  5808. function nextState() {
  5809. // Shortcuts
  5810. var X = this._X;
  5811. var C = this._C;
  5812. // Save old counter values
  5813. for (var i = 0; i < 8; i++) {
  5814. C_[i] = C[i];
  5815. }
  5816. // Calculate new counter values
  5817. C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
  5818. C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
  5819. C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
  5820. C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
  5821. C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
  5822. C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
  5823. C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
  5824. C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
  5825. this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
  5826. // Calculate the g-values
  5827. for (var i = 0; i < 8; i++) {
  5828. var gx = X[i] + C[i];
  5829. // Construct high and low argument for squaring
  5830. var ga = gx & 0xffff;
  5831. var gb = gx >>> 16;
  5832. // Calculate high and low result of squaring
  5833. var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
  5834. var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
  5835. // High XOR low
  5836. G[i] = gh ^ gl;
  5837. }
  5838. // Calculate new state values
  5839. X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
  5840. X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
  5841. X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
  5842. X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
  5843. X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
  5844. X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
  5845. X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
  5846. X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
  5847. }
  5848. /**
  5849. * Shortcut functions to the cipher's object interface.
  5850. *
  5851. * @example
  5852. *
  5853. * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
  5854. * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
  5855. */
  5856. C.Rabbit = StreamCipher._createHelper(Rabbit);
  5857. }());
  5858. return CryptoJS.Rabbit;
  5859. }));
  5860. }, function(modId) { var map = {"./core":1679274193844,"./enc-base64":1679274193848,"./md5":1679274193850,"./evpkdf":1679274193860,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  5861. __DEFINE__(1679274193877, function(require, module, exports) {
  5862. ;(function (root, factory, undef) {
  5863. if (typeof exports === "object") {
  5864. // CommonJS
  5865. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5866. }
  5867. else if (typeof define === "function" && define.amd) {
  5868. // AMD
  5869. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5870. }
  5871. else {
  5872. // Global (browser)
  5873. factory(root.CryptoJS);
  5874. }
  5875. }(this, function (CryptoJS) {
  5876. (function () {
  5877. // Shortcuts
  5878. var C = CryptoJS;
  5879. var C_lib = C.lib;
  5880. var StreamCipher = C_lib.StreamCipher;
  5881. var C_algo = C.algo;
  5882. // Reusable objects
  5883. var S = [];
  5884. var C_ = [];
  5885. var G = [];
  5886. /**
  5887. * Rabbit stream cipher algorithm.
  5888. *
  5889. * This is a legacy version that neglected to convert the key to little-endian.
  5890. * This error doesn't affect the cipher's security,
  5891. * but it does affect its compatibility with other implementations.
  5892. */
  5893. var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
  5894. _doReset: function () {
  5895. // Shortcuts
  5896. var K = this._key.words;
  5897. var iv = this.cfg.iv;
  5898. // Generate initial state values
  5899. var X = this._X = [
  5900. K[0], (K[3] << 16) | (K[2] >>> 16),
  5901. K[1], (K[0] << 16) | (K[3] >>> 16),
  5902. K[2], (K[1] << 16) | (K[0] >>> 16),
  5903. K[3], (K[2] << 16) | (K[1] >>> 16)
  5904. ];
  5905. // Generate initial counter values
  5906. var C = this._C = [
  5907. (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
  5908. (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
  5909. (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
  5910. (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
  5911. ];
  5912. // Carry bit
  5913. this._b = 0;
  5914. // Iterate the system four times
  5915. for (var i = 0; i < 4; i++) {
  5916. nextState.call(this);
  5917. }
  5918. // Modify the counters
  5919. for (var i = 0; i < 8; i++) {
  5920. C[i] ^= X[(i + 4) & 7];
  5921. }
  5922. // IV setup
  5923. if (iv) {
  5924. // Shortcuts
  5925. var IV = iv.words;
  5926. var IV_0 = IV[0];
  5927. var IV_1 = IV[1];
  5928. // Generate four subvectors
  5929. var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
  5930. var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
  5931. var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
  5932. var i3 = (i2 << 16) | (i0 & 0x0000ffff);
  5933. // Modify counter values
  5934. C[0] ^= i0;
  5935. C[1] ^= i1;
  5936. C[2] ^= i2;
  5937. C[3] ^= i3;
  5938. C[4] ^= i0;
  5939. C[5] ^= i1;
  5940. C[6] ^= i2;
  5941. C[7] ^= i3;
  5942. // Iterate the system four times
  5943. for (var i = 0; i < 4; i++) {
  5944. nextState.call(this);
  5945. }
  5946. }
  5947. },
  5948. _doProcessBlock: function (M, offset) {
  5949. // Shortcut
  5950. var X = this._X;
  5951. // Iterate the system
  5952. nextState.call(this);
  5953. // Generate four keystream words
  5954. S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
  5955. S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
  5956. S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
  5957. S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
  5958. for (var i = 0; i < 4; i++) {
  5959. // Swap endian
  5960. S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
  5961. (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
  5962. // Encrypt
  5963. M[offset + i] ^= S[i];
  5964. }
  5965. },
  5966. blockSize: 128/32,
  5967. ivSize: 64/32
  5968. });
  5969. function nextState() {
  5970. // Shortcuts
  5971. var X = this._X;
  5972. var C = this._C;
  5973. // Save old counter values
  5974. for (var i = 0; i < 8; i++) {
  5975. C_[i] = C[i];
  5976. }
  5977. // Calculate new counter values
  5978. C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
  5979. C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
  5980. C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
  5981. C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
  5982. C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
  5983. C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
  5984. C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
  5985. C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
  5986. this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
  5987. // Calculate the g-values
  5988. for (var i = 0; i < 8; i++) {
  5989. var gx = X[i] + C[i];
  5990. // Construct high and low argument for squaring
  5991. var ga = gx & 0xffff;
  5992. var gb = gx >>> 16;
  5993. // Calculate high and low result of squaring
  5994. var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
  5995. var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
  5996. // High XOR low
  5997. G[i] = gh ^ gl;
  5998. }
  5999. // Calculate new state values
  6000. X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
  6001. X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
  6002. X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
  6003. X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
  6004. X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
  6005. X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
  6006. X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
  6007. X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
  6008. }
  6009. /**
  6010. * Shortcut functions to the cipher's object interface.
  6011. *
  6012. * @example
  6013. *
  6014. * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
  6015. * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
  6016. */
  6017. C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
  6018. }());
  6019. return CryptoJS.RabbitLegacy;
  6020. }));
  6021. }, function(modId) { var map = {"./core":1679274193844,"./enc-base64":1679274193848,"./md5":1679274193850,"./evpkdf":1679274193860,"./cipher-core":1679274193861}; return __REQUIRE__(map[modId], modId); })
  6022. return __REQUIRE__(1679274193843);
  6023. })()
  6024. //miniprogram-npm-outsideDeps=["crypto"]
  6025. //# sourceMappingURL=index.js.map