1import { Q as getAugmentedNamespace, J as commonjsGlobal, G as getDefaultExportFromCjs, r as rest_props } from './i18n-CMo5lpzy.js'; 2import { R as push, y as user_effect, aa as onMount, T as pop } from './index-BvBk1Iap.js'; 3import { _ as __viteBrowserExternal } from './__vite-browser-external-CVaeKfQx.js'; 4import { G as Gradio } from './utils.svelte-CYLB_jIA.js'; 5import './clone-DaB-S2nH.js'; 6 7var cryptoJs$1 = {exports: {}}; 8 9function commonjsRequire(path) { 10 throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); 11} 12 13var core$1 = {exports: {}}; 14 15const require$$0 = /*@__PURE__*/getAugmentedNamespace(__viteBrowserExternal); 16 17var core = core$1.exports; 18 19var hasRequiredCore; 20 21function requireCore () { 22 if (hasRequiredCore) return core$1.exports; 23 hasRequiredCore = 1; 24 (function (module, exports$1) { 25(function (root, factory) { 26 { 27 // CommonJS 28 module.exports = factory(); 29 } 30 }(core, function () { 31 32 /*globals window, global, require*/ 33 34 /** 35 * CryptoJS core components. 36 */ 37 var CryptoJS = CryptoJS || (function (Math, undefined$1) { 38 39 var crypto; 40 41 // Native crypto from window (Browser) 42 if (typeof window !== 'undefined' && window.crypto) { 43 crypto = window.crypto; 44 } 45 46 // Native crypto in web worker (Browser) 47 if (typeof self !== 'undefined' && self.crypto) { 48 crypto = self.crypto; 49 } 50 51 // Native crypto from worker 52 if (typeof globalThis !== 'undefined' && globalThis.crypto) { 53 crypto = globalThis.crypto; 54 } 55 56 // Native (experimental IE 11) crypto from window (Browser) 57 if (!crypto && typeof window !== 'undefined' && window.msCrypto) { 58 crypto = window.msCrypto; 59 } 60 61 // Native crypto from global (NodeJS) 62 if (!crypto && typeof commonjsGlobal !== 'undefined' && commonjsGlobal.crypto) { 63 crypto = commonjsGlobal.crypto; 64 } 65 66 // Native crypto import via require (NodeJS) 67 if (!crypto && typeof commonjsRequire === 'function') { 68 try { 69 crypto = require$$0; 70 } catch (err) {} 71 } 72 73 /* 74 * Cryptographically secure pseudorandom number generator 75 * 76 * As Math.random() is cryptographically not safe to use 77 */ 78 var cryptoSecureRandomInt = function () { 79 if (crypto) { 80 // Use getRandomValues method (Browser) 81 if (typeof crypto.getRandomValues === 'function') { 82 try { 83 return crypto.getRandomValues(new Uint32Array(1))[0]; 84 } catch (err) {} 85 } 86 87 // Use randomBytes method (NodeJS) 88 if (typeof crypto.randomBytes === 'function') { 89 try { 90 return crypto.randomBytes(4).readInt32LE(); 91 } catch (err) {} 92 } 93 } 94 95 throw new Error('Native crypto module could not be used to get secure random number.'); 96 }; 97 98 /* 99 * Local polyfill of Object.create 100 101 */ 102 var create = Object.create || (function () { 103 function F() {} 104 105 return function (obj) { 106 var subtype; 107 108 F.prototype = obj; 109 110 subtype = new F(); 111 112 F.prototype = null; 113 114 return subtype; 115 }; 116 }()); 117 118 /** 119 * CryptoJS namespace. 120 */ 121 var C = {}; 122 123 /** 124 * Library namespace. 125 */ 126 var C_lib = C.lib = {}; 127 128 /** 129 * Base object for prototypal inheritance. 130 */ 131 var Base = C_lib.Base = (function () { 132 133 134 return { 135 /** 136 * Creates a new object that inherits from this object. 137 * 138 * @param {Object} overrides Properties to copy into the new object. 139 * 140 * @return {Object} The new object. 141 * 142 * @static 143 * 144 * @example 145 * 146 * var MyType = CryptoJS.lib.Base.extend({ 147 * field: 'value', 148 * 149 * method: function () { 150 * } 151 * }); 152 */ 153 extend: function (overrides) { 154 // Spawn 155 var subtype = create(this); 156 157 // Augment 158 if (overrides) { 159 subtype.mixIn(overrides); 160 } 161 162 // Create default initializer 163 if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { 164 subtype.init = function () {
vendor: 4,156 bytes, lines 165-285
165 subtype.$super.init.apply(this, arguments); 166 }; 167 } 168 169 // Initializer's prototype is the subtype object 170 subtype.init.prototype = subtype; 171 172 // Reference supertype 173 subtype.$super = this; 174 175 return subtype; 176 }, 177 178 /** 179 * Extends this object and runs the init method. 180 * Arguments to create() will be passed to init(). 181 * 182 * @return {Object} The new object. 183 * 184 * @static 185 * 186 * @example 187 * 188 * var instance = MyType.create(); 189 */ 190 create: function () { 191 var instance = this.extend(); 192 instance.init.apply(instance, arguments); 193 194 return instance; 195 }, 196 197 /** 198 * Initializes a newly created object. 199 * Override this method to add some logic when your objects are created. 200 * 201 * @example 202 * 203 * var MyType = CryptoJS.lib.Base.extend({ 204 * init: function () { 205 * // ... 206 * } 207 * }); 208 */ 209 init: function () { 210 }, 211 212 /** 213 * Copies properties into this object. 214 * 215 * @param {Object} properties The properties to mix in. 216 * 217 * @example 218 * 219 * MyType.mixIn({ 220 * field: 'value' 221 * }); 222 */ 223 mixIn: function (properties) { 224 for (var propertyName in properties) { 225 if (properties.hasOwnProperty(propertyName)) { 226 this[propertyName] = properties[propertyName]; 227 } 228 } 229 230 // IE won't copy toString using the loop above 231 if (properties.hasOwnProperty('toString')) { 232 this.toString = properties.toString; 233 } 234 }, 235 236 /** 237 * Creates a copy of this object. 238 * 239 * @return {Object} The clone. 240 * 241 * @example 242 * 243 * var clone = instance.clone(); 244 */ 245 clone: function () { 246 return this.init.prototype.extend(this); 247 } 248 }; 249 }()); 250 251 /** 252 * An array of 32-bit words. 253 * 254 * @property {Array} words The array of 32-bit words. 255 * @property {number} sigBytes The number of significant bytes in this word array. 256 */ 257 var WordArray = C_lib.WordArray = Base.extend({ 258 /** 259 * Initializes a newly created word array. 260 * 261 * @param {Array} words (Optional) An array of 32-bit words. 262 * @param {number} sigBytes (Optional) The number of significant bytes in the words. 263 * 264 * @example 265 * 266 * var wordArray = CryptoJS.lib.WordArray.create(); 267 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); 268 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); 269 */ 270 init: function (words, sigBytes) { 271 words = this.words = words || []; 272 273 if (sigBytes != undefined$1) { 274 this.sigBytes = sigBytes; 275 } else { 276 this.sigBytes = words.length * 4; 277 } 278 }, 279 280 /** 281 * Converts this word array to a string. 282 * 283 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex 284 * 285 * @return {string} The stringified word array.
286 * 287 * @example 288 * 289 * var string = wordArray + ''; 290 * var string = wordArray.toString(); 291 * var string = wordArray.toString(CryptoJS.enc.Utf8); 292 */ 293 toString: function (encoder) { 294 return (encoder || Hex).stringify(this); 295 }, 296 297 /** 298 * Concatenates a word array to this word array. 299 * 300 * @param {WordArray} wordArray The word array to append. 301 * 302 * @return {WordArray} This word array. 303 * 304 * @example 305 * 306 * wordArray1.concat(wordArray2); 307 */ 308 concat: function (wordArray) { 309 // Shortcuts 310 var thisWords = this.words; 311 var thatWords = wordArray.words; 312 var thisSigBytes = this.sigBytes; 313 var thatSigBytes = wordArray.sigBytes; 314 315 // Clamp excess bits 316 this.clamp(); 317 318 // Concat 319 if (thisSigBytes % 4) { 320 // Copy one byte at a time 321 for (var i = 0; i < thatSigBytes; i++) { 322 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 323 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); 324 } 325 } else { 326 // Copy one word at a time 327 for (var j = 0; j < thatSigBytes; j += 4) { 328 thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; 329 } 330 } 331 this.sigBytes += thatSigBytes; 332 333 // Chainable 334 return this; 335 }, 336 337 /** 338 * Removes insignificant bits. 339 * 340 * @example 341 * 342 * wordArray.clamp(); 343 */ 344 clamp: function () { 345 // Shortcuts 346 var words = this.words; 347 var sigBytes = this.sigBytes; 348 349 // Clamp 350 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); 351 words.length = Math.ceil(sigBytes / 4); 352 }, 353 354 /** 355 * Creates a copy of this word array. 356 * 357 * @return {WordArray} The clone. 358 * 359 * @example 360 * 361 * var clone = wordArray.clone(); 362 */ 363 clone: function () { 364 var clone = Base.clone.call(this); 365 clone.words = this.words.slice(0); 366 367 return clone; 368 }, 369 370 /** 371 * Creates a word array filled with random bytes. 372 * 373 * @param {number} nBytes The number of random bytes to generate. 374 * 375 * @return {WordArray} The random word array. 376 * 377 * @static 378 * 379 * @example 380 * 381 * var wordArray = CryptoJS.lib.WordArray.random(16); 382 */ 383 random: function (nBytes) { 384 var words = []; 385 386 for (var i = 0; i < nBytes; i += 4) { 387 words.push(cryptoSecureRandomInt()); 388 } 389 390 return new WordArray.init(words, nBytes); 391 } 392 }); 393 394 /** 395 * Encoder namespace. 396 */ 397 var C_enc = C.enc = {}; 398 399 /** 400 * Hex encoding strategy. 401 */ 402 var Hex = C_enc.Hex = { 403 /** 404 * Converts a word array to a hex string. 405 * 406 * @param {WordArray} wordArray The word array. 407 * 408 * @return {string} The hex string. 409 * 410 * @static 411 * 412 * @example 413 * 414 * var hexString = CryptoJS.enc.Hex.stringify(wordArray); 415 */ 416 stringify: function (wordArray) { 417 // Shortcuts 418 var words = wordArray.words; 419 var sigBytes = wordArray.sigBytes; 420 421 // Convert 422 var hexChars = []; 423 for (var i = 0; i < sigBytes; i++) { 424 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
vendor: 3,912 bytes, lines 425-554
425 hexChars.push((bite >>> 4).toString(16)); 426 hexChars.push((bite & 0x0f).toString(16)); 427 } 428 429 return hexChars.join(''); 430 }, 431 432 /** 433 * Converts a hex string to a word array. 434 * 435 * @param {string} hexStr The hex string. 436 * 437 * @return {WordArray} The word array. 438 * 439 * @static 440 * 441 * @example 442 * 443 * var wordArray = CryptoJS.enc.Hex.parse(hexString); 444 */ 445 parse: function (hexStr) { 446 // Shortcut 447 var hexStrLength = hexStr.length; 448 449 // Convert 450 var words = []; 451 for (var i = 0; i < hexStrLength; i += 2) { 452 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); 453 } 454 455 return new WordArray.init(words, hexStrLength / 2); 456 } 457 }; 458 459 /** 460 * Latin1 encoding strategy. 461 */ 462 var Latin1 = C_enc.Latin1 = { 463 /** 464 * Converts a word array to a Latin1 string. 465 * 466 * @param {WordArray} wordArray The word array. 467 * 468 * @return {string} The Latin1 string. 469 * 470 * @static 471 * 472 * @example 473 * 474 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); 475 */ 476 stringify: function (wordArray) { 477 // Shortcuts 478 var words = wordArray.words; 479 var sigBytes = wordArray.sigBytes; 480 481 // Convert 482 var latin1Chars = []; 483 for (var i = 0; i < sigBytes; i++) { 484 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 485 latin1Chars.push(String.fromCharCode(bite)); 486 } 487 488 return latin1Chars.join(''); 489 }, 490 491 /** 492 * Converts a Latin1 string to a word array. 493 * 494 * @param {string} latin1Str The Latin1 string. 495 * 496 * @return {WordArray} The word array. 497 * 498 * @static 499 * 500 * @example 501 * 502 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); 503 */ 504 parse: function (latin1Str) { 505 // Shortcut 506 var latin1StrLength = latin1Str.length; 507 508 // Convert 509 var words = []; 510 for (var i = 0; i < latin1StrLength; i++) { 511 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); 512 } 513 514 return new WordArray.init(words, latin1StrLength); 515 } 516 }; 517 518 /** 519 * UTF-8 encoding strategy. 520 */ 521 var Utf8 = C_enc.Utf8 = { 522 /** 523 * Converts a word array to a UTF-8 string. 524 * 525 * @param {WordArray} wordArray The word array. 526 * 527 * @return {string} The UTF-8 string. 528 * 529 * @static 530 * 531 * @example 532 * 533 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); 534 */ 535 stringify: function (wordArray) { 536 try { 537 return decodeURIComponent(escape(Latin1.stringify(wordArray))); 538 } catch (e) { 539 throw new Error('Malformed UTF-8 data'); 540 } 541 }, 542 543 /** 544 * Converts a UTF-8 string to a word array. 545 * 546 * @param {string} utf8Str The UTF-8 string. 547 * 548 * @return {WordArray} The word array. 549 * 550 * @static 551 * 552 * @example 553 * 554 * var wordArray = CryptoJS.enc.Utf8.parse(utf8Str
vendor: 15,233 bytes, lines 554-1046
554ing); 555 */ 556 parse: function (utf8Str) { 557 return Latin1.parse(unescape(encodeURIComponent(utf8Str))); 558 } 559 }; 560 561 /** 562 * Abstract buffered block algorithm template. 563 * 564 * The property blockSize must be implemented in a concrete subtype. 565 * 566 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 567 */ 568 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ 569 /** 570 * Resets this block algorithm's data buffer to its initial state. 571 * 572 * @example 573 * 574 * bufferedBlockAlgorithm.reset(); 575 */ 576 reset: function () { 577 // Initial values 578 this._data = new WordArray.init(); 579 this._nDataBytes = 0; 580 }, 581 582 /** 583 * Adds new data to this block algorithm's buffer. 584 * 585 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. 586 * 587 * @example 588 * 589 * bufferedBlockAlgorithm._append('data'); 590 * bufferedBlockAlgorithm._append(wordArray); 591 */ 592 _append: function (data) { 593 // Convert string to WordArray, else assume WordArray already 594 if (typeof data == 'string') { 595 data = Utf8.parse(data); 596 } 597 598 // Append 599 this._data.concat(data); 600 this._nDataBytes += data.sigBytes; 601 }, 602 603 /** 604 * Processes available data blocks. 605 * 606 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. 607 * 608 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. 609 * 610 * @return {WordArray} The processed data. 611 * 612 * @example 613 * 614 * var processedData = bufferedBlockAlgorithm._process(); 615 * var processedData = bufferedBlockAlgorithm._process(!!'flush'); 616 */ 617 _process: function (doFlush) { 618 var processedWords; 619 620 // Shortcuts 621 var data = this._data; 622 var dataWords = data.words; 623 var dataSigBytes = data.sigBytes; 624 var blockSize = this.blockSize; 625 var blockSizeBytes = blockSize * 4; 626 627 // Count blocks ready 628 var nBlocksReady = dataSigBytes / blockSizeBytes; 629 if (doFlush) { 630 // Round up to include partial blocks 631 nBlocksReady = Math.ceil(nBlocksReady); 632 } else { 633 // Round down to include only full blocks, 634 // less the number of blocks that must remain in the buffer 635 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); 636 } 637 638 // Count words ready 639 var nWordsReady = nBlocksReady * blockSize; 640 641 // Count bytes ready 642 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); 643 644 // Process blocks 645 if (nWordsReady) { 646 for (var offset = 0; offset < nWordsReady; offset += blockSize) { 647 // Perform concrete-algorithm logic 648 this._doProcessBlock(dataWords, offset); 649 } 650 651 // Remove processed words 652 processedWords = dataWords.splice(0, nWordsReady); 653 data.sigBytes -= nBytesReady; 654 } 655 656 // Return processed words 657 return new WordArray.init(processedWords, nBytesReady); 658 }, 659 660 /** 661 * Creates a copy of this object. 662 * 663 * @return {Object} The clone. 664 * 665 * @example 666 * 667 * var clone = bufferedBlockAlgorithm.clone(); 668 */ 669 clone: function () { 670 var clone = Base.clone.call(this); 671 clone._data = this._data.clone(); 672 673 return clone; 674 }, 675 676 _minBufferSize: 0 677 }); 678 679 /** 680 * Abstract hasher template. 681 * 682 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) 683 */ 684 C_lib.Hasher = BufferedBlockAlgorithm.extend({ 685 /** 686 * Configuration options. 687 */ 688 cfg: Base.extend(), 689 690 /** 691 * Initializes a newly created hasher. 692 * 693 * @param {Object} cfg (Optional) The configuration options to use for this hash computation. 694 * 695 * @example 696 * 697 * var hasher = CryptoJS.algo.SHA256.create(); 698 */ 699 init: function (cfg) { 700 // Apply config defaults 701 this.cfg = this.cfg.extend(cfg); 702 703 // Set initial values 704 this.reset(); 705 }, 706 707 /** 708 * Resets this hasher to its initial state. 709 * 710 * @example 711 * 712 * hasher.reset(); 713 */ 714 reset: function () { 715 // Reset data buffer 716 BufferedBlockAlgorithm.reset.call(this); 717 718 // Perform concrete-hasher logic 719 this._doReset(); 720 }, 721 722 /** 723 * Updates this hasher with a message. 724 * 725 * @param {WordArray|string} messageUpdate The message to append. 726 * 727 * @return {Hasher} This hasher. 728 * 729 * @example 730 * 731 * hasher.update('message'); 732 * hasher.update(wordArray); 733 */ 734 update: function (messageUpdate) { 735 // Append 736 this._append(messageUpdate); 737 738 // Update the hash 739 this._process(); 740 741 // Chainable 742 return this; 743 }, 744 745 /** 746 * Finalizes the hash computation. 747 * Note that the finalize operation is effectively a destructive, read-once operation. 748 * 749 * @param {WordArray|string} messageUpdate (Optional) A final message update. 750 * 751 * @return {WordArray} The hash. 752 * 753 * @example 754 * 755 * var hash = hasher.finalize(); 756 * var hash = hasher.finalize('message'); 757 * var hash = hasher.finalize(wordArray); 758 */ 759 finalize: function (messageUpdate) { 760 // Final message update 761 if (messageUpdate) { 762 this._append(messageUpdate); 763 } 764 765 // Perform concrete-hasher logic 766 var hash = this._doFinalize(); 767 768 return hash; 769 }, 770 771 blockSize: 512/32, 772 773 /** 774 * Creates a shortcut function to a hasher's object interface. 775 * 776 * @param {Hasher} hasher The hasher to create a helper for. 777 * 778 * @return {Function} The shortcut function. 779 * 780 * @static 781 * 782 * @example 783 * 784 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); 785 */ 786 _createHelper: function (hasher) { 787 return function (message, cfg) { 788 return new hasher.init(cfg).finalize(message); 789 }; 790 }, 791 792 /** 793 * Creates a shortcut function to the HMAC's object interface. 794 * 795 * @param {Hasher} hasher The hasher to use in this HMAC helper. 796 * 797 * @return {Function} The shortcut function. 798 * 799 * @static 800 * 801 * @example 802 * 803 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); 804 */ 805 _createHmacHelper: function (hasher) { 806 return function (message, key) { 807 return new C_algo.HMAC.init(hasher, key).finalize(message); 808 }; 809 } 810 }); 811 812 /** 813 * Algorithm namespace. 814 */ 815 var C_algo = C.algo = {}; 816 817 return C; 818 }(Math)); 819 820 821 return CryptoJS; 822 823 })); 824 } (core$1)); 825 return core$1.exports; 826} 827 828var x64Core$1 = {exports: {}}; 829 830var x64Core = x64Core$1.exports; 831 832var hasRequiredX64Core; 833 834function requireX64Core () { 835 if (hasRequiredX64Core) return x64Core$1.exports; 836 hasRequiredX64Core = 1; 837 (function (module, exports$1) { 838(function (root, factory) { 839 { 840 // CommonJS 841 module.exports = factory(requireCore()); 842 } 843 }(x64Core, function (CryptoJS) { 844 845 (function (undefined$1) { 846 // Shortcuts 847 var C = CryptoJS; 848 var C_lib = C.lib; 849 var Base = C_lib.Base; 850 var X32WordArray = C_lib.WordArray; 851 852 /** 853 * x64 namespace. 854 */ 855 var C_x64 = C.x64 = {}; 856 857 /** 858 * A 64-bit word. 859 */ 860 C_x64.Word = Base.extend({ 861 /** 862 * Initializes a newly created 64-bit word. 863 * 864 * @param {number} high The high 32 bits. 865 * @param {number} low The low 32 bits. 866 * 867 * @example 868 * 869 * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); 870 */ 871 init: function (high, low) { 872 this.high = high; 873 this.low = low; 874 } 875 876 /** 877 * Bitwise NOTs this word. 878 * 879 * @return {X64Word} A new x64-Word object after negating. 880 * 881 * @example 882 * 883 * var negated = x64Word.not(); 884 */ 885 // not: function () { 886 // var high = ~this.high; 887 // var low = ~this.low; 888 889 // return X64Word.create(high, low); 890 // }, 891 892 /** 893 * Bitwise ANDs this word with the passed word. 894 * 895 * @param {X64Word} word The x64-Word to AND with this word. 896 * 897 * @return {X64Word} A new x64-Word object after ANDing. 898 * 899 * @example 900 * 901 * var anded = x64Word.and(anotherX64Word); 902 */ 903 // and: function (word) { 904 // var high = this.high & word.high; 905 // var low = this.low & word.low; 906 907 // return X64Word.create(high, low); 908 // }, 909 910 /** 911 * Bitwise ORs this word with the passed word. 912 * 913 * @param {X64Word} word The x64-Word to OR with this word. 914 * 915 * @return {X64Word} A new x64-Word object after ORing. 916 * 917 * @example 918 * 919 * var ored = x64Word.or(anotherX64Word); 920 */ 921 // or: function (word) { 922 // var high = this.high | word.high; 923 // var low = this.low | word.low; 924 925 // return X64Word.create(high, low); 926 // }, 927 928 /** 929 * Bitwise XORs this word with the passed word. 930 * 931 * @param {X64Word} word The x64-Word to XOR with this word. 932 * 933 * @return {X64Word} A new x64-Word object after XORing. 934 * 935 * @example 936 * 937 * var xored = x64Word.xor(anotherX64Word); 938 */ 939 // xor: function (word) { 940 // var high = this.high ^ word.high; 941 // var low = this.low ^ word.low; 942 943 // return X64Word.create(high, low); 944 // }, 945 946 /** 947 * Shifts this word n bits to the left. 948 * 949 * @param {number} n The number of bits to shift. 950 * 951 * @return {X64Word} A new x64-Word object after shifting. 952 * 953 * @example 954 * 955 * var shifted = x64Word.shiftL(25); 956 */ 957 // shiftL: function (n) { 958 // if (n < 32) { 959 // var high = (this.high << n) | (this.low >>> (32 - n)); 960 // var low = this.low << n; 961 // } else { 962 // var high = this.low << (n - 32); 963 // var low = 0; 964 // } 965 966 // return X64Word.create(high, low); 967 // }, 968 969 /** 970 * Shifts this word n bits to the right. 971 * 972 * @param {number} n The number of bits to shift. 973 * 974 * @return {X64Word} A new x64-Word object after shifting. 975 * 976 * @example 977 * 978 * var shifted = x64Word.shiftR(7); 979 */ 980 // shiftR: function (n) { 981 // if (n < 32) { 982 // var low = (this.low >>> n) | (this.high << (32 - n)); 983 // var high = this.high >>> n; 984 // } else { 985 // var low = this.high >>> (n - 32); 986 // var high = 0; 987 // } 988 989 // return X64Word.create(high, low); 990 // }, 991 992 /** 993 * Rotates this word n bits to the left. 994 * 995 * @param {number} n The number of bits to rotate. 996 * 997 * @return {X64Word} A new x64-Word object after rotating. 998 * 999 * @example 1000 * 1001 * var rotated = x64Word.rotL(25); 1002 */ 1003 // rotL: function (n) { 1004 // return this.shiftL(n).or(this.shiftR(64 - n)); 1005 // }, 1006 1007 /** 1008 * Rotates this word n bits to the right. 1009 * 1010 * @param {number} n The number of bits to rotate. 1011 * 1012 * @return {X64Word} A new x64-Word object after rotating. 1013 * 1014 * @example 1015 * 1016 * var rotated = x64Word.rotR(7); 1017 */ 1018 // rotR: function (n) { 1019 // return this.shiftR(n).or(this.shiftL(64 - n)); 1020 // }, 1021 1022 /** 1023 * Adds this word with the passed word. 1024 * 1025 * @param {X64Word} word The x64-Word to add with this word. 1026 * 1027 * @return {X64Word} A new x64-Word object after adding. 1028 * 1029 * @example 1030 * 1031 * var added = x64Word.add(anotherX64Word); 1032 */ 1033 // add: function (word) { 1034 // var low = (this.low + word.low) | 0; 1035 // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; 1036 // var high = (this.high + word.high + carry) | 0; 1037 1038 // return X64Word.create(high, low); 1039 // } 1040 }); 1041 1042 /** 1043 * An array of 64-bit words. 1044 * 1045 * @property {Array} words The array of CryptoJS.x64.Word objects. 1046 * @property {number} sigBytes The number of significant bytes in this word array.
1047 */ 1048 C_x64.WordArray = Base.extend({ 1049 /** 1050 * Initializes a newly created word array. 1051 * 1052 * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. 1053 * @param {number} sigBytes (Optional) The number of significant bytes in the words. 1054 * 1055 * @example 1056 * 1057 * var wordArray = CryptoJS.x64.WordArray.create(); 1058 * 1059 * var wordArray = CryptoJS.x64.WordArray.create([ 1060 * CryptoJS.x64.Word.create(0x00010203, 0x04050607), 1061 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) 1062 * ]); 1063 * 1064 * var wordArray = CryptoJS.x64.WordArray.create([ 1065 * CryptoJS.x64.Word.create(0x00010203, 0x04050607), 1066 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) 1067 * ], 10); 1068 */ 1069 init: function (words, sigBytes) { 1070 words = this.words = words || []; 1071 1072 if (sigBytes != undefined$1) { 1073 this.sigBytes = sigBytes; 1074 } else { 1075 this.sigBytes = words.length * 8; 1076 } 1077 }, 1078 1079 /** 1080 * Converts this 64-bit word array to a 32-bit word array. 1081 * 1082 * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. 1083 * 1084 * @example 1085 * 1086 * var x32WordArray = x64WordArray.toX32(); 1087 */ 1088 toX32: function () { 1089 // Shortcuts 1090 var x64Words = this.words; 1091 var x64WordsLength = x64Words.length; 1092 1093 // Convert 1094 var x32Words = []; 1095 for (var i = 0; i < x64WordsLength; i++) { 1096 var x64Word = x64Words[i]; 1097 x32Words.push(x64Word.high); 1098 x32Words.push(x64Word.low); 1099 } 1100 1101 return X32WordArray.create(x32Words, this.sigBytes); 1102 }, 1103 1104 /** 1105 * Creates a copy of this word array. 1106 * 1107 * @return {X64WordArray} The clone. 1108 * 1109 * @example 1110 * 1111 * var clone = x64WordArray.clone(); 1112 */ 1113 clone: function () { 1114 var clone = Base.clone.call(this); 1115 1116 // Clone "words" array 1117 var words = clone.words = this.words.slice(0); 1118 1119 // Clone each X64Word object 1120 var wordsLength = words.length; 1121 for (var i = 0; i < wordsLength; i++) { 1122 words[i] = words[i].clone(); 1123 } 1124 1125 return clone; 1126 } 1127 }); 1128 }()); 1129 1130 1131 return CryptoJS; 1132 1133 })); 1134 } (x64Core$1)); 1135 return x64Core$1.exports; 1136} 1137 1138var libTypedarrays$1 = {exports: {}}; 1139 1140var libTypedarrays = libTypedarrays$1.exports; 1141 1142var hasRequiredLibTypedarrays; 1143 1144function requireLibTypedarrays () { 1145 if (hasRequiredLibTypedarrays) return libTypedarrays$1.exports; 1146 hasRequiredLibTypedarrays = 1; 1147 (function (module, exports$1) { 1148(function (root, factory) { 1149 { 1150 // CommonJS 1151 module.exports = factory(requireCore()); 1152 } 1153 }(libTypedarrays, function (CryptoJS) { 1154 1155 (function () { 1156 // Check if typed arrays are supported 1157 if (typeof ArrayBuffer != 'function') { 1158 return; 1159 } 1160 1161 // Shortcuts 1162 var C = CryptoJS; 1163 var C_lib = C.lib; 1164 var WordArray = C_lib.WordArray; 1165 1166 // Reference original init 1167 var superInit = WordArray.init; 1168 1169 // Augment WordArray.init to handle typed arrays 1170 var subInit = WordArray.init = function (typedArray) { 1171 // Convert buffers to uint8 1172 if (typedArray instanceof ArrayBuffer) { 1173 typedArray = new Uint8Array(typedArray); 1174 } 1175 1176 // Convert other array views to uint8 1177 if ( 1178 typedArray instanceof Int8Array || 1179 (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || 1180 typedArray instanceof Int16Array || 1181 typedArray instanceof Uint16Array || 1182 typedArray instanceof Int32Array || 1183 typedArray instanceof Uint32Array || 1184 typedArray instanceof Float32Array || 1185 typedArray instanceof Float64Array 1186 ) { 1187 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); 1188 } 1189 1190 // Handle Uint8Array 1191 if (typedArray instanceof Uint8Array) { 1192 // Shortcut 1193 var typedArrayByteLength = typedArray.byteLength; 1194 1195 // Extract bytes 1196 var words = []; 1197 for (var i = 0; i < typedArrayByteLength; i++) { 1198 words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); 1199 } 1200 1201 // Initialize this word array 1202 superInit.call(this, words, typedArrayByteLength); 1203 } else { 1204 // Else call normal init 1205 superInit.apply(this, arguments); 1206 } 1207 }; 1208 1209 subInit.prototype = WordArray; 1210 }()); 1211 1212 1213 return CryptoJS.lib.WordArray; 1214 1215 })); 1216 } (libTypedarrays$1)); 1217 return libTypedarrays$1.exports; 1218} 1219 1220var encUtf16$1 = {exports: {}}; 1221 1222var encUtf16 = encUtf16$1.exports; 1223 1224var hasRequiredEncUtf16; 1225 1226function requireEncUtf16 () { 1227 if (hasRequiredEncUtf16) return encUtf16$1.exports; 1228 hasRequiredEncUtf16 = 1; 1229 (function (module, exports$1) { 1230(function (root, factory) { 1231 { 1232 // CommonJS 1233 module.exports = factory(requireCore()); 1234 } 1235 }(encUtf16, function (CryptoJS) { 1236 1237 (function () { 1238 // Shortcuts 1239 var C = CryptoJS; 1240 var C_lib = C.lib; 1241 var WordArray = C_lib.WordArray; 1242 var C_enc = C.enc; 1243 1244 /** 1245 * UTF-16 BE encoding strategy. 1246 */ 1247 C_enc.Utf16 = C_enc.Utf16BE = { 1248 /** 1249 * Converts a word array to a UTF-16 BE string. 1250 * 1251 * @param {WordArray} wordArray The word array.
1252 * 1253 * @return {string} The UTF-16 BE string. 1254 * 1255 * @static 1256 * 1257 * @example 1258 * 1259 * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); 1260 */ 1261 stringify: function (wordArray) { 1262 // Shortcuts 1263 var words = wordArray.words; 1264 var sigBytes = wordArray.sigBytes; 1265 1266 // Convert 1267 var utf16Chars = []; 1268 for (var i = 0; i < sigBytes; i += 2) { 1269 var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; 1270 utf16Chars.push(String.fromCharCode(codePoint)); 1271 } 1272 1273 return utf16Chars.join(''); 1274 }, 1275 1276 /** 1277 * Converts a UTF-16 BE string to a word array. 1278 * 1279 * @param {string} utf16Str The UTF-16 BE string. 1280 * 1281 * @return {WordArray} The word array. 1282 * 1283 * @static 1284 * 1285 * @example 1286 * 1287 * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); 1288 */ 1289 parse: function (utf16Str) { 1290 // Shortcut 1291 var utf16StrLength = utf16Str.length; 1292 1293 // Convert 1294 var words = []; 1295 for (var i = 0; i < utf16StrLength; i++) { 1296 words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); 1297 } 1298 1299 return WordArray.create(words, utf16StrLength * 2); 1300 } 1301 }; 1302 1303 /** 1304 * UTF-16 LE encoding strategy. 1305 */ 1306 C_enc.Utf16LE = { 1307 /** 1308 * Converts a word array to a UTF-16 LE string. 1309 * 1310 * @param {WordArray} wordArray The word array. 1311 * 1312 * @return {string} The UTF-16 LE string. 1313 * 1314 * @static 1315 * 1316 * @example 1317 * 1318 * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); 1319 */ 1320 stringify: function (wordArray) { 1321 // Shortcuts 1322 var words = wordArray.words; 1323 var sigBytes = wordArray.sigBytes; 1324 1325 // Convert 1326 var utf16Chars = []; 1327 for (var i = 0; i < sigBytes; i += 2) { 1328 var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); 1329 utf16Chars.push(String.fromCharCode(codePoint)); 1330 } 1331 1332 return utf16Chars.join(''); 1333 }, 1334 1335 /** 1336 * Converts a UTF-16 LE string to a word array. 1337 * 1338 * @param {string} utf16Str The UTF-16 LE string. 1339 * 1340 * @return {WordArray} The word array. 1341 * 1342 * @static 1343 * 1344 * @example 1345 * 1346 * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); 1347 */ 1348 parse: function (utf16Str) { 1349 // Shortcut 1350 var utf16StrLength = utf16Str.length; 1351 1352 // Convert 1353 var words = []; 1354 for (var i = 0; i < utf16StrLength; i++) { 1355 words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); 1356 } 1357 1358 return WordArray.create(words, utf16StrLength * 2); 1359 } 1360 }; 1361 1362 function swapEndian(word) { 1363 return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); 1364 } 1365 }()); 1366 1367 1368 return CryptoJS.enc.Utf16; 1369 1370 })); 1371 } (encUtf16$1)); 1372 return encUtf16$1.exports; 1373} 1374 1375var encBase64$1 = {exports: {}}; 1376 1377var encBase64 = encBase64$1.exports; 1378 1379var hasRequiredEncBase64; 1380 1381function requireEncBase64 () { 1382 if (hasRequiredEncBase64) return encBase64$1.exports; 1383 hasRequiredEncBase64 = 1; 1384 (function (module, exports$1) { 1385(function (root, factory) { 1386 { 1387 // CommonJS 1388 module.exports = factory(requireCore()); 1389 } 1390 }(encBase64, function (CryptoJS) { 1391 1392 (function () { 1393 // Shortcuts 1394 var C = CryptoJS; 1395 var C_lib = C.lib; 1396 var WordArray = C_lib.WordArray; 1397 var C_enc = C.enc; 1398 1399 /** 1400 * Base64 encoding strategy. 1401 */ 1402 C_enc.Base64 = { 1403 /** 1404 * Converts a word array to a Base64 string. 1405 * 1406 * @param {WordArray} wordArray The word array.
1407 * 1408 * @return {string} The Base64 string. 1409 * 1410 * @static 1411 * 1412 * @example 1413 * 1414 * var base64String = CryptoJS.enc.Base64.stringify(wordArray); 1415 */ 1416 stringify: function (wordArray) { 1417 // Shortcuts 1418 var words = wordArray.words; 1419 var sigBytes = wordArray.sigBytes; 1420 var map = this._map; 1421 1422 // Clamp excess bits 1423 wordArray.clamp(); 1424 1425 // Convert 1426 var base64Chars = []; 1427 for (var i = 0; i < sigBytes; i += 3) { 1428 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 1429 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; 1430 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; 1431 1432 var triplet = (byte1 << 16) | (byte2 << 8) | byte3; 1433 1434 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { 1435 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); 1436 } 1437 } 1438 1439 // Add padding 1440 var paddingChar = map.charAt(64); 1441 if (paddingChar) { 1442 while (base64Chars.length % 4) { 1443 base64Chars.push(paddingChar); 1444 } 1445 } 1446 1447 return base64Chars.join(''); 1448 }, 1449 1450 /** 1451 * Converts a Base64 string to a word array. 1452 * 1453 * @param {string} base64Str The Base64 string. 1454 * 1455 * @return {WordArray} The word array. 1456 * 1457 * @static 1458 * 1459 * @example 1460 * 1461 * var wordArray = CryptoJS.enc.Base64.parse(base64String); 1462 */ 1463 parse: function (base64Str) { 1464 // Shortcuts 1465 var base64StrLength = base64Str.length; 1466 var map = this._map; 1467 var reverseMap = this._reverseMap; 1468 1469 if (!reverseMap) { 1470 reverseMap = this._reverseMap = []; 1471 for (var j = 0; j < map.length; j++) { 1472 reverseMap[map.charCodeAt(j)] = j; 1473 } 1474 } 1475 1476 // Ignore padding 1477 var paddingChar = map.charAt(64); 1478 if (paddingChar) { 1479 var paddingIndex = base64Str.indexOf(paddingChar); 1480 if (paddingIndex !== -1) { 1481 base64StrLength = paddingIndex; 1482 } 1483 } 1484 1485 // Convert 1486 return parseLoop(base64Str, base64StrLength, reverseMap); 1487 1488 }, 1489 1490 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' 1491 }; 1492 1493 function parseLoop(base64Str, base64StrLength, reverseMap) { 1494 var words = []; 1495 var nBytes = 0; 1496 for (var i = 0; i < base64StrLength; i++) { 1497 if (i % 4) { 1498 var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); 1499 var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); 1500 var bitsCombined = bits1 | bits2; 1501 words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); 1502 nBytes++; 1503 } 1504 } 1505 return WordArray.create(words, nBytes); 1506 } 1507 }()); 1508 1509 1510 return CryptoJS.enc.Base64; 1511 1512 })); 1513 } (encBase64$1)); 1514 return encBase64$1.exports; 1515} 1516 1517var encBase64url$1 = {exports: {}}; 1518 1519var encBase64url = encBase64url$1.exports; 1520 1521var hasRequiredEncBase64url; 1522 1523function requireEncBase64url () { 1524 if (hasRequiredEncBase64url) return encBase64url$1.exports; 1525 hasRequiredEncBase64url = 1; 1526 (function (module, exports$1) { 1527(function (root, factory) { 1528 { 1529 // CommonJS 1530 module.exports = factory(requireCore()); 1531 } 1532 }(encBase64url, function (CryptoJS) { 1533 1534 (function () { 1535 // Shortcuts 1536 var C = CryptoJS; 1537 var C_lib = C.lib; 1538 var WordArray = C_lib.WordArray; 1539 var C_enc = C.enc; 1540 1541 /** 1542 * Base64url encoding strategy. 1543 */ 1544 C_enc.Base64url = { 1545 /** 1546 * Converts a word array to a Base64url string. 1547 * 1548 * @param {WordArray} wordArray The word array.
1549 * 1550 * @param {boolean} urlSafe Whether to use url safe 1551 * 1552 * @return {string} The Base64url string. 1553 * 1554 * @static 1555 * 1556 * @example 1557 * 1558 * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); 1559 */ 1560 stringify: function (wordArray, urlSafe) { 1561 if (urlSafe === undefined) { 1562 urlSafe = true; 1563 } 1564 // Shortcuts 1565 var words = wordArray.words; 1566 var sigBytes = wordArray.sigBytes; 1567 var map = urlSafe ? this._safe_map : this._map; 1568 1569 // Clamp excess bits 1570 wordArray.clamp(); 1571 1572 // Convert 1573 var base64Chars = []; 1574 for (var i = 0; i < sigBytes; i += 3) { 1575 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 1576 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; 1577 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; 1578 1579 var triplet = (byte1 << 16) | (byte2 << 8) | byte3; 1580 1581 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { 1582 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); 1583 } 1584 } 1585 1586 // Add padding 1587 var paddingChar = map.charAt(64); 1588 if (paddingChar) { 1589 while (base64Chars.length % 4) { 1590 base64Chars.push(paddingChar); 1591 } 1592 } 1593 1594 return base64Chars.join(''); 1595 }, 1596 1597 /** 1598 * Converts a Base64url string to a word array. 1599 * 1600 * @param {string} base64Str The Base64url string. 1601 * 1602 * @param {boolean} urlSafe Whether to use url safe 1603 * 1604 * @return {WordArray} The word array. 1605 * 1606 * @static 1607 * 1608 * @example 1609 * 1610 * var wordArray = CryptoJS.enc.Base64url.parse(base64String); 1611 */ 1612 parse: function (base64Str, urlSafe) { 1613 if (urlSafe === undefined) { 1614 urlSafe = true; 1615 } 1616 1617 // Shortcuts 1618 var base64StrLength = base64Str.length; 1619 var map = urlSafe ? this._safe_map : this._map; 1620 var reverseMap = this._reverseMap; 1621 1622 if (!reverseMap) { 1623 reverseMap = this._reverseMap = []; 1624 for (var j = 0; j < map.length; j++) { 1625 reverseMap[map.charCodeAt(j)] = j; 1626 } 1627 } 1628 1629 // Ignore padding 1630 var paddingChar = map.charAt(64); 1631 if (paddingChar) { 1632 var paddingIndex = base64Str.indexOf(paddingChar); 1633 if (paddingIndex !== -1) { 1634 base64StrLength = paddingIndex; 1635 } 1636 } 1637 1638 // Convert 1639 return parseLoop(base64Str, base64StrLength, reverseMap); 1640 1641 }, 1642 1643 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', 1644 _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', 1645 }; 1646 1647 function parseLoop(base64Str, base64StrLength, reverseMap) { 1648 var words = []; 1649 var nBytes = 0; 1650 for (var i = 0; i < base64StrLength; i++) { 1651 if (i % 4) { 1652 var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); 1653 var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); 1654 var bitsCombined = bits1 | bits2; 1655 words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); 1656 nBytes++; 1657 } 1658 } 1659 return WordArray.create(words, nBytes); 1660 } 1661 }()); 1662 1663 1664 return CryptoJS.enc.Base64url; 1665 1666 })); 1667 } (encBase64url$1)); 1668 return encBase64url$1.exports; 1669} 1670 1671var md5$1 = {exports: {}}; 1672 1673var md5 = md5$1.exports; 1674 1675var hasRequiredMd5; 1676 1677function requireMd5 () { 1678 if (hasRequiredMd5) return md5$1.exports; 1679 hasRequiredMd5 = 1; 1680 (function (module, exports$1) { 1681(function (root, factory) { 1682 { 1683 // CommonJS 1684 module.exports = factory(requireCore()); 1685 } 1686 }(md5, function (CryptoJS) { 1687 1688 (function (Math) { 1689 // Shortcuts 1690 var C = CryptoJS; 1691 var C_lib = C.lib; 1692 var WordArray = C_lib.WordArray; 1693 var Hasher = C_lib.Hasher; 1694 var C_algo = C.algo; 1695 1696 // Constants table 1697 var T = []; 1698 1699 // Compute constants 1700 (function () { 1701 for (var i = 0; i < 64; i++) { 1702 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; 1703 } 1704 }()); 1705 1706 /** 1707 * MD5 hash algorithm. 1708 */ 1709 var MD5 = C_algo.MD5 = Hasher.extend({ 1710 _doReset: function () { 1711 this._hash = new WordArray.init([ 1712 0x67452301, 0xefcdab89, 1713 0x98badcfe, 0x10325476 1714 ]); 1715 }, 1716 1717 _doProcessBlock: function (M, offset) { 1718 // Swap endian 1719 for (var i = 0; i < 16; i++) { 1720 // Shortcuts 1721 var offset_i = offset + i; 1722 var M_offset_i = M[offset_i]; 1723 1724 M[offset_i] = ( 1725 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 1726 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 1727 ); 1728 } 1729 1730 // Shortcuts 1731 var H = this._hash.words; 1732 1733 var M_offset_0 = M[offset + 0]; 1734 var M_offset_1 = M[offset + 1]; 1735 var M_offset_2 = M[offset + 2]; 1736 var M_offset_3 = M[offset + 3]; 1737 var M_offset_4 = M[offset + 4]; 1738 var M_offset_5 = M[offset + 5]; 1739 var M_offset_6 = M[offset + 6]; 1740 var M_offset_7 = M[offset + 7]; 1741 var M_offset_8 = M[offset + 8]; 1742 var M_offset_9 = M[offset + 9]; 1743 var M_offset_10 = M[offset + 10]; 1744 var M_offset_11 = M[offset + 11]; 1745 var M_offset_12 = M[offset + 12]; 1746 var M_offset_13 = M[offset + 13]; 1747 var M_offset_14 = M[offset + 14]; 1748 var M_offset_15 = M[offset + 15]; 1749 1750 // Working variables 1751 var a = H[0]; 1752 var b = H[1]; 1753 var c = H[2]; 1754 var d = H[3]; 1755 1756 // Computation 1757 a = FF(a, b, c, d, M_offset_0, 7, T[0]); 1758 d = FF(d, a, b, c, M_offset_1, 12, T[1]);
vendor: 20,587 bytes, lines 1759-2427
1759 c = FF(c, d, a, b, M_offset_2, 17, T[2]); 1760 b = FF(b, c, d, a, M_offset_3, 22, T[3]); 1761 a = FF(a, b, c, d, M_offset_4, 7, T[4]); 1762 d = FF(d, a, b, c, M_offset_5, 12, T[5]); 1763 c = FF(c, d, a, b, M_offset_6, 17, T[6]); 1764 b = FF(b, c, d, a, M_offset_7, 22, T[7]); 1765 a = FF(a, b, c, d, M_offset_8, 7, T[8]); 1766 d = FF(d, a, b, c, M_offset_9, 12, T[9]); 1767 c = FF(c, d, a, b, M_offset_10, 17, T[10]); 1768 b = FF(b, c, d, a, M_offset_11, 22, T[11]); 1769 a = FF(a, b, c, d, M_offset_12, 7, T[12]); 1770 d = FF(d, a, b, c, M_offset_13, 12, T[13]); 1771 c = FF(c, d, a, b, M_offset_14, 17, T[14]); 1772 b = FF(b, c, d, a, M_offset_15, 22, T[15]); 1773 1774 a = GG(a, b, c, d, M_offset_1, 5, T[16]); 1775 d = GG(d, a, b, c, M_offset_6, 9, T[17]); 1776 c = GG(c, d, a, b, M_offset_11, 14, T[18]); 1777 b = GG(b, c, d, a, M_offset_0, 20, T[19]); 1778 a = GG(a, b, c, d, M_offset_5, 5, T[20]); 1779 d = GG(d, a, b, c, M_offset_10, 9, T[21]); 1780 c = GG(c, d, a, b, M_offset_15, 14, T[22]); 1781 b = GG(b, c, d, a, M_offset_4, 20, T[23]); 1782 a = GG(a, b, c, d, M_offset_9, 5, T[24]); 1783 d = GG(d, a, b, c, M_offset_14, 9, T[25]); 1784 c = GG(c, d, a, b, M_offset_3, 14, T[26]); 1785 b = GG(b, c, d, a, M_offset_8, 20, T[27]); 1786 a = GG(a, b, c, d, M_offset_13, 5, T[28]); 1787 d = GG(d, a, b, c, M_offset_2, 9, T[29]); 1788 c = GG(c, d, a, b, M_offset_7, 14, T[30]); 1789 b = GG(b, c, d, a, M_offset_12, 20, T[31]); 1790 1791 a = HH(a, b, c, d, M_offset_5, 4, T[32]); 1792 d = HH(d, a, b, c, M_offset_8, 11, T[33]); 1793 c = HH(c, d, a, b, M_offset_11, 16, T[34]); 1794 b = HH(b, c, d, a, M_offset_14, 23, T[35]); 1795 a = HH(a, b, c, d, M_offset_1, 4, T[36]); 1796 d = HH(d, a, b, c, M_offset_4, 11, T[37]); 1797 c = HH(c, d, a, b, M_offset_7, 16, T[38]); 1798 b = HH(b, c, d, a, M_offset_10, 23, T[39]); 1799 a = HH(a, b, c, d, M_offset_13, 4, T[40]); 1800 d = HH(d, a, b, c, M_offset_0, 11, T[41]); 1801 c = HH(c, d, a, b, M_offset_3, 16, T[42]); 1802 b = HH(b, c, d, a, M_offset_6, 23, T[43]); 1803 a = HH(a, b, c, d, M_offset_9, 4, T[44]); 1804 d = HH(d, a, b, c, M_offset_12, 11, T[45]); 1805 c = HH(c, d, a, b, M_offset_15, 16, T[46]); 1806 b = HH(b, c, d, a, M_offset_2, 23, T[47]); 1807 1808 a = II(a, b, c, d, M_offset_0, 6, T[48]); 1809 d = II(d, a, b, c, M_offset_7, 10, T[49]); 1810 c = II(c, d, a, b, M_offset_14, 15, T[50]); 1811 b = II(b, c, d, a, M_offset_5, 21, T[51]); 1812 a = II(a, b, c, d, M_offset_12, 6, T[52]); 1813 d = II(d, a, b, c, M_offset_3, 10, T[53]); 1814 c = II(c, d, a, b, M_offset_10, 15, T[54]); 1815 b = II(b, c, d, a, M_offset_1, 21, T[55]); 1816 a = II(a, b, c, d, M_offset_8, 6, T[56]); 1817 d = II(d, a, b, c, M_offset_15, 10, T[57]); 1818 c = II(c, d, a, b, M_offset_6, 15, T[58]); 1819 b = II(b, c, d, a, M_offset_13, 21, T[59]); 1820 a = II(a, b, c, d, M_offset_4, 6, T[60]); 1821 d = II(d, a, b, c, M_offset_11, 10, T[61]); 1822 c = II(c, d, a, b, M_offset_2, 15, T[62]); 1823 b = II(b, c, d, a, M_offset_9, 21, T[63]); 1824 1825 // Intermediate hash value 1826 H[0] = (H[0] + a) | 0; 1827 H[1] = (H[1] + b) | 0; 1828 H[2] = (H[2] + c) | 0; 1829 H[3] = (H[3] + d) | 0; 1830 }, 1831 1832 _doFinalize: function () { 1833 // Shortcuts 1834 var data = this._data; 1835 var dataWords = data.words; 1836 1837 var nBitsTotal = this._nDataBytes * 8; 1838 var nBitsLeft = data.sigBytes * 8; 1839 1840 // Add padding 1841 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 1842 1843 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); 1844 var nBitsTotalL = nBitsTotal; 1845 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( 1846 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | 1847 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) 1848 ); 1849 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 1850 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | 1851 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) 1852 ); 1853 1854 data.sigBytes = (dataWords.length + 1) * 4; 1855 1856 // Hash final blocks 1857 this._process(); 1858 1859 // Shortcuts 1860 var hash = this._hash; 1861 var H = hash.words; 1862 1863 // Swap endian 1864 for (var i = 0; i < 4; i++) { 1865 // Shortcut 1866 var H_i = H[i]; 1867 1868 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 1869 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 1870 } 1871 1872 // Return final computed hash 1873 return hash; 1874 }, 1875 1876 clone: function () { 1877 var clone = Hasher.clone.call(this); 1878 clone._hash = this._hash.clone(); 1879 1880 return clone; 1881 } 1882 }); 1883 1884 function FF(a, b, c, d, x, s, t) { 1885 var n = a + ((b & c) | (~b & d)) + x + t; 1886 return ((n << s) | (n >>> (32 - s))) + b; 1887 } 1888 1889 function GG(a, b, c, d, x, s, t) { 1890 var n = a + ((b & d) | (c & ~d)) + x + t; 1891 return ((n << s) | (n >>> (32 - s))) + b; 1892 } 1893 1894 function HH(a, b, c, d, x, s, t) { 1895 var n = a + (b ^ c ^ d) + x + t; 1896 return ((n << s) | (n >>> (32 - s))) + b; 1897 } 1898 1899 function II(a, b, c, d, x, s, t) { 1900 var n = a + (c ^ (b | ~d)) + x + t; 1901 return ((n << s) | (n >>> (32 - s))) + b; 1902 } 1903 1904 /** 1905 * Shortcut function to the hasher's object interface. 1906 * 1907 * @param {WordArray|string} message The message to hash. 1908 * 1909 * @return {WordArray} The hash. 1910 * 1911 * @static 1912 * 1913 * @example 1914 * 1915 * var hash = CryptoJS.MD5('message'); 1916 * var hash = CryptoJS.MD5(wordArray); 1917 */ 1918 C.MD5 = Hasher._createHelper(MD5); 1919 1920 /** 1921 * Shortcut function to the HMAC's object interface. 1922 * 1923 * @param {WordArray|string} message The message to hash. 1924 * @param {WordArray|string} key The secret key. 1925 * 1926 * @return {WordArray} The HMAC. 1927 * 1928 * @static 1929 * 1930 * @example 1931 * 1932 * var hmac = CryptoJS.HmacMD5(message, key); 1933 */ 1934 C.HmacMD5 = Hasher._createHmacHelper(MD5); 1935 }(Math)); 1936 1937 1938 return CryptoJS.MD5; 1939 1940 })); 1941 } (md5$1)); 1942 return md5$1.exports; 1943} 1944 1945var sha1$1 = {exports: {}}; 1946 1947var sha1 = sha1$1.exports; 1948 1949var hasRequiredSha1; 1950 1951function requireSha1 () { 1952 if (hasRequiredSha1) return sha1$1.exports; 1953 hasRequiredSha1 = 1; 1954 (function (module, exports$1) { 1955(function (root, factory) { 1956 { 1957 // CommonJS 1958 module.exports = factory(requireCore()); 1959 } 1960 }(sha1, function (CryptoJS) { 1961 1962 (function () { 1963 // Shortcuts 1964 var C = CryptoJS; 1965 var C_lib = C.lib; 1966 var WordArray = C_lib.WordArray; 1967 var Hasher = C_lib.Hasher; 1968 var C_algo = C.algo; 1969 1970 // Reusable object 1971 var W = []; 1972 1973 /** 1974 * SHA-1 hash algorithm. 1975 */ 1976 var SHA1 = C_algo.SHA1 = Hasher.extend({ 1977 _doReset: function () { 1978 this._hash = new WordArray.init([ 1979 0x67452301, 0xefcdab89, 1980 0x98badcfe, 0x10325476, 1981 0xc3d2e1f0 1982 ]); 1983 }, 1984 1985 _doProcessBlock: function (M, offset) { 1986 // Shortcut 1987 var H = this._hash.words; 1988 1989 // Working variables 1990 var a = H[0]; 1991 var b = H[1]; 1992 var c = H[2]; 1993 var d = H[3]; 1994 var e = H[4]; 1995 1996 // Computation 1997 for (var i = 0; i < 80; i++) { 1998 if (i < 16) { 1999 W[i] = M[offset + i] | 0; 2000 } else { 2001 var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; 2002 W[i] = (n << 1) | (n >>> 31); 2003 } 2004 2005 var t = ((a << 5) | (a >>> 27)) + e + W[i]; 2006 if (i < 20) { 2007 t += ((b & c) | (~b & d)) + 0x5a827999; 2008 } else if (i < 40) { 2009 t += (b ^ c ^ d) + 0x6ed9eba1; 2010 } else if (i < 60) { 2011 t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; 2012 } else /* if (i < 80) */ { 2013 t += (b ^ c ^ d) - 0x359d3e2a; 2014 } 2015 2016 e = d; 2017 d = c; 2018 c = (b << 30) | (b >>> 2); 2019 b = a; 2020 a = t; 2021 } 2022 2023 // Intermediate hash value 2024 H[0] = (H[0] + a) | 0; 2025 H[1] = (H[1] + b) | 0; 2026 H[2] = (H[2] + c) | 0; 2027 H[3] = (H[3] + d) | 0; 2028 H[4] = (H[4] + e) | 0; 2029 }, 2030 2031 _doFinalize: function () { 2032 // Shortcuts 2033 var data = this._data; 2034 var dataWords = data.words; 2035 2036 var nBitsTotal = this._nDataBytes * 8; 2037 var nBitsLeft = data.sigBytes * 8; 2038 2039 // Add padding 2040 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 2041 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); 2042 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; 2043 data.sigBytes = dataWords.length * 4; 2044 2045 // Hash final blocks 2046 this._process(); 2047 2048 // Return final computed hash 2049 return this._hash; 2050 }, 2051 2052 clone: function () { 2053 var clone = Hasher.clone.call(this); 2054 clone._hash = this._hash.clone(); 2055 2056 return clone; 2057 } 2058 }); 2059 2060 /** 2061 * Shortcut function to the hasher's object interface. 2062 * 2063 * @param {WordArray|string} message The message to hash. 2064 * 2065 * @return {WordArray} The hash. 2066 * 2067 * @static 2068 * 2069 * @example 2070 * 2071 * var hash = CryptoJS.SHA1('message'); 2072 * var hash = CryptoJS.SHA1(wordArray); 2073 */ 2074 C.SHA1 = Hasher._createHelper(SHA1); 2075 2076 /** 2077 * Shortcut function to the HMAC's object interface. 2078 * 2079 * @param {WordArray|string} message The message to hash. 2080 * @param {WordArray|string} key The secret key. 2081 * 2082 * @return {WordArray} The HMAC. 2083 * 2084 * @static 2085 * 2086 * @example 2087 * 2088 * var hmac = CryptoJS.HmacSHA1(message, key); 2089 */ 2090 C.HmacSHA1 = Hasher._createHmacHelper(SHA1); 2091 }()); 2092 2093 2094 return CryptoJS.SHA1; 2095 2096 })); 2097 } (sha1$1)); 2098 return sha1$1.exports; 2099} 2100 2101var sha256$1 = {exports: {}}; 2102 2103var sha256 = sha256$1.exports; 2104 2105var hasRequiredSha256; 2106 2107function requireSha256 () { 2108 if (hasRequiredSha256) return sha256$1.exports; 2109 hasRequiredSha256 = 1; 2110 (function (module, exports$1) { 2111(function (root, factory) { 2112 { 2113 // CommonJS 2114 module.exports = factory(requireCore()); 2115 } 2116 }(sha256, function (CryptoJS) { 2117 2118 (function (Math) { 2119 // Shortcuts 2120 var C = CryptoJS; 2121 var C_lib = C.lib; 2122 var WordArray = C_lib.WordArray; 2123 var Hasher = C_lib.Hasher; 2124 var C_algo = C.algo; 2125 2126 // Initialization and round constants tables 2127 var H = []; 2128 var K = []; 2129 2130 // Compute constants 2131 (function () { 2132 function isPrime(n) { 2133 var sqrtN = Math.sqrt(n); 2134 for (var factor = 2; factor <= sqrtN; factor++) { 2135 if (!(n % factor)) { 2136 return false; 2137 } 2138 } 2139 2140 return true; 2141 } 2142 2143 function getFractionalBits(n) { 2144 return ((n - (n | 0)) * 0x100000000) | 0; 2145 } 2146 2147 var n = 2; 2148 var nPrime = 0; 2149 while (nPrime < 64) { 2150 if (isPrime(n)) { 2151 if (nPrime < 8) { 2152 H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); 2153 } 2154 K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); 2155 2156 nPrime++; 2157 } 2158 2159 n++; 2160 } 2161 }()); 2162 2163 // Reusable object 2164 var W = []; 2165 2166 /** 2167 * SHA-256 hash algorithm. 2168 */ 2169 var SHA256 = C_algo.SHA256 = Hasher.extend({ 2170 _doReset: function () { 2171 this._hash = new WordArray.init(H.slice(0)); 2172 }, 2173 2174 _doProcessBlock: function (M, offset) { 2175 // Shortcut 2176 var H = this._hash.words; 2177 2178 // Working variables 2179 var a = H[0]; 2180 var b = H[1]; 2181 var c = H[2]; 2182 var d = H[3]; 2183 var e = H[4]; 2184 var f = H[5]; 2185 var g = H[6]; 2186 var h = H[7]; 2187 2188 // Computation 2189 for (var i = 0; i < 64; i++) { 2190 if (i < 16) { 2191 W[i] = M[offset + i] | 0; 2192 } else { 2193 var gamma0x = W[i - 15]; 2194 var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ 2195 ((gamma0x << 14) | (gamma0x >>> 18)) ^ 2196 (gamma0x >>> 3); 2197 2198 var gamma1x = W[i - 2]; 2199 var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ 2200 ((gamma1x << 13) | (gamma1x >>> 19)) ^ 2201 (gamma1x >>> 10); 2202 2203 W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; 2204 } 2205 2206 var ch = (e & f) ^ (~e & g); 2207 var maj = (a & b) ^ (a & c) ^ (b & c); 2208 2209 var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); 2210 var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); 2211 2212 var t1 = h + sigma1 + ch + K[i] + W[i]; 2213 var t2 = sigma0 + maj; 2214 2215 h = g; 2216 g = f; 2217 f = e; 2218 e = (d + t1) | 0; 2219 d = c; 2220 c = b; 2221 b = a; 2222 a = (t1 + t2) | 0; 2223 } 2224 2225 // Intermediate hash value 2226 H[0] = (H[0] + a) | 0; 2227 H[1] = (H[1] + b) | 0; 2228 H[2] = (H[2] + c) | 0; 2229 H[3] = (H[3] + d) | 0; 2230 H[4] = (H[4] + e) | 0; 2231 H[5] = (H[5] + f) | 0; 2232 H[6] = (H[6] + g) | 0; 2233 H[7] = (H[7] + h) | 0; 2234 }, 2235 2236 _doFinalize: function () { 2237 // Shortcuts 2238 var data = this._data; 2239 var dataWords = data.words; 2240 2241 var nBitsTotal = this._nDataBytes * 8; 2242 var nBitsLeft = data.sigBytes * 8; 2243 2244 // Add padding 2245 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 2246 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); 2247 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; 2248 data.sigBytes = dataWords.length * 4; 2249 2250 // Hash final blocks 2251 this._process(); 2252 2253 // Return final computed hash 2254 return this._hash; 2255 }, 2256 2257 clone: function () { 2258 var clone = Hasher.clone.call(this); 2259 clone._hash = this._hash.clone(); 2260 2261 return clone; 2262 } 2263 }); 2264 2265 /** 2266 * Shortcut function to the hasher's object interface. 2267 * 2268 * @param {WordArray|string} message The message to hash. 2269 * 2270 * @return {WordArray} The hash. 2271 * 2272 * @static 2273 * 2274 * @example 2275 * 2276 * var hash = CryptoJS.SHA256('message'); 2277 * var hash = CryptoJS.SHA256(wordArray); 2278 */ 2279 C.SHA256 = Hasher._createHelper(SHA256); 2280 2281 /** 2282 * Shortcut function to the HMAC's object interface. 2283 * 2284 * @param {WordArray|string} message The message to hash. 2285 * @param {WordArray|string} key The secret key. 2286 * 2287 * @return {WordArray} The HMAC. 2288 * 2289 * @static 2290 * 2291 * @example 2292 * 2293 * var hmac = CryptoJS.HmacSHA256(message, key); 2294 */ 2295 C.HmacSHA256 = Hasher._createHmacHelper(SHA256); 2296 }(Math)); 2297 2298 2299 return CryptoJS.SHA256; 2300 2301 })); 2302 } (sha256$1)); 2303 return sha256$1.exports; 2304} 2305 2306var sha224$1 = {exports: {}}; 2307 2308var sha224 = sha224$1.exports; 2309 2310var hasRequiredSha224; 2311 2312function requireSha224 () { 2313 if (hasRequiredSha224) return sha224$1.exports; 2314 hasRequiredSha224 = 1; 2315 (function (module, exports$1) { 2316(function (root, factory, undef) { 2317 { 2318 // CommonJS 2319 module.exports = factory(requireCore(), requireSha256()); 2320 } 2321 }(sha224, function (CryptoJS) { 2322 2323 (function () { 2324 // Shortcuts 2325 var C = CryptoJS; 2326 var C_lib = C.lib; 2327 var WordArray = C_lib.WordArray; 2328 var C_algo = C.algo; 2329 var SHA256 = C_algo.SHA256; 2330 2331 /** 2332 * SHA-224 hash algorithm. 2333 */ 2334 var SHA224 = C_algo.SHA224 = SHA256.extend({ 2335 _doReset: function () { 2336 this._hash = new WordArray.init([ 2337 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 2338 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 2339 ]); 2340 }, 2341 2342 _doFinalize: function () { 2343 var hash = SHA256._doFinalize.call(this); 2344 2345 hash.sigBytes -= 4; 2346 2347 return hash; 2348 } 2349 }); 2350 2351 /** 2352 * Shortcut function to the hasher's object interface. 2353 * 2354 * @param {WordArray|string} message The message to hash. 2355 * 2356 * @return {WordArray} The hash. 2357 * 2358 * @static 2359 * 2360 * @example 2361 * 2362 * var hash = CryptoJS.SHA224('message'); 2363 * var hash = CryptoJS.SHA224(wordArray); 2364 */ 2365 C.SHA224 = SHA256._createHelper(SHA224); 2366 2367 /** 2368 * Shortcut function to the HMAC's object interface. 2369 * 2370 * @param {WordArray|string} message The message to hash. 2371 * @param {WordArray|string} key The secret key. 2372 * 2373 * @return {WordArray} The HMAC. 2374 * 2375 * @static 2376 * 2377 * @example 2378 * 2379 * var hmac = CryptoJS.HmacSHA224(message, key); 2380 */ 2381 C.HmacSHA224 = SHA256._createHmacHelper(SHA224); 2382 }()); 2383 2384 2385 return CryptoJS.SHA224; 2386 2387 })); 2388 } (sha224$1)); 2389 return sha224$1.exports; 2390} 2391 2392var sha512$1 = {exports: {}}; 2393 2394var sha512 = sha512$1.exports; 2395 2396var hasRequiredSha512; 2397 2398function requireSha512 () { 2399 if (hasRequiredSha512) return sha512$1.exports; 2400 hasRequiredSha512 = 1; 2401 (function (module, exports$1) { 2402(function (root, factory, undef) { 2403 { 2404 // CommonJS 2405 module.exports = factory(requireCore(), requireX64Core()); 2406 } 2407 }(sha512, function (CryptoJS) { 2408 2409 (function () { 2410 // Shortcuts 2411 var C = CryptoJS; 2412 var C_lib = C.lib; 2413 var Hasher = C_lib.Hasher; 2414 var C_x64 = C.x64; 2415 var X64Word = C_x64.Word; 2416 var X64WordArray = C_x64.WordArray; 2417 var C_algo = C.algo; 2418 2419 function X64Word_create() { 2420 return X64Word.create.apply(X64Word, arguments); 2421 } 2422 2423 // Constants 2424 var K = [ 2425 X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), 2426 X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), 2427 X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb
vendor: 7,147 bytes, lines 2427-2565
2427605d019), 2428 X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), 2429 X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), 2430 X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), 2431 X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), 2432 X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), 2433 X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), 2434 X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), 2435 X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), 2436 X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), 2437 X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), 2438 X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), 2439 X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), 2440 X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), 2441 X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), 2442 X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), 2443 X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), 2444 X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), 2445 X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), 2446 X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), 2447 X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), 2448 X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), 2449 X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), 2450 X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), 2451 X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), 2452 X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), 2453 X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), 2454 X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), 2455 X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), 2456 X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), 2457 X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), 2458 X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), 2459 X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), 2460 X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), 2461 X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), 2462 X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), 2463 X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), 2464 X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) 2465 ]; 2466 2467 // Reusable objects 2468 var W = []; 2469 (function () { 2470 for (var i = 0; i < 80; i++) { 2471 W[i] = X64Word_create(); 2472 } 2473 }()); 2474 2475 /** 2476 * SHA-512 hash algorithm. 2477 */ 2478 var SHA512 = C_algo.SHA512 = Hasher.extend({ 2479 _doReset: function () { 2480 this._hash = new X64WordArray.init([ 2481 new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), 2482 new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), 2483 new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), 2484 new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) 2485 ]); 2486 }, 2487 2488 _doProcessBlock: function (M, offset) { 2489 // Shortcuts 2490 var H = this._hash.words; 2491 2492 var H0 = H[0]; 2493 var H1 = H[1]; 2494 var H2 = H[2]; 2495 var H3 = H[3]; 2496 var H4 = H[4]; 2497 var H5 = H[5]; 2498 var H6 = H[6]; 2499 var H7 = H[7]; 2500 2501 var H0h = H0.high; 2502 var H0l = H0.low; 2503 var H1h = H1.high; 2504 var H1l = H1.low; 2505 var H2h = H2.high; 2506 var H2l = H2.low; 2507 var H3h = H3.high; 2508 var H3l = H3.low; 2509 var H4h = H4.high; 2510 var H4l = H4.low; 2511 var H5h = H5.high; 2512 var H5l = H5.low; 2513 var H6h = H6.high; 2514 var H6l = H6.low; 2515 var H7h = H7.high; 2516 var H7l = H7.low; 2517 2518 // Working variables 2519 var ah = H0h; 2520 var al = H0l; 2521 var bh = H1h; 2522 var bl = H1l; 2523 var ch = H2h; 2524 var cl = H2l; 2525 var dh = H3h; 2526 var dl = H3l; 2527 var eh = H4h; 2528 var el = H4l; 2529 var fh = H5h; 2530 var fl = H5l; 2531 var gh = H6h; 2532 var gl = H6l; 2533 var hh = H7h; 2534 var hl = H7l; 2535 2536 // Rounds 2537 for (var i = 0; i < 80; i++) { 2538 var Wil; 2539 var Wih; 2540 2541 // Shortcut 2542 var Wi = W[i]; 2543 2544 // Extend message 2545 if (i < 16) { 2546 Wih = Wi.high = M[offset + i * 2] | 0; 2547 Wil = Wi.low = M[offset + i * 2 + 1] | 0; 2548 } else { 2549 // Gamma0 2550 var gamma0x = W[i - 15]; 2551 var gamma0xh = gamma0x.high; 2552 var gamma0xl = gamma0x.low; 2553 var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); 2554 var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); 2555 2556 // Gamma1 2557 var gamma1x = W[i - 2]; 2558 var gamma1xh = gamma1x.high; 2559 var gamma1xl = gamma1x.low; 2560 var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); 2561 var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); 2562 2563 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] 2564 var Wi7 = W[i - 7]; 2565 var Wi7h = Wi7.high;
vendor: 33,783 bytes, lines 2566-3573
2566 var Wi7l = Wi7.low; 2567 2568 var Wi16 = W[i - 16]; 2569 var Wi16h = Wi16.high; 2570 var Wi16l = Wi16.low; 2571 2572 Wil = gamma0l + Wi7l; 2573 Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); 2574 Wil = Wil + gamma1l; 2575 Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); 2576 Wil = Wil + Wi16l; 2577 Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); 2578 2579 Wi.high = Wih; 2580 Wi.low = Wil; 2581 } 2582 2583 var chh = (eh & fh) ^ (~eh & gh); 2584 var chl = (el & fl) ^ (~el & gl); 2585 var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); 2586 var majl = (al & bl) ^ (al & cl) ^ (bl & cl); 2587 2588 var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); 2589 var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); 2590 var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); 2591 var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); 2592 2593 // t1 = h + sigma1 + ch + K[i] + W[i] 2594 var Ki = K[i]; 2595 var Kih = Ki.high; 2596 var Kil = Ki.low; 2597 2598 var t1l = hl + sigma1l; 2599 var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); 2600 var t1l = t1l + chl; 2601 var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); 2602 var t1l = t1l + Kil; 2603 var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); 2604 var t1l = t1l + Wil; 2605 var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); 2606 2607 // t2 = sigma0 + maj 2608 var t2l = sigma0l + majl; 2609 var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); 2610 2611 // Update working variables 2612 hh = gh; 2613 hl = gl; 2614 gh = fh; 2615 gl = fl; 2616 fh = eh; 2617 fl = el; 2618 el = (dl + t1l) | 0; 2619 eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; 2620 dh = ch; 2621 dl = cl; 2622 ch = bh; 2623 cl = bl; 2624 bh = ah; 2625 bl = al; 2626 al = (t1l + t2l) | 0; 2627 ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; 2628 } 2629 2630 // Intermediate hash value 2631 H0l = H0.low = (H0l + al); 2632 H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); 2633 H1l = H1.low = (H1l + bl); 2634 H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); 2635 H2l = H2.low = (H2l + cl); 2636 H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); 2637 H3l = H3.low = (H3l + dl); 2638 H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); 2639 H4l = H4.low = (H4l + el); 2640 H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); 2641 H5l = H5.low = (H5l + fl); 2642 H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); 2643 H6l = H6.low = (H6l + gl); 2644 H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); 2645 H7l = H7.low = (H7l + hl); 2646 H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); 2647 }, 2648 2649 _doFinalize: function () { 2650 // Shortcuts 2651 var data = this._data; 2652 var dataWords = data.words; 2653 2654 var nBitsTotal = this._nDataBytes * 8; 2655 var nBitsLeft = data.sigBytes * 8; 2656 2657 // Add padding 2658 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 2659 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); 2660 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; 2661 data.sigBytes = dataWords.length * 4; 2662 2663 // Hash final blocks 2664 this._process(); 2665 2666 // Convert hash to 32-bit word array before returning 2667 var hash = this._hash.toX32(); 2668 2669 // Return final computed hash 2670 return hash; 2671 }, 2672 2673 clone: function () { 2674 var clone = Hasher.clone.call(this); 2675 clone._hash = this._hash.clone(); 2676 2677 return clone; 2678 }, 2679 2680 blockSize: 1024/32 2681 }); 2682 2683 /** 2684 * Shortcut function to the hasher's object interface. 2685 * 2686 * @param {WordArray|string} message The message to hash. 2687 * 2688 * @return {WordArray} The hash. 2689 * 2690 * @static 2691 * 2692 * @example 2693 * 2694 * var hash = CryptoJS.SHA512('message'); 2695 * var hash = CryptoJS.SHA512(wordArray); 2696 */ 2697 C.SHA512 = Hasher._createHelper(SHA512); 2698 2699 /** 2700 * Shortcut function to the HMAC's object interface. 2701 * 2702 * @param {WordArray|string} message The message to hash. 2703 * @param {WordArray|string} key The secret key. 2704 * 2705 * @return {WordArray} The HMAC. 2706 * 2707 * @static 2708 * 2709 * @example 2710 * 2711 * var hmac = CryptoJS.HmacSHA512(message, key); 2712 */ 2713 C.HmacSHA512 = Hasher._createHmacHelper(SHA512); 2714 }()); 2715 2716 2717 return CryptoJS.SHA512; 2718 2719 })); 2720 } (sha512$1)); 2721 return sha512$1.exports; 2722} 2723 2724var sha384$1 = {exports: {}}; 2725 2726var sha384 = sha384$1.exports; 2727 2728var hasRequiredSha384; 2729 2730function requireSha384 () { 2731 if (hasRequiredSha384) return sha384$1.exports; 2732 hasRequiredSha384 = 1; 2733 (function (module, exports$1) { 2734(function (root, factory, undef) { 2735 { 2736 // CommonJS 2737 module.exports = factory(requireCore(), requireX64Core(), requireSha512()); 2738 } 2739 }(sha384, function (CryptoJS) { 2740 2741 (function () { 2742 // Shortcuts 2743 var C = CryptoJS; 2744 var C_x64 = C.x64; 2745 var X64Word = C_x64.Word; 2746 var X64WordArray = C_x64.WordArray; 2747 var C_algo = C.algo; 2748 var SHA512 = C_algo.SHA512; 2749 2750 /** 2751 * SHA-384 hash algorithm. 2752 */ 2753 var SHA384 = C_algo.SHA384 = SHA512.extend({ 2754 _doReset: function () { 2755 this._hash = new X64WordArray.init([ 2756 new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), 2757 new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), 2758 new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), 2759 new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) 2760 ]); 2761 }, 2762 2763 _doFinalize: function () { 2764 var hash = SHA512._doFinalize.call(this); 2765 2766 hash.sigBytes -= 16; 2767 2768 return hash; 2769 } 2770 }); 2771 2772 /** 2773 * Shortcut function to the hasher's object interface. 2774 * 2775 * @param {WordArray|string} message The message to hash. 2776 * 2777 * @return {WordArray} The hash. 2778 * 2779 * @static 2780 * 2781 * @example 2782 * 2783 * var hash = CryptoJS.SHA384('message'); 2784 * var hash = CryptoJS.SHA384(wordArray); 2785 */ 2786 C.SHA384 = SHA512._createHelper(SHA384); 2787 2788 /** 2789 * Shortcut function to the HMAC's object interface. 2790 * 2791 * @param {WordArray|string} message The message to hash. 2792 * @param {WordArray|string} key The secret key. 2793 * 2794 * @return {WordArray} The HMAC. 2795 * 2796 * @static 2797 * 2798 * @example 2799 * 2800 * var hmac = CryptoJS.HmacSHA384(message, key); 2801 */ 2802 C.HmacSHA384 = SHA512._createHmacHelper(SHA384); 2803 }()); 2804 2805 2806 return CryptoJS.SHA384; 2807 2808 })); 2809 } (sha384$1)); 2810 return sha384$1.exports; 2811} 2812 2813var sha3$1 = {exports: {}}; 2814 2815var sha3 = sha3$1.exports; 2816 2817var hasRequiredSha3; 2818 2819function requireSha3 () { 2820 if (hasRequiredSha3) return sha3$1.exports; 2821 hasRequiredSha3 = 1; 2822 (function (module, exports$1) { 2823(function (root, factory, undef) { 2824 { 2825 // CommonJS 2826 module.exports = factory(requireCore(), requireX64Core()); 2827 } 2828 }(sha3, function (CryptoJS) { 2829 2830 (function (Math) { 2831 // Shortcuts 2832 var C = CryptoJS; 2833 var C_lib = C.lib; 2834 var WordArray = C_lib.WordArray; 2835 var Hasher = C_lib.Hasher; 2836 var C_x64 = C.x64; 2837 var X64Word = C_x64.Word; 2838 var C_algo = C.algo; 2839 2840 // Constants tables 2841 var RHO_OFFSETS = []; 2842 var PI_INDEXES = []; 2843 var ROUND_CONSTANTS = []; 2844 2845 // Compute Constants 2846 (function () { 2847 // Compute rho offset constants 2848 var x = 1, y = 0; 2849 for (var t = 0; t < 24; t++) { 2850 RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; 2851 2852 var newX = y % 5; 2853 var newY = (2 * x + 3 * y) % 5; 2854 x = newX; 2855 y = newY; 2856 } 2857 2858 // Compute pi index constants 2859 for (var x = 0; x < 5; x++) { 2860 for (var y = 0; y < 5; y++) { 2861 PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; 2862 } 2863 } 2864 2865 // Compute round constants 2866 var LFSR = 0x01; 2867 for (var i = 0; i < 24; i++) { 2868 var roundConstantMsw = 0; 2869 var roundConstantLsw = 0; 2870 2871 for (var j = 0; j < 7; j++) { 2872 if (LFSR & 0x01) { 2873 var bitPosition = (1 << j) - 1; 2874 if (bitPosition < 32) { 2875 roundConstantLsw ^= 1 << bitPosition; 2876 } else /* if (bitPosition >= 32) */ { 2877 roundConstantMsw ^= 1 << (bitPosition - 32); 2878 } 2879 } 2880 2881 // Compute next LFSR 2882 if (LFSR & 0x80) { 2883 // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 2884 LFSR = (LFSR << 1) ^ 0x71; 2885 } else { 2886 LFSR <<= 1; 2887 } 2888 } 2889 2890 ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); 2891 } 2892 }()); 2893 2894 // Reusable objects for temporary values 2895 var T = []; 2896 (function () { 2897 for (var i = 0; i < 25; i++) { 2898 T[i] = X64Word.create(); 2899 } 2900 }()); 2901 2902 /** 2903 * SHA-3 hash algorithm. 2904 */ 2905 var SHA3 = C_algo.SHA3 = Hasher.extend({ 2906 /** 2907 * Configuration options. 2908 * 2909 * @property {number} outputLength 2910 * The desired number of bits in the output hash. 2911 * Only values permitted are: 224, 256, 384, 512. 2912 * Default: 512 2913 */ 2914 cfg: Hasher.cfg.extend({ 2915 outputLength: 512 2916 }), 2917 2918 _doReset: function () { 2919 var state = this._state = []; 2920 for (var i = 0; i < 25; i++) { 2921 state[i] = new X64Word.init(); 2922 } 2923 2924 this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; 2925 }, 2926 2927 _doProcessBlock: function (M, offset) { 2928 // Shortcuts 2929 var state = this._state; 2930 var nBlockSizeLanes = this.blockSize / 2; 2931 2932 // Absorb 2933 for (var i = 0; i < nBlockSizeLanes; i++) { 2934 // Shortcuts 2935 var M2i = M[offset + 2 * i]; 2936 var M2i1 = M[offset + 2 * i + 1]; 2937 2938 // Swap endian 2939 M2i = ( 2940 (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | 2941 (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) 2942 ); 2943 M2i1 = ( 2944 (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | 2945 (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) 2946 ); 2947 2948 // Absorb message into state 2949 var lane = state[i]; 2950 lane.high ^= M2i1; 2951 lane.low ^= M2i; 2952 } 2953 2954 // Rounds 2955 for (var round = 0; round < 24; round++) { 2956 // Theta 2957 for (var x = 0; x < 5; x++) { 2958 // Mix column lanes 2959 var tMsw = 0, tLsw = 0; 2960 for (var y = 0; y < 5; y++) { 2961 var lane = state[x + 5 * y]; 2962 tMsw ^= lane.high; 2963 tLsw ^= lane.low; 2964 } 2965 2966 // Temporary values 2967 var Tx = T[x]; 2968 Tx.high = tMsw; 2969 Tx.low = tLsw; 2970 } 2971 for (var x = 0; x < 5; x++) { 2972 // Shortcuts 2973 var Tx4 = T[(x + 4) % 5]; 2974 var Tx1 = T[(x + 1) % 5]; 2975 var Tx1Msw = Tx1.high; 2976 var Tx1Lsw = Tx1.low; 2977 2978 // Mix surrounding columns 2979 var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); 2980 var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); 2981 for (var y = 0; y < 5; y++) { 2982 var lane = state[x + 5 * y]; 2983 lane.high ^= tMsw; 2984 lane.low ^= tLsw; 2985 } 2986 } 2987 2988 // Rho Pi 2989 for (var laneIndex = 1; laneIndex < 25; laneIndex++) { 2990 var tMsw; 2991 var tLsw; 2992 2993 // Shortcuts 2994 var lane = state[laneIndex]; 2995 var laneMsw = lane.high; 2996 var laneLsw = lane.low; 2997 var rhoOffset = RHO_OFFSETS[laneIndex]; 2998 2999 // Rotate lanes 3000 if (rhoOffset < 32) { 3001 tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); 3002 tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); 3003 } else /* if (rhoOffset >= 32) */ { 3004 tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); 3005 tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); 3006 } 3007 3008 // Transpose lanes 3009 var TPiLane = T[PI_INDEXES[laneIndex]]; 3010 TPiLane.high = tMsw; 3011 TPiLane.low = tLsw; 3012 } 3013 3014 // Rho pi at x = y = 0 3015 var T0 = T[0]; 3016 var state0 = state[0]; 3017 T0.high = state0.high; 3018 T0.low = state0.low; 3019 3020 // Chi 3021 for (var x = 0; x < 5; x++) { 3022 for (var y = 0; y < 5; y++) { 3023 // Shortcuts 3024 var laneIndex = x + 5 * y; 3025 var lane = state[laneIndex]; 3026 var TLane = T[laneIndex]; 3027 var Tx1Lane = T[((x + 1) % 5) + 5 * y]; 3028 var Tx2Lane = T[((x + 2) % 5) + 5 * y]; 3029 3030 // Mix rows 3031 lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); 3032 lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); 3033 } 3034 } 3035 3036 // Iota 3037 var lane = state[0]; 3038 var roundConstant = ROUND_CONSTANTS[round]; 3039 lane.high ^= roundConstant.high; 3040 lane.low ^= roundConstant.low; 3041 } 3042 }, 3043 3044 _doFinalize: function () { 3045 // Shortcuts 3046 var data = this._data; 3047 var dataWords = data.words; 3048 this._nDataBytes * 8; 3049 var nBitsLeft = data.sigBytes * 8; 3050 var blockSizeBits = this.blockSize * 32; 3051 3052 // Add padding 3053 dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); 3054 dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; 3055 data.sigBytes = dataWords.length * 4; 3056 3057 // Hash final blocks 3058 this._process(); 3059 3060 // Shortcuts 3061 var state = this._state; 3062 var outputLengthBytes = this.cfg.outputLength / 8; 3063 var outputLengthLanes = outputLengthBytes / 8; 3064 3065 // Squeeze 3066 var hashWords = []; 3067 for (var i = 0; i < outputLengthLanes; i++) { 3068 // Shortcuts 3069 var lane = state[i]; 3070 var laneMsw = lane.high; 3071 var laneLsw = lane.low; 3072 3073 // Swap endian 3074 laneMsw = ( 3075 (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | 3076 (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) 3077 ); 3078 laneLsw = ( 3079 (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | 3080 (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) 3081 ); 3082 3083 // Squeeze state to retrieve hash 3084 hashWords.push(laneLsw); 3085 hashWords.push(laneMsw); 3086 } 3087 3088 // Return final computed hash 3089 return new WordArray.init(hashWords, outputLengthBytes); 3090 }, 3091 3092 clone: function () { 3093 var clone = Hasher.clone.call(this); 3094 3095 var state = clone._state = this._state.slice(0); 3096 for (var i = 0; i < 25; i++) { 3097 state[i] = state[i].clone(); 3098 } 3099 3100 return clone; 3101 } 3102 }); 3103 3104 /** 3105 * Shortcut function to the hasher's object interface. 3106 * 3107 * @param {WordArray|string} message The message to hash. 3108 * 3109 * @return {WordArray} The hash. 3110 * 3111 * @static 3112 * 3113 * @example 3114 * 3115 * var hash = CryptoJS.SHA3('message'); 3116 * var hash = CryptoJS.SHA3(wordArray); 3117 */ 3118 C.SHA3 = Hasher._createHelper(SHA3); 3119 3120 /** 3121 * Shortcut function to the HMAC's object interface. 3122 * 3123 * @param {WordArray|string} message The message to hash. 3124 * @param {WordArray|string} key The secret key. 3125 * 3126 * @return {WordArray} The HMAC. 3127 * 3128 * @static 3129 * 3130 * @example 3131 * 3132 * var hmac = CryptoJS.HmacSHA3(message, key); 3133 */ 3134 C.HmacSHA3 = Hasher._createHmacHelper(SHA3); 3135 }(Math)); 3136 3137 3138 return CryptoJS.SHA3; 3139 3140 })); 3141 } (sha3$1)); 3142 return sha3$1.exports; 3143} 3144 3145var ripemd160$1 = {exports: {}}; 3146 3147var ripemd160 = ripemd160$1.exports; 3148 3149var hasRequiredRipemd160; 3150 3151function requireRipemd160 () { 3152 if (hasRequiredRipemd160) return ripemd160$1.exports; 3153 hasRequiredRipemd160 = 1; 3154 (function (module, exports$1) { 3155(function (root, factory) { 3156 { 3157 // CommonJS 3158 module.exports = factory(requireCore()); 3159 } 3160 }(ripemd160, function (CryptoJS) { 3161 3162 /** @preserve 3163 (c) 2012 by Cédric Mesnil. All rights reserved. 3164 3165 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 3166 3167 - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 3168 - 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. 3169 3170 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. 3171 */ 3172 3173 (function (Math) { 3174 // Shortcuts 3175 var C = CryptoJS; 3176 var C_lib = C.lib; 3177 var WordArray = C_lib.WordArray; 3178 var Hasher = C_lib.Hasher; 3179 var C_algo = C.algo; 3180 3181 // Constants table 3182 var _zl = WordArray.create([ 3183 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3184 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3185 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 3186 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 3187 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); 3188 var _zr = WordArray.create([ 3189 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 3190 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 3191 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 3192 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 3193 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); 3194 var _sl = WordArray.create([ 3195 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 3196 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 3197 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 3198 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 3199 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); 3200 var _sr = WordArray.create([ 3201 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 3202 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 3203 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 3204 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 3205 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); 3206 3207 var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); 3208 var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); 3209 3210 /** 3211 * RIPEMD160 hash algorithm. 3212 */ 3213 var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ 3214 _doReset: function () { 3215 this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); 3216 }, 3217 3218 _doProcessBlock: function (M, offset) { 3219 3220 // Swap endian 3221 for (var i = 0; i < 16; i++) { 3222 // Shortcuts 3223 var offset_i = offset + i; 3224 var M_offset_i = M[offset_i]; 3225 3226 // Swap 3227 M[offset_i] = ( 3228 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 3229 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 3230 ); 3231 } 3232 // Shortcut 3233 var H = this._hash.words; 3234 var hl = _hl.words; 3235 var hr = _hr.words; 3236 var zl = _zl.words; 3237 var zr = _zr.words; 3238 var sl = _sl.words; 3239 var sr = _sr.words; 3240 3241 // Working variables 3242 var al, bl, cl, dl, el; 3243 var ar, br, cr, dr, er; 3244 3245 ar = al = H[0]; 3246 br = bl = H[1]; 3247 cr = cl = H[2]; 3248 dr = dl = H[3]; 3249 er = el = H[4]; 3250 // Computation 3251 var t; 3252 for (var i = 0; i < 80; i += 1) { 3253 t = (al + M[offset+zl[i]])|0; 3254 if (i<16){ 3255 t += f1(bl,cl,dl) + hl[0]; 3256 } else if (i<32) { 3257 t += f2(bl,cl,dl) + hl[1]; 3258 } else if (i<48) { 3259 t += f3(bl,cl,dl) + hl[2]; 3260 } else if (i<64) { 3261 t += f4(bl,cl,dl) + hl[3]; 3262 } else {// if (i<80) { 3263 t += f5(bl,cl,dl) + hl[4]; 3264 } 3265 t = t|0; 3266 t = rotl(t,sl[i]); 3267 t = (t+el)|0; 3268 al = el; 3269 el = dl; 3270 dl = rotl(cl, 10); 3271 cl = bl; 3272 bl = t; 3273 3274 t = (ar + M[offset+zr[i]])|0; 3275 if (i<16){ 3276 t += f5(br,cr,dr) + hr[0]; 3277 } else if (i<32) { 3278 t += f4(br,cr,dr) + hr[1]; 3279 } else if (i<48) { 3280 t += f3(br,cr,dr) + hr[2]; 3281 } else if (i<64) { 3282 t += f2(br,cr,dr) + hr[3]; 3283 } else {// if (i<80) { 3284 t += f1(br,cr,dr) + hr[4]; 3285 } 3286 t = t|0; 3287 t = rotl(t,sr[i]) ; 3288 t = (t+er)|0; 3289 ar = er; 3290 er = dr; 3291 dr = rotl(cr, 10); 3292 cr = br; 3293 br = t; 3294 } 3295 // Intermediate hash value 3296 t = (H[1] + cl + dr)|0; 3297 H[1] = (H[2] + dl + er)|0; 3298 H[2] = (H[3] + el + ar)|0; 3299 H[3] = (H[4] + al + br)|0; 3300 H[4] = (H[0] + bl + cr)|0; 3301 H[0] = t; 3302 }, 3303 3304 _doFinalize: function () { 3305 // Shortcuts 3306 var data = this._data; 3307 var dataWords = data.words; 3308 3309 var nBitsTotal = this._nDataBytes * 8; 3310 var nBitsLeft = data.sigBytes * 8; 3311 3312 // Add padding 3313 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 3314 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 3315 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | 3316 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) 3317 ); 3318 data.sigBytes = (dataWords.length + 1) * 4; 3319 3320 // Hash final blocks 3321 this._process(); 3322 3323 // Shortcuts 3324 var hash = this._hash; 3325 var H = hash.words; 3326 3327 // Swap endian 3328 for (var i = 0; i < 5; i++) { 3329 // Shortcut 3330 var H_i = H[i]; 3331 3332 // Swap 3333 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 3334 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 3335 } 3336 3337 // Return final computed hash 3338 return hash; 3339 }, 3340 3341 clone: function () { 3342 var clone = Hasher.clone.call(this); 3343 clone._hash = this._hash.clone(); 3344 3345 return clone; 3346 } 3347 }); 3348 3349 3350 function f1(x, y, z) { 3351 return ((x) ^ (y) ^ (z)); 3352 3353 } 3354 3355 function f2(x, y, z) { 3356 return (((x)&(y)) | ((~x)&(z))); 3357 } 3358 3359 function f3(x, y, z) { 3360 return (((x) | (~(y))) ^ (z)); 3361 } 3362 3363 function f4(x, y, z) { 3364 return (((x) & (z)) | ((y)&(~(z)))); 3365 } 3366 3367 function f5(x, y, z) { 3368 return ((x) ^ ((y) |(~(z)))); 3369 3370 } 3371 3372 function rotl(x,n) { 3373 return (x<<n) | (x>>>(32-n)); 3374 } 3375 3376 3377 /** 3378 * Shortcut function to the hasher's object interface. 3379 * 3380 * @param {WordArray|string} message The message to hash. 3381 * 3382 * @return {WordArray} The hash. 3383 * 3384 * @static 3385 * 3386 * @example 3387 * 3388 * var hash = CryptoJS.RIPEMD160('message'); 3389 * var hash = CryptoJS.RIPEMD160(wordArray); 3390 */ 3391 C.RIPEMD160 = Hasher._createHelper(RIPEMD160); 3392 3393 /** 3394 * Shortcut function to the HMAC's object interface. 3395 * 3396 * @param {WordArray|string} message The message to hash. 3397 * @param {WordArray|string} key The secret key. 3398 * 3399 * @return {WordArray} The HMAC. 3400 * 3401 * @static 3402 * 3403 * @example 3404 * 3405 * var hmac = CryptoJS.HmacRIPEMD160(message, key); 3406 */ 3407 C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); 3408 }()); 3409 3410 3411 return CryptoJS.RIPEMD160; 3412 3413 })); 3414 } (ripemd160$1)); 3415 return ripemd160$1.exports; 3416} 3417 3418var hmac$1 = {exports: {}}; 3419 3420var hmac = hmac$1.exports; 3421 3422var hasRequiredHmac; 3423 3424function requireHmac () { 3425 if (hasRequiredHmac) return hmac$1.exports; 3426 hasRequiredHmac = 1; 3427 (function (module, exports$1) { 3428(function (root, factory) { 3429 { 3430 // CommonJS 3431 module.exports = factory(requireCore()); 3432 } 3433 }(hmac, function (CryptoJS) { 3434 3435 (function () { 3436 // Shortcuts 3437 var C = CryptoJS; 3438 var C_lib = C.lib; 3439 var Base = C_lib.Base; 3440 var C_enc = C.enc; 3441 var Utf8 = C_enc.Utf8; 3442 var C_algo = C.algo; 3443 3444 /** 3445 * HMAC algorithm. 3446 */ 3447 C_algo.HMAC = Base.extend({ 3448 /** 3449 * Initializes a newly created HMAC. 3450 * 3451 * @param {Hasher} hasher The hash algorithm to use. 3452 * @param {WordArray|string} key The secret key. 3453 * 3454 * @example 3455 * 3456 * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); 3457 */ 3458 init: function (hasher, key) { 3459 // Init hasher 3460 hasher = this._hasher = new hasher.init(); 3461 3462 // Convert string to WordArray, else assume WordArray already 3463 if (typeof key == 'string') { 3464 key = Utf8.parse(key); 3465 } 3466 3467 // Shortcuts 3468 var hasherBlockSize = hasher.blockSize; 3469 var hasherBlockSizeBytes = hasherBlockSize * 4; 3470 3471 // Allow arbitrary length keys 3472 if (key.sigBytes > hasherBlockSizeBytes) { 3473 key = hasher.finalize(key); 3474 } 3475 3476 // Clamp excess bits 3477 key.clamp(); 3478 3479 // Clone key for inner and outer pads 3480 var oKey = this._oKey = key.clone(); 3481 var iKey = this._iKey = key.clone(); 3482 3483 // Shortcuts 3484 var oKeyWords = oKey.words; 3485 var iKeyWords = iKey.words; 3486 3487 // XOR keys with pad constants 3488 for (var i = 0; i < hasherBlockSize; i++) { 3489 oKeyWords[i] ^= 0x5c5c5c5c; 3490 iKeyWords[i] ^= 0x36363636; 3491 } 3492 oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; 3493 3494 // Set initial values 3495 this.reset(); 3496 }, 3497 3498 /** 3499 * Resets this HMAC to its initial state. 3500 * 3501 * @example 3502 * 3503 * hmacHasher.reset(); 3504 */ 3505 reset: function () { 3506 // Shortcut 3507 var hasher = this._hasher; 3508 3509 // Reset 3510 hasher.reset(); 3511 hasher.update(this._iKey); 3512 }, 3513 3514 /** 3515 * Updates this HMAC with a message. 3516 * 3517 * @param {WordArray|string} messageUpdate The message to append. 3518 * 3519 * @return {HMAC} This HMAC instance. 3520 * 3521 * @example 3522 * 3523 * hmacHasher.update('message'); 3524 * hmacHasher.update(wordArray); 3525 */ 3526 update: function (messageUpdate) { 3527 this._hasher.update(messageUpdate); 3528 3529 // Chainable 3530 return this; 3531 }, 3532 3533 /** 3534 * Finalizes the HMAC computation. 3535 * Note that the finalize operation is effectively a destructive, read-once operation. 3536 * 3537 * @param {WordArray|string} messageUpdate (Optional) A final message update. 3538 * 3539 * @return {WordArray} The HMAC. 3540 * 3541 * @example 3542 * 3543 * var hmac = hmacHasher.finalize(); 3544 * var hmac = hmacHasher.finalize('message'); 3545 * var hmac = hmacHasher.finalize(wordArray); 3546 */ 3547 finalize: function (messageUpdate) { 3548 // Shortcut 3549 var hasher = this._hasher; 3550 3551 // Compute HMAC 3552 var innerHash = hasher.finalize(messageUpdate); 3553 hasher.reset(); 3554 var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); 3555 3556 return hmac; 3557 } 3558 }); 3559 }()); 3560 3561 3562 })); 3563 } (hmac$1)); 3564 return hmac$1.exports; 3565} 3566 3567var pbkdf2$1 = {exports: {}}; 3568 3569var pbkdf2 = pbkdf2$1.exports; 3570 3571var hasRequiredPbkdf2; 3572 3573function requirePbkdf2 () {
3574 if (hasRequiredPbkdf2) return pbkdf2$1.exports; 3575 hasRequiredPbkdf2 = 1; 3576 (function (module, exports$1) { 3577(function (root, factory, undef) { 3578 { 3579 // CommonJS 3580 module.exports = factory(requireCore(), requireSha256(), requireHmac()); 3581 } 3582 }(pbkdf2, function (CryptoJS) { 3583 3584 (function () { 3585 // Shortcuts 3586 var C = CryptoJS; 3587 var C_lib = C.lib; 3588 var Base = C_lib.Base; 3589 var WordArray = C_lib.WordArray; 3590 var C_algo = C.algo; 3591 var SHA256 = C_algo.SHA256; 3592 var HMAC = C_algo.HMAC; 3593 3594 /** 3595 * Password-Based Key Derivation Function 2 algorithm. 3596 */ 3597 var PBKDF2 = C_algo.PBKDF2 = Base.extend({ 3598 /** 3599 * Configuration options. 3600 * 3601 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 3602 * @property {Hasher} hasher The hasher to use. Default: SHA256 3603 * @property {number} iterations The number of iterations to perform. Default: 250000 3604 */ 3605 cfg: Base.extend({ 3606 keySize: 128/32, 3607 hasher: SHA256, 3608 iterations: 250000 3609 }), 3610 3611 /** 3612 * Initializes a newly created key derivation function. 3613 * 3614 * @param {Object} cfg (Optional) The configuration options to use for the derivation. 3615 * 3616 * @example 3617 * 3618 * var kdf = CryptoJS.algo.PBKDF2.create(); 3619 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); 3620 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); 3621 */ 3622 init: function (cfg) { 3623 this.cfg = this.cfg.extend(cfg); 3624 }, 3625 3626 /** 3627 * Computes the Password-Based Key Derivation Function 2. 3628 * 3629 * @param {WordArray|string} password The password. 3630 * @param {WordArray|string} salt A salt. 3631 * 3632 * @return {WordArray} The derived key. 3633 * 3634 * @example 3635 * 3636 * var key = kdf.compute(password, salt); 3637 */ 3638 compute: function (password, salt) { 3639 // Shortcut 3640 var cfg = this.cfg; 3641 3642 // Init HMAC 3643 var hmac = HMAC.create(cfg.hasher, password); 3644 3645 // Initial values 3646 var derivedKey = WordArray.create(); 3647 var blockIndex = WordArray.create([0x00000001]); 3648 3649 // Shortcuts 3650 var derivedKeyWords = derivedKey.words; 3651 var blockIndexWords = blockIndex.words; 3652 var keySize = cfg.keySize; 3653 var iterations = cfg.iterations; 3654 3655 // Generate key 3656 while (derivedKeyWords.length < keySize) { 3657 var block = hmac.update(salt).finalize(blockIndex); 3658 hmac.reset(); 3659 3660 // Shortcuts 3661 var blockWords = block.words; 3662 var blockWordsLength = blockWords.length; 3663 3664 // Iterations 3665 var intermediate = block; 3666 for (var i = 1; i < iterations; i++) { 3667 intermediate = hmac.finalize(intermediate); 3668 hmac.reset(); 3669 3670 // Shortcut 3671 var intermediateWords = intermediate.words; 3672 3673 // XOR intermediate with block 3674 for (var j = 0; j < blockWordsLength; j++) { 3675 blockWords[j] ^= intermediateWords[j]; 3676 } 3677 } 3678 3679 derivedKey.concat(block); 3680 blockIndexWords[0]++; 3681 } 3682 derivedKey.sigBytes = keySize * 4; 3683 3684 return derivedKey; 3685 } 3686 }); 3687 3688 /** 3689 * Computes the Password-Based Key Derivation Function 2. 3690 * 3691 * @param {WordArray|string} password The password. 3692 * @param {WordArray|string} salt A salt. 3693 * @param {Object} cfg (Optional) The configuration options to use for this computation. 3694 * 3695 * @return {WordArray} The derived key. 3696 * 3697 * @static 3698 * 3699 * @example 3700 * 3701 * var key = CryptoJS.PBKDF2(password, salt); 3702 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); 3703 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); 3704 */ 3705 C.PBKDF2 = function (password, salt, cfg) { 3706 return PBKDF2.create(cfg).compute(password, salt); 3707 }; 3708 }()); 3709 3710 3711 return CryptoJS.PBKDF2; 3712 3713 })); 3714 } (pbkdf2$1));
vendor: 17,677 bytes, lines 3715-4275
3715 return pbkdf2$1.exports; 3716} 3717 3718var evpkdf$1 = {exports: {}}; 3719 3720var evpkdf = evpkdf$1.exports; 3721 3722var hasRequiredEvpkdf; 3723 3724function requireEvpkdf () { 3725 if (hasRequiredEvpkdf) return evpkdf$1.exports; 3726 hasRequiredEvpkdf = 1; 3727 (function (module, exports$1) { 3728(function (root, factory, undef) { 3729 { 3730 // CommonJS 3731 module.exports = factory(requireCore(), requireSha1(), requireHmac()); 3732 } 3733 }(evpkdf, function (CryptoJS) { 3734 3735 (function () { 3736 // Shortcuts 3737 var C = CryptoJS; 3738 var C_lib = C.lib; 3739 var Base = C_lib.Base; 3740 var WordArray = C_lib.WordArray; 3741 var C_algo = C.algo; 3742 var MD5 = C_algo.MD5; 3743 3744 /** 3745 * This key derivation function is meant to conform with EVP_BytesToKey. 3746 * www.openssl.org/docs/crypto/EVP_BytesToKey.html 3747 */ 3748 var EvpKDF = C_algo.EvpKDF = Base.extend({ 3749 /** 3750 * Configuration options. 3751 * 3752 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 3753 * @property {Hasher} hasher The hash algorithm to use. Default: MD5 3754 * @property {number} iterations The number of iterations to perform. Default: 1 3755 */ 3756 cfg: Base.extend({ 3757 keySize: 128/32, 3758 hasher: MD5, 3759 iterations: 1 3760 }), 3761 3762 /** 3763 * Initializes a newly created key derivation function. 3764 * 3765 * @param {Object} cfg (Optional) The configuration options to use for the derivation. 3766 * 3767 * @example 3768 * 3769 * var kdf = CryptoJS.algo.EvpKDF.create(); 3770 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); 3771 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); 3772 */ 3773 init: function (cfg) { 3774 this.cfg = this.cfg.extend(cfg); 3775 }, 3776 3777 /** 3778 * Derives a key from a password. 3779 * 3780 * @param {WordArray|string} password The password. 3781 * @param {WordArray|string} salt A salt. 3782 * 3783 * @return {WordArray} The derived key. 3784 * 3785 * @example 3786 * 3787 * var key = kdf.compute(password, salt); 3788 */ 3789 compute: function (password, salt) { 3790 var block; 3791 3792 // Shortcut 3793 var cfg = this.cfg; 3794 3795 // Init hasher 3796 var hasher = cfg.hasher.create(); 3797 3798 // Initial values 3799 var derivedKey = WordArray.create(); 3800 3801 // Shortcuts 3802 var derivedKeyWords = derivedKey.words; 3803 var keySize = cfg.keySize; 3804 var iterations = cfg.iterations; 3805 3806 // Generate key 3807 while (derivedKeyWords.length < keySize) { 3808 if (block) { 3809 hasher.update(block); 3810 } 3811 block = hasher.update(password).finalize(salt); 3812 hasher.reset(); 3813 3814 // Iterations 3815 for (var i = 1; i < iterations; i++) { 3816 block = hasher.finalize(block); 3817 hasher.reset(); 3818 } 3819 3820 derivedKey.concat(block); 3821 } 3822 derivedKey.sigBytes = keySize * 4; 3823 3824 return derivedKey; 3825 } 3826 }); 3827 3828 /** 3829 * Derives a key from a password. 3830 * 3831 * @param {WordArray|string} password The password. 3832 * @param {WordArray|string} salt A salt. 3833 * @param {Object} cfg (Optional) The configuration options to use for this computation. 3834 * 3835 * @return {WordArray} The derived key. 3836 * 3837 * @static 3838 * 3839 * @example 3840 * 3841 * var key = CryptoJS.EvpKDF(password, salt); 3842 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); 3843 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); 3844 */ 3845 C.EvpKDF = function (password, salt, cfg) { 3846 return EvpKDF.create(cfg).compute(password, salt); 3847 }; 3848 }()); 3849 3850 3851 return CryptoJS.EvpKDF; 3852 3853 })); 3854 } (evpkdf$1)); 3855 return evpkdf$1.exports; 3856} 3857 3858var cipherCore$1 = {exports: {}}; 3859 3860var cipherCore = cipherCore$1.exports; 3861 3862var hasRequiredCipherCore; 3863 3864function requireCipherCore () { 3865 if (hasRequiredCipherCore) return cipherCore$1.exports; 3866 hasRequiredCipherCore = 1; 3867 (function (module, exports$1) { 3868(function (root, factory, undef) { 3869 { 3870 // CommonJS 3871 module.exports = factory(requireCore(), requireEvpkdf()); 3872 } 3873 }(cipherCore, function (CryptoJS) { 3874 3875 /** 3876 * Cipher core components. 3877 */ 3878 CryptoJS.lib.Cipher || (function (undefined$1) { 3879 // Shortcuts 3880 var C = CryptoJS; 3881 var C_lib = C.lib; 3882 var Base = C_lib.Base; 3883 var WordArray = C_lib.WordArray; 3884 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; 3885 var C_enc = C.enc; 3886 C_enc.Utf8; 3887 var Base64 = C_enc.Base64; 3888 var C_algo = C.algo; 3889 var EvpKDF = C_algo.EvpKDF; 3890 3891 /** 3892 * Abstract base cipher template. 3893 * 3894 * @property {number} keySize This cipher's key size. Default: 4 (128 bits) 3895 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) 3896 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. 3897 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. 3898 */ 3899 var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ 3900 /** 3901 * Configuration options. 3902 * 3903 * @property {WordArray} iv The IV to use for this operation. 3904 */ 3905 cfg: Base.extend(), 3906 3907 /** 3908 * Creates this cipher in encryption mode. 3909 * 3910 * @param {WordArray} key The key. 3911 * @param {Object} cfg (Optional) The configuration options to use for this operation. 3912 * 3913 * @return {Cipher} A cipher instance. 3914 * 3915 * @static 3916 * 3917 * @example 3918 * 3919 * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); 3920 */ 3921 createEncryptor: function (key, cfg) { 3922 return this.create(this._ENC_XFORM_MODE, key, cfg); 3923 }, 3924 3925 /** 3926 * Creates this cipher in decryption mode. 3927 * 3928 * @param {WordArray} key The key. 3929 * @param {Object} cfg (Optional) The configuration options to use for this operation. 3930 * 3931 * @return {Cipher} A cipher instance. 3932 * 3933 * @static 3934 * 3935 * @example 3936 * 3937 * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); 3938 */ 3939 createDecryptor: function (key, cfg) { 3940 return this.create(this._DEC_XFORM_MODE, key, cfg); 3941 }, 3942 3943 /** 3944 * Initializes a newly created cipher. 3945 * 3946 * @param {number} xformMode Either the encryption or decryption transormation mode constant. 3947 * @param {WordArray} key The key. 3948 * @param {Object} cfg (Optional) The configuration options to use for this operation. 3949 * 3950 * @example 3951 * 3952 * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); 3953 */ 3954 init: function (xformMode, key, cfg) { 3955 // Apply config defaults 3956 this.cfg = this.cfg.extend(cfg); 3957 3958 // Store transform mode and key 3959 this._xformMode = xformMode; 3960 this._key = key; 3961 3962 // Set initial values 3963 this.reset(); 3964 }, 3965 3966 /** 3967 * Resets this cipher to its initial state. 3968 * 3969 * @example 3970 * 3971 * cipher.reset(); 3972 */ 3973 reset: function () { 3974 // Reset data buffer 3975 BufferedBlockAlgorithm.reset.call(this); 3976 3977 // Perform concrete-cipher logic 3978 this._doReset(); 3979 }, 3980 3981 /** 3982 * Adds data to be encrypted or decrypted. 3983 * 3984 * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. 3985 * 3986 * @return {WordArray} The data after processing. 3987 * 3988 * @example 3989 * 3990 * var encrypted = cipher.process('data'); 3991 * var encrypted = cipher.process(wordArray); 3992 */ 3993 process: function (dataUpdate) { 3994 // Append 3995 this._append(dataUpdate); 3996 3997 // Process available blocks 3998 return this._process(); 3999 }, 4000 4001 /** 4002 * Finalizes the encryption or decryption process. 4003 * Note that the finalize operation is effectively a destructive, read-once operation. 4004 * 4005 * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. 4006 * 4007 * @return {WordArray} The data after final processing. 4008 * 4009 * @example 4010 * 4011 * var encrypted = cipher.finalize(); 4012 * var encrypted = cipher.finalize('data'); 4013 * var encrypted = cipher.finalize(wordArray); 4014 */ 4015 finalize: function (dataUpdate) { 4016 // Final data update 4017 if (dataUpdate) { 4018 this._append(dataUpdate); 4019 } 4020 4021 // Perform concrete-cipher logic 4022 var finalProcessedData = this._doFinalize(); 4023 4024 return finalProcessedData; 4025 }, 4026 4027 keySize: 128/32, 4028 4029 ivSize: 128/32, 4030 4031 _ENC_XFORM_MODE: 1, 4032 4033 _DEC_XFORM_MODE: 2, 4034 4035 /** 4036 * Creates shortcut functions to a cipher's object interface. 4037 * 4038 * @param {Cipher} cipher The cipher to create a helper for. 4039 * 4040 * @return {Object} An object with encrypt and decrypt shortcut functions. 4041 * 4042 * @static 4043 * 4044 * @example 4045 * 4046 * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); 4047 */ 4048 _createHelper: (function () { 4049 function selectCipherStrategy(key) { 4050 if (typeof key == 'string') { 4051 return PasswordBasedCipher; 4052 } else { 4053 return SerializableCipher; 4054 } 4055 } 4056 4057 return function (cipher) { 4058 return { 4059 encrypt: function (message, key, cfg) { 4060 return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); 4061 }, 4062 4063 decrypt: function (ciphertext, key, cfg) { 4064 return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); 4065 } 4066 }; 4067 }; 4068 }()) 4069 }); 4070 4071 /** 4072 * Abstract base stream cipher template. 4073 * 4074 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) 4075 */ 4076 C_lib.StreamCipher = Cipher.extend({ 4077 _doFinalize: function () { 4078 // Process partial blocks 4079 var finalProcessedBlocks = this._process(true); 4080 4081 return finalProcessedBlocks; 4082 }, 4083 4084 blockSize: 1 4085 }); 4086 4087 /** 4088 * Mode namespace. 4089 */ 4090 var C_mode = C.mode = {}; 4091 4092 /** 4093 * Abstract base block cipher mode template. 4094 */ 4095 var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ 4096 /** 4097 * Creates this mode for encryption. 4098 * 4099 * @param {Cipher} cipher A block cipher instance. 4100 * @param {Array} iv The IV words. 4101 * 4102 * @static 4103 * 4104 * @example 4105 * 4106 * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); 4107 */ 4108 createEncryptor: function (cipher, iv) { 4109 return this.Encryptor.create(cipher, iv); 4110 }, 4111 4112 /** 4113 * Creates this mode for decryption. 4114 * 4115 * @param {Cipher} cipher A block cipher instance. 4116 * @param {Array} iv The IV words. 4117 * 4118 * @static 4119 * 4120 * @example 4121 * 4122 * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); 4123 */ 4124 createDecryptor: function (cipher, iv) { 4125 return this.Decryptor.create(cipher, iv); 4126 }, 4127 4128 /** 4129 * Initializes a newly created mode. 4130 * 4131 * @param {Cipher} cipher A block cipher instance. 4132 * @param {Array} iv The IV words. 4133 * 4134 * @example 4135 * 4136 * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); 4137 */ 4138 init: function (cipher, iv) { 4139 this._cipher = cipher; 4140 this._iv = iv; 4141 } 4142 }); 4143 4144 /** 4145 * Cipher Block Chaining mode. 4146 */ 4147 var CBC = C_mode.CBC = (function () { 4148 /** 4149 * Abstract base CBC mode. 4150 */ 4151 var CBC = BlockCipherMode.extend(); 4152 4153 /** 4154 * CBC encryptor. 4155 */ 4156 CBC.Encryptor = CBC.extend({ 4157 /** 4158 * Processes the data block at offset. 4159 * 4160 * @param {Array} words The data words to operate on. 4161 * @param {number} offset The offset where the block starts. 4162 * 4163 * @example 4164 * 4165 * mode.processBlock(data.words, offset); 4166 */ 4167 processBlock: function (words, offset) { 4168 // Shortcuts 4169 var cipher = this._cipher; 4170 var blockSize = cipher.blockSize; 4171 4172 // XOR and encrypt 4173 xorBlock.call(this, words, offset, blockSize); 4174 cipher.encryptBlock(words, offset); 4175 4176 // Remember this block to use with next block 4177 this._prevBlock = words.slice(offset, offset + blockSize); 4178 } 4179 }); 4180 4181 /** 4182 * CBC decryptor. 4183 */ 4184 CBC.Decryptor = CBC.extend({ 4185 /** 4186 * Processes the data block at offset. 4187 * 4188 * @param {Array} words The data words to operate on. 4189 * @param {number} offset The offset where the block starts. 4190 * 4191 * @example 4192 * 4193 * mode.processBlock(data.words, offset); 4194 */ 4195 processBlock: function (words, offset) { 4196 // Shortcuts 4197 var cipher = this._cipher; 4198 var blockSize = cipher.blockSize; 4199 4200 // Remember this block to use with next block 4201 var thisBlock = words.slice(offset, offset + blockSize); 4202 4203 // Decrypt and XOR 4204 cipher.decryptBlock(words, offset); 4205 xorBlock.call(this, words, offset, blockSize); 4206 4207 // This block becomes the previous block 4208 this._prevBlock = thisBlock; 4209 } 4210 }); 4211 4212 function xorBlock(words, offset, blockSize) { 4213 var block; 4214 4215 // Shortcut 4216 var iv = this._iv; 4217 4218 // Choose mixing block 4219 if (iv) { 4220 block = iv; 4221 4222 // Remove IV for subsequent blocks 4223 this._iv = undefined$1; 4224 } else { 4225 block = this._prevBlock; 4226 } 4227 4228 // XOR blocks 4229 for (var i = 0; i < blockSize; i++) { 4230 words[offset + i] ^= block[i]; 4231 } 4232 } 4233 4234 return CBC; 4235 }()); 4236 4237 /** 4238 * Padding namespace. 4239 */ 4240 var C_pad = C.pad = {}; 4241 4242 /** 4243 * PKCS #5/7 padding strategy. 4244 */ 4245 var Pkcs7 = C_pad.Pkcs7 = { 4246 /** 4247 * Pads data using the algorithm defined in PKCS #5/7. 4248 * 4249 * @param {WordArray} data The data to pad. 4250 * @param {number} blockSize The multiple that the data should be padded to. 4251 * 4252 * @static 4253 * 4254 * @example 4255 * 4256 * CryptoJS.pad.Pkcs7.pad(wordArray, 4); 4257 */ 4258 pad: function (data, blockSize) { 4259 // Shortcut 4260 var blockSizeBytes = blockSize * 4; 4261 4262 // Count padding bytes 4263 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 4264 4265 // Create padding word 4266 var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; 4267 4268 // Create padding 4269 var paddingWords = []; 4270 for (var i = 0; i < nPaddingBytes; i += 4) { 4271 paddingWords.push(paddingWord); 4272 } 4273 var padding = WordArray.create(paddingWords, nPaddingBytes); 4274 4275 // Add padding
vendor: 5,814 bytes, lines 4276-4439
4276 data.concat(padding); 4277 }, 4278 4279 /** 4280 * Unpads data that had been padded using the algorithm defined in PKCS #5/7. 4281 * 4282 * @param {WordArray} data The data to unpad. 4283 * 4284 * @static 4285 * 4286 * @example 4287 * 4288 * CryptoJS.pad.Pkcs7.unpad(wordArray); 4289 */ 4290 unpad: function (data) { 4291 // Get number of padding bytes from last byte 4292 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 4293 4294 // Remove padding 4295 data.sigBytes -= nPaddingBytes; 4296 } 4297 }; 4298 4299 /** 4300 * Abstract base block cipher template. 4301 * 4302 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) 4303 */ 4304 C_lib.BlockCipher = Cipher.extend({ 4305 /** 4306 * Configuration options. 4307 * 4308 * @property {Mode} mode The block mode to use. Default: CBC 4309 * @property {Padding} padding The padding strategy to use. Default: Pkcs7 4310 */ 4311 cfg: Cipher.cfg.extend({ 4312 mode: CBC, 4313 padding: Pkcs7 4314 }), 4315 4316 reset: function () { 4317 var modeCreator; 4318 4319 // Reset cipher 4320 Cipher.reset.call(this); 4321 4322 // Shortcuts 4323 var cfg = this.cfg; 4324 var iv = cfg.iv; 4325 var mode = cfg.mode; 4326 4327 // Reset block mode 4328 if (this._xformMode == this._ENC_XFORM_MODE) { 4329 modeCreator = mode.createEncryptor; 4330 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { 4331 modeCreator = mode.createDecryptor; 4332 // Keep at least one block in the buffer for unpadding 4333 this._minBufferSize = 1; 4334 } 4335 4336 if (this._mode && this._mode.__creator == modeCreator) { 4337 this._mode.init(this, iv && iv.words); 4338 } else { 4339 this._mode = modeCreator.call(mode, this, iv && iv.words); 4340 this._mode.__creator = modeCreator; 4341 } 4342 }, 4343 4344 _doProcessBlock: function (words, offset) { 4345 this._mode.processBlock(words, offset); 4346 }, 4347 4348 _doFinalize: function () { 4349 var finalProcessedBlocks; 4350 4351 // Shortcut 4352 var padding = this.cfg.padding; 4353 4354 // Finalize 4355 if (this._xformMode == this._ENC_XFORM_MODE) { 4356 // Pad data 4357 padding.pad(this._data, this.blockSize); 4358 4359 // Process final blocks 4360 finalProcessedBlocks = this._process(true); 4361 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { 4362 // Process final blocks 4363 finalProcessedBlocks = this._process(true); 4364 4365 // Unpad data 4366 padding.unpad(finalProcessedBlocks); 4367 } 4368 4369 return finalProcessedBlocks; 4370 }, 4371 4372 blockSize: 128/32 4373 }); 4374 4375 /** 4376 * A collection of cipher parameters. 4377 * 4378 * @property {WordArray} ciphertext The raw ciphertext. 4379 * @property {WordArray} key The key to this ciphertext. 4380 * @property {WordArray} iv The IV used in the ciphering operation. 4381 * @property {WordArray} salt The salt used with a key derivation function. 4382 * @property {Cipher} algorithm The cipher algorithm. 4383 * @property {Mode} mode The block mode used in the ciphering operation. 4384 * @property {Padding} padding The padding scheme used in the ciphering operation. 4385 * @property {number} blockSize The block size of the cipher. 4386 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. 4387 */ 4388 var CipherParams = C_lib.CipherParams = Base.extend({ 4389 /** 4390 * Initializes a newly created cipher params object. 4391 * 4392 * @param {Object} cipherParams An object with any of the possible cipher parameters. 4393 * 4394 * @example 4395 * 4396 * var cipherParams = CryptoJS.lib.CipherParams.create({ 4397 * ciphertext: ciphertextWordArray, 4398 * key: keyWordArray, 4399 * iv: ivWordArray, 4400 * salt: saltWordArray, 4401 * algorithm: CryptoJS.algo.AES, 4402 * mode: CryptoJS.mode.CBC, 4403 * padding: CryptoJS.pad.PKCS7, 4404 * blockSize: 4, 4405 * formatter: CryptoJS.format.OpenSSL 4406 * }); 4407 */ 4408 init: function (cipherParams) { 4409 this.mixIn(cipherParams); 4410 }, 4411 4412 /** 4413 * Converts this cipher params object to a string. 4414 * 4415 * @param {Format} formatter (Optional) The formatting strategy to use. 4416 * 4417 * @return {string} The stringified cipher params. 4418 * 4419 * @throws Error If neither the formatter nor the default formatter is set. 4420 * 4421 * @example 4422 * 4423 * var string = cipherParams + ''; 4424 * var string = cipherParams.toString(); 4425 * var string = cipherParams.toString(CryptoJS.format.OpenSSL); 4426 */ 4427 toString: function (formatter) { 4428 return (formatter || this.formatter).stringify(this); 4429 } 4430 }); 4431 4432 /** 4433 * Format namespace. 4434 */ 4435 var C_format = C.format = {}; 4436 4437 /** 4438 * OpenSSL formatting strategy. 4439 */
vendor: 2,638 bytes, lines 4440-4516
4440 var OpenSSLFormatter = C_format.OpenSSL = { 4441 /** 4442 * Converts a cipher params object to an OpenSSL-compatible string. 4443 * 4444 * @param {CipherParams} cipherParams The cipher params object. 4445 * 4446 * @return {string} The OpenSSL-compatible string. 4447 * 4448 * @static 4449 * 4450 * @example 4451 * 4452 * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); 4453 */ 4454 stringify: function (cipherParams) { 4455 var wordArray; 4456 4457 // Shortcuts 4458 var ciphertext = cipherParams.ciphertext; 4459 var salt = cipherParams.salt; 4460 4461 // Format 4462 if (salt) { 4463 wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); 4464 } else { 4465 wordArray = ciphertext; 4466 } 4467 4468 return wordArray.toString(Base64); 4469 }, 4470 4471 /** 4472 * Converts an OpenSSL-compatible string to a cipher params object. 4473 * 4474 * @param {string} openSSLStr The OpenSSL-compatible string. 4475 * 4476 * @return {CipherParams} The cipher params object. 4477 * 4478 * @static 4479 * 4480 * @example 4481 * 4482 * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); 4483 */ 4484 parse: function (openSSLStr) { 4485 var salt; 4486 4487 // Parse base64 4488 var ciphertext = Base64.parse(openSSLStr); 4489 4490 // Shortcut 4491 var ciphertextWords = ciphertext.words; 4492 4493 // Test for salt 4494 if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { 4495 // Extract salt 4496 salt = WordArray.create(ciphertextWords.slice(2, 4)); 4497 4498 // Remove salt from ciphertext 4499 ciphertextWords.splice(0, 4); 4500 ciphertext.sigBytes -= 16; 4501 } 4502 4503 return CipherParams.create({ ciphertext: ciphertext, salt: salt }); 4504 } 4505 }; 4506 4507 /** 4508 * A cipher wrapper that returns ciphertext as a serializable cipher params object. 4509 */ 4510 var SerializableCipher = C_lib.SerializableCipher = Base.extend({ 4511 /** 4512 * Configuration options. 4513 * 4514 * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL 4515 */ 4516 cfg: Base.extend({
4517 format: OpenSSLFormatter 4518 }), 4519 4520 /** 4521 * Encrypts a message. 4522 * 4523 * @param {Cipher} cipher The cipher algorithm to use. 4524 * @param {WordArray|string} message The message to encrypt. 4525 * @param {WordArray} key The key. 4526 * @param {Object} cfg (Optional) The configuration options to use for this operation. 4527 * 4528 * @return {CipherParams} A cipher params object. 4529 * 4530 * @static 4531 * 4532 * @example 4533 * 4534 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); 4535 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); 4536 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 4537 */ 4538 encrypt: function (cipher, message, key, cfg) { 4539 // Apply config defaults 4540 cfg = this.cfg.extend(cfg); 4541 4542 // Encrypt 4543 var encryptor = cipher.createEncryptor(key, cfg); 4544 var ciphertext = encryptor.finalize(message); 4545 4546 // Shortcut 4547 var cipherCfg = encryptor.cfg; 4548 4549 // Create and return serializable cipher params 4550 return CipherParams.create({ 4551 ciphertext: ciphertext, 4552 key: key, 4553 iv: cipherCfg.iv, 4554 algorithm: cipher, 4555 mode: cipherCfg.mode, 4556 padding: cipherCfg.padding, 4557 blockSize: cipher.blockSize, 4558 formatter: cfg.format 4559 }); 4560 }, 4561 4562 /** 4563 * Decrypts serialized ciphertext. 4564 * 4565 * @param {Cipher} cipher The cipher algorithm to use. 4566 * @param {CipherParams|string} ciphertext The ciphertext to decrypt. 4567 * @param {WordArray} key The key. 4568 * @param {Object} cfg (Optional) The configuration options to use for this operation. 4569 * 4570 * @return {WordArray} The plaintext. 4571 * 4572 * @static 4573 * 4574 * @example 4575 * 4576 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 4577 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 4578 */ 4579 decrypt: function (cipher, ciphertext, key, cfg) { 4580 // Apply config defaults 4581 cfg = this.cfg.extend(cfg); 4582 4583 // Convert string to CipherParams 4584 ciphertext = this._parse(ciphertext, cfg.format); 4585 4586 // Decrypt 4587 var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); 4588 4589 return plaintext; 4590 }, 4591 4592 /** 4593 * Converts serialized ciphertext to CipherParams, 4594 * else assumed CipherParams already and returns ciphertext unchanged. 4595 * 4596 * @param {CipherParams|string} ciphertext The ciphertext. 4597 * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. 4598 * 4599 * @return {CipherParams} The unserialized ciphertext. 4600 * 4601 * @static 4602 * 4603 * @example 4604 * 4605 * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); 4606 */ 4607 _parse: function (ciphertext, format) { 4608 if (typeof ciphertext == 'string') { 4609 return format.parse(ciphertext, this); 4610 } else { 4611 return ciphertext; 4612 } 4613 } 4614 }); 4615 4616 /** 4617 * Key derivation function namespace. 4618 */
vendor: 15,599 bytes, lines 4619-5175
4619 var C_kdf = C.kdf = {}; 4620 4621 /** 4622 * OpenSSL key derivation function. 4623 */ 4624 var OpenSSLKdf = C_kdf.OpenSSL = { 4625 /** 4626 * Derives a key and IV from a password. 4627 * 4628 * @param {string} password The password to derive from. 4629 * @param {number} keySize The size in words of the key to generate. 4630 * @param {number} ivSize The size in words of the IV to generate. 4631 * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. 4632 * 4633 * @return {CipherParams} A cipher params object with the key, IV, and salt. 4634 * 4635 * @static 4636 * 4637 * @example 4638 * 4639 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); 4640 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); 4641 */ 4642 execute: function (password, keySize, ivSize, salt, hasher) { 4643 // Generate random salt 4644 if (!salt) { 4645 salt = WordArray.random(64/8); 4646 } 4647 4648 // Derive key and IV 4649 if (!hasher) { 4650 var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); 4651 } else { 4652 var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt); 4653 } 4654 4655 4656 // Separate key and IV 4657 var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); 4658 key.sigBytes = keySize * 4; 4659 4660 // Return params 4661 return CipherParams.create({ key: key, iv: iv, salt: salt }); 4662 } 4663 }; 4664 4665 /** 4666 * A serializable cipher wrapper that derives the key from a password, 4667 * and returns ciphertext as a serializable cipher params object. 4668 */ 4669 var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ 4670 /** 4671 * Configuration options. 4672 * 4673 * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL 4674 */ 4675 cfg: SerializableCipher.cfg.extend({ 4676 kdf: OpenSSLKdf 4677 }), 4678 4679 /** 4680 * Encrypts a message using a password. 4681 * 4682 * @param {Cipher} cipher The cipher algorithm to use. 4683 * @param {WordArray|string} message The message to encrypt. 4684 * @param {string} password The password. 4685 * @param {Object} cfg (Optional) The configuration options to use for this operation. 4686 * 4687 * @return {CipherParams} A cipher params object. 4688 * 4689 * @static 4690 * 4691 * @example 4692 * 4693 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); 4694 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); 4695 */ 4696 encrypt: function (cipher, message, password, cfg) { 4697 // Apply config defaults 4698 cfg = this.cfg.extend(cfg); 4699 4700 // Derive key and other params 4701 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher); 4702 4703 // Add IV to config 4704 cfg.iv = derivedParams.iv; 4705 4706 // Encrypt 4707 var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); 4708 4709 // Mix in derived params 4710 ciphertext.mixIn(derivedParams); 4711 4712 return ciphertext; 4713 }, 4714 4715 /** 4716 * Decrypts serialized ciphertext using a password. 4717 * 4718 * @param {Cipher} cipher The cipher algorithm to use. 4719 * @param {CipherParams|string} ciphertext The ciphertext to decrypt. 4720 * @param {string} password The password. 4721 * @param {Object} cfg (Optional) The configuration options to use for this operation. 4722 * 4723 * @return {WordArray} The plaintext. 4724 * 4725 * @static 4726 * 4727 * @example 4728 * 4729 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); 4730 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); 4731 */ 4732 decrypt: function (cipher, ciphertext, password, cfg) { 4733 // Apply config defaults 4734 cfg = this.cfg.extend(cfg); 4735 4736 // Convert string to CipherParams 4737 ciphertext = this._parse(ciphertext, cfg.format); 4738 4739 // Derive key and other params 4740 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher); 4741 4742 // Add IV to config 4743 cfg.iv = derivedParams.iv; 4744 4745 // Decrypt 4746 var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); 4747 4748 return plaintext; 4749 } 4750 }); 4751 }()); 4752 4753 4754 })); 4755 } (cipherCore$1)); 4756 return cipherCore$1.exports; 4757} 4758 4759var modeCfb$1 = {exports: {}}; 4760 4761var modeCfb = modeCfb$1.exports; 4762 4763var hasRequiredModeCfb; 4764 4765function requireModeCfb () { 4766 if (hasRequiredModeCfb) return modeCfb$1.exports; 4767 hasRequiredModeCfb = 1; 4768 (function (module, exports$1) { 4769(function (root, factory, undef) { 4770 { 4771 // CommonJS 4772 module.exports = factory(requireCore(), requireCipherCore()); 4773 } 4774 }(modeCfb, function (CryptoJS) { 4775 4776 /** 4777 * Cipher Feedback block mode. 4778 */ 4779 CryptoJS.mode.CFB = (function () { 4780 var CFB = CryptoJS.lib.BlockCipherMode.extend(); 4781 4782 CFB.Encryptor = CFB.extend({ 4783 processBlock: function (words, offset) { 4784 // Shortcuts 4785 var cipher = this._cipher; 4786 var blockSize = cipher.blockSize; 4787 4788 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 4789 4790 // Remember this block to use with next block 4791 this._prevBlock = words.slice(offset, offset + blockSize); 4792 } 4793 }); 4794 4795 CFB.Decryptor = CFB.extend({ 4796 processBlock: function (words, offset) { 4797 // Shortcuts 4798 var cipher = this._cipher; 4799 var blockSize = cipher.blockSize; 4800 4801 // Remember this block to use with next block 4802 var thisBlock = words.slice(offset, offset + blockSize); 4803 4804 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 4805 4806 // This block becomes the previous block 4807 this._prevBlock = thisBlock; 4808 } 4809 }); 4810 4811 function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { 4812 var keystream; 4813 4814 // Shortcut 4815 var iv = this._iv; 4816 4817 // Generate keystream 4818 if (iv) { 4819 keystream = iv.slice(0); 4820 4821 // Remove IV for subsequent blocks 4822 this._iv = undefined; 4823 } else { 4824 keystream = this._prevBlock; 4825 } 4826 cipher.encryptBlock(keystream, 0); 4827 4828 // Encrypt 4829 for (var i = 0; i < blockSize; i++) { 4830 words[offset + i] ^= keystream[i]; 4831 } 4832 } 4833 4834 return CFB; 4835 }()); 4836 4837 4838 return CryptoJS.mode.CFB; 4839 4840 })); 4841 } (modeCfb$1)); 4842 return modeCfb$1.exports; 4843} 4844 4845var modeCtr$1 = {exports: {}}; 4846 4847var modeCtr = modeCtr$1.exports; 4848 4849var hasRequiredModeCtr; 4850 4851function requireModeCtr () { 4852 if (hasRequiredModeCtr) return modeCtr$1.exports; 4853 hasRequiredModeCtr = 1; 4854 (function (module, exports$1) { 4855(function (root, factory, undef) { 4856 { 4857 // CommonJS 4858 module.exports = factory(requireCore(), requireCipherCore()); 4859 } 4860 }(modeCtr, function (CryptoJS) { 4861 4862 /** 4863 * Counter block mode. 4864 */ 4865 CryptoJS.mode.CTR = (function () { 4866 var CTR = CryptoJS.lib.BlockCipherMode.extend(); 4867 4868 var Encryptor = CTR.Encryptor = CTR.extend({ 4869 processBlock: function (words, offset) { 4870 // Shortcuts 4871 var cipher = this._cipher; 4872 var blockSize = cipher.blockSize; 4873 var iv = this._iv; 4874 var counter = this._counter; 4875 4876 // Generate keystream 4877 if (iv) { 4878 counter = this._counter = iv.slice(0); 4879 4880 // Remove IV for subsequent blocks 4881 this._iv = undefined; 4882 } 4883 var keystream = counter.slice(0); 4884 cipher.encryptBlock(keystream, 0); 4885 4886 // Increment counter 4887 counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0; 4888 4889 // Encrypt 4890 for (var i = 0; i < blockSize; i++) { 4891 words[offset + i] ^= keystream[i]; 4892 } 4893 } 4894 }); 4895 4896 CTR.Decryptor = Encryptor; 4897 4898 return CTR; 4899 }()); 4900 4901 4902 return CryptoJS.mode.CTR; 4903 4904 })); 4905 } (modeCtr$1)); 4906 return modeCtr$1.exports; 4907} 4908 4909var modeCtrGladman$1 = {exports: {}}; 4910 4911var modeCtrGladman = modeCtrGladman$1.exports; 4912 4913var hasRequiredModeCtrGladman; 4914 4915function requireModeCtrGladman () { 4916 if (hasRequiredModeCtrGladman) return modeCtrGladman$1.exports; 4917 hasRequiredModeCtrGladman = 1; 4918 (function (module, exports$1) { 4919(function (root, factory, undef) { 4920 { 4921 // CommonJS 4922 module.exports = factory(requireCore(), requireCipherCore()); 4923 } 4924 }(modeCtrGladman, function (CryptoJS) { 4925 4926 /** @preserve 4927 * Counter block mode compatible with Dr Brian Gladman fileenc.c 4928 * derived from CryptoJS.mode.CTR 4929 * Jan Hruby [email protected] 4930 */ 4931 CryptoJS.mode.CTRGladman = (function () { 4932 var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); 4933 4934 function incWord(word) 4935 { 4936 if (((word >> 24) & 0xff) === 0xff) { //overflow 4937 var b1 = (word >> 16)&0xff; 4938 var b2 = (word >> 8)&0xff; 4939 var b3 = word & 0xff; 4940 4941 if (b1 === 0xff) // overflow b1 4942 { 4943 b1 = 0; 4944 if (b2 === 0xff) 4945 { 4946 b2 = 0; 4947 if (b3 === 0xff) 4948 { 4949 b3 = 0; 4950 } 4951 else 4952 { 4953 ++b3; 4954 } 4955 } 4956 else 4957 { 4958 ++b2; 4959 } 4960 } 4961 else 4962 { 4963 ++b1; 4964 } 4965 4966 word = 0; 4967 word += (b1 << 16); 4968 word += (b2 << 8); 4969 word += b3; 4970 } 4971 else 4972 { 4973 word += (0x01 << 24); 4974 } 4975 return word; 4976 } 4977 4978 function incCounter(counter) 4979 { 4980 if ((counter[0] = incWord(counter[0])) === 0) 4981 { 4982 // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 4983 counter[1] = incWord(counter[1]); 4984 } 4985 return counter; 4986 } 4987 4988 var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 4989 processBlock: function (words, offset) { 4990 // Shortcuts 4991 var cipher = this._cipher; 4992 var blockSize = cipher.blockSize; 4993 var iv = this._iv; 4994 var counter = this._counter; 4995 4996 // Generate keystream 4997 if (iv) { 4998 counter = this._counter = iv.slice(0); 4999 5000 // Remove IV for subsequent blocks 5001 this._iv = undefined; 5002 } 5003 5004 incCounter(counter); 5005 5006 var keystream = counter.slice(0); 5007 cipher.encryptBlock(keystream, 0); 5008 5009 // Encrypt 5010 for (var i = 0; i < blockSize; i++) { 5011 words[offset + i] ^= keystream[i]; 5012 } 5013 } 5014 }); 5015 5016 CTRGladman.Decryptor = Encryptor; 5017 5018 return CTRGladman; 5019 }()); 5020 5021 5022 5023 5024 return CryptoJS.mode.CTRGladman; 5025 5026 })); 5027 } (modeCtrGladman$1)); 5028 return modeCtrGladman$1.exports; 5029} 5030 5031var modeOfb$1 = {exports: {}}; 5032 5033var modeOfb = modeOfb$1.exports; 5034 5035var hasRequiredModeOfb; 5036 5037function requireModeOfb () { 5038 if (hasRequiredModeOfb) return modeOfb$1.exports; 5039 hasRequiredModeOfb = 1; 5040 (function (module, exports$1) { 5041(function (root, factory, undef) { 5042 { 5043 // CommonJS 5044 module.exports = factory(requireCore(), requireCipherCore()); 5045 } 5046 }(modeOfb, function (CryptoJS) { 5047 5048 /** 5049 * Output Feedback block mode. 5050 */ 5051 CryptoJS.mode.OFB = (function () { 5052 var OFB = CryptoJS.lib.BlockCipherMode.extend(); 5053 5054 var Encryptor = OFB.Encryptor = OFB.extend({ 5055 processBlock: function (words, offset) { 5056 // Shortcuts 5057 var cipher = this._cipher; 5058 var blockSize = cipher.blockSize; 5059 var iv = this._iv; 5060 var keystream = this._keystream; 5061 5062 // Generate keystream 5063 if (iv) { 5064 keystream = this._keystream = iv.slice(0); 5065 5066 // Remove IV for subsequent blocks 5067 this._iv = undefined; 5068 } 5069 cipher.encryptBlock(keystream, 0); 5070 5071 // Encrypt 5072 for (var i = 0; i < blockSize; i++) { 5073 words[offset + i] ^= keystream[i]; 5074 } 5075 } 5076 }); 5077 5078 OFB.Decryptor = Encryptor; 5079 5080 return OFB; 5081 }()); 5082 5083 5084 return CryptoJS.mode.OFB; 5085 5086 })); 5087 } (modeOfb$1)); 5088 return modeOfb$1.exports; 5089} 5090 5091var modeEcb$1 = {exports: {}}; 5092 5093var modeEcb = modeEcb$1.exports; 5094 5095var hasRequiredModeEcb; 5096 5097function requireModeEcb () { 5098 if (hasRequiredModeEcb) return modeEcb$1.exports; 5099 hasRequiredModeEcb = 1; 5100 (function (module, exports$1) { 5101(function (root, factory, undef) { 5102 { 5103 // CommonJS 5104 module.exports = factory(requireCore(), requireCipherCore()); 5105 } 5106 }(modeEcb, function (CryptoJS) { 5107 5108 /** 5109 * Electronic Codebook block mode. 5110 */ 5111 CryptoJS.mode.ECB = (function () { 5112 var ECB = CryptoJS.lib.BlockCipherMode.extend(); 5113 5114 ECB.Encryptor = ECB.extend({ 5115 processBlock: function (words, offset) { 5116 this._cipher.encryptBlock(words, offset); 5117 } 5118 }); 5119 5120 ECB.Decryptor = ECB.extend({ 5121 processBlock: function (words, offset) { 5122 this._cipher.decryptBlock(words, offset); 5123 } 5124 }); 5125 5126 return ECB; 5127 }()); 5128 5129 5130 return CryptoJS.mode.ECB; 5131 5132 })); 5133 } (modeEcb$1)); 5134 return modeEcb$1.exports; 5135} 5136 5137var padAnsix923$1 = {exports: {}}; 5138 5139var padAnsix923 = padAnsix923$1.exports; 5140 5141var hasRequiredPadAnsix923; 5142 5143function requirePadAnsix923 () { 5144 if (hasRequiredPadAnsix923) return padAnsix923$1.exports; 5145 hasRequiredPadAnsix923 = 1; 5146 (function (module, exports$1) { 5147(function (root, factory, undef) { 5148 { 5149 // CommonJS 5150 module.exports = factory(requireCore(), requireCipherCore()); 5151 } 5152 }(padAnsix923, function (CryptoJS) { 5153 5154 /** 5155 * ANSI X.923 padding strategy. 5156 */ 5157 CryptoJS.pad.AnsiX923 = { 5158 pad: function (data, blockSize) { 5159 // Shortcuts 5160 var dataSigBytes = data.sigBytes; 5161 var blockSizeBytes = blockSize * 4; 5162 5163 // Count padding bytes 5164 var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; 5165 5166 // Compute last byte position 5167 var lastBytePos = dataSigBytes + nPaddingBytes - 1; 5168 5169 // Pad 5170 data.clamp(); 5171 data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); 5172 data.sigBytes += nPaddingBytes; 5173 }, 5174 5175 unpad: function (data) {
5176 // Get number of padding bytes from last byte 5177 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 5178 5179 // Remove padding 5180 data.sigBytes -= nPaddingBytes; 5181 } 5182 }; 5183 5184 5185 return CryptoJS.pad.Ansix923; 5186 5187 })); 5188 } (padAnsix923$1)); 5189 return padAnsix923$1.exports; 5190} 5191 5192var padIso10126$1 = {exports: {}}; 5193 5194var padIso10126 = padIso10126$1.exports; 5195 5196var hasRequiredPadIso10126; 5197 5198function requirePadIso10126 () { 5199 if (hasRequiredPadIso10126) return padIso10126$1.exports; 5200 hasRequiredPadIso10126 = 1; 5201 (function (module, exports$1) { 5202(function (root, factory, undef) { 5203 { 5204 // CommonJS 5205 module.exports = factory(requireCore(), requireCipherCore()); 5206 } 5207 }(padIso10126, function (CryptoJS) { 5208 5209 /** 5210 * ISO 10126 padding strategy. 5211 */ 5212 CryptoJS.pad.Iso10126 = { 5213 pad: function (data, blockSize) { 5214 // Shortcut 5215 var blockSizeBytes = blockSize * 4; 5216 5217 // Count padding bytes 5218 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 5219 5220 // Pad 5221 data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). 5222 concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); 5223 }, 5224 5225 unpad: function (data) { 5226 // Get number of padding bytes from last byte 5227 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
5228 5229 // Remove padding 5230 data.sigBytes -= nPaddingBytes; 5231 } 5232 }; 5233 5234 5235 return CryptoJS.pad.Iso10126; 5236 5237 })); 5238 } (padIso10126$1)); 5239 return padIso10126$1.exports; 5240} 5241 5242var padIso97971$1 = {exports: {}}; 5243 5244var padIso97971 = padIso97971$1.exports; 5245 5246var hasRequiredPadIso97971; 5247 5248function requirePadIso97971 () { 5249 if (hasRequiredPadIso97971) return padIso97971$1.exports; 5250 hasRequiredPadIso97971 = 1; 5251 (function (module, exports$1) { 5252(function (root, factory, undef) { 5253 { 5254 // CommonJS 5255 module.exports = factory(requireCore(), requireCipherCore()); 5256 } 5257 }(padIso97971, function (CryptoJS) { 5258 5259 /** 5260 * ISO/IEC 9797-1 Padding Method 2. 5261 */ 5262 CryptoJS.pad.Iso97971 = { 5263 pad: function (data, blockSize) { 5264 // Add 0x80 byte 5265 data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); 5266 5267 // Zero pad the rest 5268 CryptoJS.pad.ZeroPadding.pad(data, blockSize); 5269 }, 5270 5271 unpad: function (data) { 5272 // Remove zero padding 5273 CryptoJS.pad.ZeroPadding.unpad(data); 5274 5275 // Remove one more byte -- the 0x80 byte 5276 data.sigBytes--; 5277 } 5278 }; 5279 5280 5281 return CryptoJS.pad.Iso97971; 5282 5283 })); 5284 } (padIso97971$1)); 5285 return padIso97971$1.exports; 5286} 5287 5288var padZeropadding$1 = {exports: {}}; 5289 5290var padZeropadding = padZeropadding$1.exports; 5291 5292var hasRequiredPadZeropadding; 5293 5294function requirePadZeropadding () { 5295 if (hasRequiredPadZeropadding) return padZeropadding$1.exports; 5296 hasRequiredPadZeropadding = 1; 5297 (function (module, exports$1) { 5298(function (root, factory, undef) { 5299 { 5300 // CommonJS 5301 module.exports = factory(requireCore(), requireCipherCore()); 5302 } 5303 }(padZeropadding, function (CryptoJS) { 5304 5305 /** 5306 * Zero padding strategy. 5307 */ 5308 CryptoJS.pad.ZeroPadding = { 5309 pad: function (data, blockSize) { 5310 // Shortcut 5311 var blockSizeBytes = blockSize * 4; 5312 5313 // Pad 5314 data.clamp(); 5315 data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); 5316 }, 5317 5318 unpad: function (data) { 5319 // Shortcut 5320 var dataWords = data.words; 5321 5322 // Unpad 5323 var i = data.sigBytes - 1; 5324 for (var i = data.sigBytes - 1; i >= 0; i--) { 5325 if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { 5326 data.sigBytes = i + 1; 5327 break; 5328 } 5329 } 5330 } 5331 }; 5332 5333 5334 return CryptoJS.pad.ZeroPadding; 5335 5336 })); 5337 } (padZeropadding$1)); 5338 return padZeropadding$1.exports; 5339} 5340 5341var padNopadding$1 = {exports: {}}; 5342 5343var padNopadding = padNopadding$1.exports; 5344 5345var hasRequiredPadNopadding; 5346 5347function requirePadNopadding () { 5348 if (hasRequiredPadNopadding) return padNopadding$1.exports; 5349 hasRequiredPadNopadding = 1; 5350 (function (module, exports$1) { 5351(function (root, factory, undef) { 5352 { 5353 // CommonJS 5354 module.exports = factory(requireCore(), requireCipherCore()); 5355 } 5356 }(padNopadding, function (CryptoJS) { 5357 5358 /** 5359 * A noop padding strategy. 5360 */ 5361 CryptoJS.pad.NoPadding = { 5362 pad: function () { 5363 }, 5364 5365 unpad: function () { 5366 } 5367 }; 5368 5369 5370 return CryptoJS.pad.NoPadding; 5371 5372 })); 5373 } (padNopadding$1)); 5374 return padNopadding$1.exports; 5375} 5376 5377var formatHex$1 = {exports: {}}; 5378 5379var formatHex = formatHex$1.exports; 5380 5381var hasRequiredFormatHex; 5382 5383function requireFormatHex () { 5384 if (hasRequiredFormatHex) return formatHex$1.exports; 5385 hasRequiredFormatHex = 1; 5386 (function (module, exports$1) { 5387(function (root, factory, undef) { 5388 { 5389 // CommonJS 5390 module.exports = factory(requireCore(), requireCipherCore()); 5391 } 5392 }(formatHex, function (CryptoJS) { 5393 5394 (function (undefined$1) { 5395 // Shortcuts 5396 var C = CryptoJS; 5397 var C_lib = C.lib; 5398 var CipherParams = C_lib.CipherParams; 5399 var C_enc = C.enc; 5400 var Hex = C_enc.Hex; 5401 var C_format = C.format; 5402 5403 C_format.Hex = { 5404 /** 5405 * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. 5406 * 5407 * @param {CipherParams} cipherParams The cipher params object. 5408 * 5409 * @return {string} The hexadecimally encoded string. 5410 * 5411 * @static 5412 * 5413 * @example 5414 * 5415 * var hexString = CryptoJS.format.Hex.stringify(cipherParams); 5416 */
5417 stringify: function (cipherParams) { 5418 return cipherParams.ciphertext.toString(Hex); 5419 }, 5420 5421 /** 5422 * Converts a hexadecimally encoded ciphertext string to a cipher params object. 5423 * 5424 * @param {string} input The hexadecimally encoded string. 5425 * 5426 * @return {CipherParams} The cipher params object. 5427 * 5428 * @static 5429 * 5430 * @example 5431 * 5432 * var cipherParams = CryptoJS.format.Hex.parse(hexString); 5433 */ 5434 parse: function (input) { 5435 var ciphertext = Hex.parse(input); 5436 return CipherParams.create({ ciphertext: ciphertext }); 5437 } 5438 }; 5439 }()); 5440 5441 5442 return CryptoJS.format.Hex; 5443 5444 })); 5445 } (formatHex$1)); 5446 return formatHex$1.exports; 5447} 5448 5449var aes$1 = {exports: {}}; 5450 5451var aes = aes$1.exports; 5452 5453var hasRequiredAes; 5454 5455function requireAes () { 5456 if (hasRequiredAes) return aes$1.exports; 5457 hasRequiredAes = 1; 5458 (function (module, exports$1) { 5459(function (root, factory, undef) { 5460 { 5461 // CommonJS 5462 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 5463 } 5464 }(aes, function (CryptoJS) { 5465 5466 (function () { 5467 // Shortcuts 5468 var C = CryptoJS; 5469 var C_lib = C.lib; 5470 var BlockCipher = C_lib.BlockCipher; 5471 var C_algo = C.algo; 5472 5473 // Lookup tables 5474 var SBOX = []; 5475 var INV_SBOX = []; 5476 var SUB_MIX_0 = []; 5477 var SUB_MIX_1 = []; 5478 var SUB_MIX_2 = []; 5479 var SUB_MIX_3 = []; 5480 var INV_SUB_MIX_0 = []; 5481 var INV_SUB_MIX_1 = []; 5482 var INV_SUB_MIX_2 = []; 5483 var INV_SUB_MIX_3 = []; 5484 5485 // Compute lookup tables 5486 (function () { 5487 // Compute double table 5488 var d = []; 5489 for (var i = 0; i < 256; i++) { 5490 if (i < 128) { 5491 d[i] = i << 1; 5492 } else { 5493 d[i] = (i << 1) ^ 0x11b; 5494 } 5495 } 5496 5497 // Walk GF(2^8) 5498 var x = 0; 5499 var xi = 0; 5500 for (var i = 0; i < 256; i++) { 5501 // Compute sbox 5502 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); 5503 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; 5504 SBOX[x] = sx; 5505 INV_SBOX[sx] = x; 5506 5507 // Compute multiplication 5508 var x2 = d[x]; 5509 var x4 = d[x2]; 5510 var x8 = d[x4]; 5511 5512 // Compute sub bytes, mix columns tables 5513 var t = (d[sx] * 0x101) ^ (sx * 0x1010100); 5514 SUB_MIX_0[x] = (t << 24) | (t >>> 8); 5515 SUB_MIX_1[x] = (t << 16) | (t >>> 16); 5516 SUB_MIX_2[x] = (t << 8) | (t >>> 24); 5517 SUB_MIX_3[x] = t; 5518 5519 // Compute inv sub bytes, inv mix columns tables 5520 var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); 5521 INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); 5522 INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); 5523 INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); 5524 INV_SUB_MIX_3[sx] = t; 5525 5526 // Compute next counter 5527 if (!x) { 5528 x = xi = 1; 5529 } else { 5530 x = x2 ^ d[d[d[x8 ^ x2]]]; 5531 xi ^= d[d[xi]]; 5532 } 5533 } 5534 }()); 5535 5536 // Precomputed Rcon lookup 5537 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; 5538 5539 /** 5540 * AES block cipher algorithm. 5541 */ 5542 var AES = C_algo.AES = BlockCipher.extend({ 5543 _doReset: function () { 5544 var t; 5545 5546 // Skip reset of nRounds has been set before and key did not change 5547 if (this._nRounds && this._keyPriorReset === this._key) { 5548 return; 5549 } 5550 5551 // Shortcuts 5552 var key = this._keyPriorReset = this._key; 5553 var keyWords = key.words; 5554 var keySize = key.sigBytes / 4; 5555 5556 // Compute number of rounds
vendor: 3,016 bytes, lines 5557-5627
5557 var nRounds = this._nRounds = keySize + 6; 5558 5559 // Compute number of key schedule rows 5560 var ksRows = (nRounds + 1) * 4; 5561 5562 // Compute key schedule 5563 var keySchedule = this._keySchedule = []; 5564 for (var ksRow = 0; ksRow < ksRows; ksRow++) { 5565 if (ksRow < keySize) { 5566 keySchedule[ksRow] = keyWords[ksRow]; 5567 } else { 5568 t = keySchedule[ksRow - 1]; 5569 5570 if (!(ksRow % keySize)) { 5571 // Rot word 5572 t = (t << 8) | (t >>> 24); 5573 5574 // Sub word 5575 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; 5576 5577 // Mix Rcon 5578 t ^= RCON[(ksRow / keySize) | 0] << 24; 5579 } else if (keySize > 6 && ksRow % keySize == 4) { 5580 // Sub word 5581 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; 5582 } 5583 5584 keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; 5585 } 5586 } 5587 5588 // Compute inv key schedule 5589 var invKeySchedule = this._invKeySchedule = []; 5590 for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { 5591 var ksRow = ksRows - invKsRow; 5592 5593 if (invKsRow % 4) { 5594 var t = keySchedule[ksRow]; 5595 } else { 5596 var t = keySchedule[ksRow - 4]; 5597 } 5598 5599 if (invKsRow < 4 || ksRow <= 4) { 5600 invKeySchedule[invKsRow] = t; 5601 } else { 5602 invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ 5603 INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; 5604 } 5605 } 5606 }, 5607 5608 encryptBlock: function (M, offset) { 5609 this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); 5610 }, 5611 5612 decryptBlock: function (M, offset) { 5613 // Swap 2nd and 4th rows 5614 var t = M[offset + 1]; 5615 M[offset + 1] = M[offset + 3]; 5616 M[offset + 3] = t; 5617 5618 this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); 5619 5620 // Inv swap 2nd and 4th rows 5621 var t = M[offset + 1]; 5622 M[offset + 1] = M[offset + 3]; 5623 M[offset + 3] = t; 5624 }, 5625 5626 _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { 5627 // Shortcut
5628 var nRounds = this._nRounds; 5629 5630 // Get input, add round key 5631 var s0 = M[offset] ^ keySchedule[0]; 5632 var s1 = M[offset + 1] ^ keySchedule[1]; 5633 var s2 = M[offset + 2] ^ keySchedule[2]; 5634 var s3 = M[offset + 3] ^ keySchedule[3]; 5635 5636 // Key schedule row counter 5637 var ksRow = 4; 5638 5639 // Rounds 5640 for (var round = 1; round < nRounds; round++) { 5641 // Shift rows, sub bytes, mix columns, add round key 5642 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++]; 5643 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++]; 5644 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++]; 5645 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++]; 5646 5647 // Update state 5648 s0 = t0; 5649 s1 = t1; 5650 s2 = t2; 5651 s3 = t3; 5652 } 5653 5654 // Shift rows, sub bytes, add round key 5655 var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; 5656 var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; 5657 var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; 5658 var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; 5659 5660 // Set output 5661 M[offset] = t0; 5662 M[offset + 1] = t1; 5663 M[offset + 2] = t2; 5664 M[offset + 3] = t3; 5665 }, 5666 5667 keySize: 256/32 5668 }); 5669 5670 /** 5671 * Shortcut functions to the cipher's object interface. 5672 * 5673 * @example 5674 * 5675 * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); 5676 * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); 5677 */ 5678 C.AES = BlockCipher._createHelper(AES); 5679 }()); 5680 5681 5682 return CryptoJS.AES; 5683 5684 })); 5685 } (aes$1)); 5686 return aes$1.exports; 5687} 5688 5689var tripledes$1 = {exports: {}}; 5690 5691var tripledes = tripledes$1.exports; 5692 5693var hasRequiredTripledes; 5694 5695function requireTripledes () { 5696 if (hasRequiredTripledes) return tripledes$1.exports; 5697 hasRequiredTripledes = 1; 5698 (function (module, exports$1) { 5699(function (root, factory, undef) { 5700 { 5701 // CommonJS 5702 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 5703 } 5704 }(tripledes, function (CryptoJS) { 5705 5706 (function () { 5707 // Shortcuts 5708 var C = CryptoJS; 5709 var C_lib = C.lib; 5710 var WordArray = C_lib.WordArray; 5711 var BlockCipher = C_lib.BlockCipher; 5712 var C_algo = C.algo; 5713 5714 // Permuted Choice 1 constants 5715 var PC1 = [ 5716 57, 49, 41, 33, 25, 17, 9, 1, 5717 58, 50, 42, 34, 26, 18, 10, 2, 5718 59, 51, 43, 35, 27, 19, 11, 3, 5719 60, 52, 44, 36, 63, 55, 47, 39, 5720 31, 23, 15, 7, 62, 54, 46, 38, 5721 30, 22, 14, 6, 61, 53, 45, 37, 5722 29, 21, 13, 5, 28, 20, 12, 4 5723 ]; 5724 5725 // Permuted Choice 2 constants 5726 var PC2 = [ 5727 14, 17, 11, 24, 1, 5, 5728 3, 28, 15, 6, 21, 10, 5729 23, 19, 12, 4, 26, 8, 5730 16, 7, 27, 20, 13, 2, 5731 41, 52, 31, 37, 47, 55, 5732 30, 40, 51, 45, 33, 48, 5733 44, 49, 39, 56, 34, 53, 5734 46, 42, 50, 36, 29, 32 5735 ]; 5736 5737 // Cumulative bit shift constants
5738 var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; 5739 5740 // SBOXes and round permutation constants 5741 var SBOX_P = [ 5742 { 5743 0x0: 0x808200, 5744 0x10000000: 0x8000, 5745 0x20000000: 0x808002, 5746 0x30000000: 0x2, 5747 0x40000000: 0x200, 5748 0x50000000: 0x808202, 5749 0x60000000: 0x800202, 5750 0x70000000: 0x800000, 5751 0x80000000: 0x202, 5752 0x90000000: 0x800200, 5753 0xa0000000: 0x8200, 5754 0xb0000000: 0x808000, 5755 0xc0000000: 0x8002, 5756 0xd0000000: 0x800002, 5757 0xe0000000: 0x0, 5758 0xf0000000: 0x8202, 5759 0x8000000: 0x0, 5760 0x18000000: 0x808202, 5761 0x28000000: 0x8202, 5762 0x38000000: 0x8000, 5763 0x48000000: 0x808200, 5764 0x58000000: 0x200, 5765 0x68000000: 0x808002, 5766 0x78000000: 0x2, 5767 0x88000000: 0x800200, 5768 0x98000000: 0x8200, 5769 0xa8000000: 0x808000, 5770 0xb8000000: 0x800202, 5771 0xc8000000: 0x800002, 5772 0xd8000000: 0x8002, 5773 0xe8000000: 0x202, 5774 0xf8000000: 0x800000, 5775 0x1: 0x8000, 5776 0x10000001: 0x2, 5777 0x20000001: 0x808200, 5778 0x30000001: 0x800000, 5779 0x40000001: 0x808002, 5780 0x50000001: 0x8200, 5781 0x60000001: 0x200, 5782 0x70000001: 0x800202, 5783 0x80000001: 0x808202, 5784 0x90000001: 0x808000, 5785 0xa0000001: 0x800002, 5786 0xb0000001: 0x8202, 5787 0xc0000001: 0x202, 5788 0xd0000001: 0x800200, 5789 0xe0000001: 0x8002, 5790 0xf0000001: 0x0, 5791 0x8000001: 0x808202, 5792 0x18000001: 0x808000, 5793 0x28000001: 0x800000, 5794 0x38000001: 0x200, 5795 0x48000001: 0x8000, 5796 0x58000001: 0x800002, 5797 0x68000001: 0x2, 5798 0x78000001: 0x8202, 5799 0x88000001: 0x8002, 5800 0x98000001: 0x800202, 5801 0xa8000001: 0x202, 5802 0xb8000001: 0x808200, 5803 0xc8000001: 0x800200, 5804 0xd8000001: 0x0, 5805 0xe8000001: 0x8200, 5806 0xf8000001: 0x808002 5807 }, 5808 { 5809 0x0: 0x40084010, 5810 0x1000000: 0x4000, 5811 0x2000000: 0x80000, 5812 0x3000000: 0x40080010, 5813 0x4000000: 0x40000010, 5814 0x5000000: 0x40084000, 5815 0x6000000: 0x40004000, 5816 0x7000000: 0x10, 5817 0x8000000: 0x84000, 5818 0x9000000: 0x40004010, 5819 0xa000000: 0x40000000, 5820 0xb000000: 0x84010, 5821 0xc000000: 0x80010, 5822 0xd000000: 0x0, 5823 0xe000000: 0x4010, 5824 0xf000000: 0x40080000, 5825 0x800000: 0x40004000, 5826 0x1800000: 0x84010, 5827 0x2800000: 0x10, 5828 0x3800000: 0x40004010, 5829 0x4800000: 0x40084010, 5830 0x5800000: 0x40000000, 5831 0x6800000: 0x80000, 5832 0x7800000: 0x40080010, 5833 0x8800000: 0x80010, 5834 0x9800000: 0x0, 5835 0xa800000: 0x4000, 5836 0xb800000: 0x40080000, 5837 0xc800000: 0x40000010, 5838 0xd800000: 0x84000, 5839 0xe800000: 0x40084000, 5840 0xf800000: 0x4010, 5841 0x10000000: 0x0, 5842 0x11000000: 0x40080010, 5843 0x12000000: 0x40004010, 5844 0x13000000: 0x40084000, 5845 0x14000000: 0x40080000, 5846 0x15000000: 0x10, 5847 0x16000000: 0x84010, 5848 0x17000000: 0x4000, 5849 0x18000000: 0x4010, 5850 0x19000000: 0x80000, 5851 0x1a000000: 0x80010, 5852 0x1b000000: 0x40000010, 5853 0x1c000000: 0x84000, 5854 0x1d000000: 0x40004000, 5855 0x1e000000: 0x40000000, 5856 0x1f000000: 0x40084010, 5857 0x10800000: 0x84010, 5858 0x11800000: 0x80000, 5859 0x12800000: 0x40080000, 5860 0x13800000: 0x4000, 5861 0x14800000: 0x40004000, 5862 0x15800000: 0x40084010, 5863 0x16800000: 0x10, 5864 0x17800000: 0x40000000, 5865 0x18800000: 0x40084000, 5866 0x19800000: 0x40000010, 5867 0x1a800000: 0x40004010, 5868 0x1b800000: 0x80010, 5869 0x1c800000: 0x0, 5870 0x1d800000: 0x4010, 5871 0x1e800000: 0x40080010, 5872 0x1f800000: 0x84000 5873 }, 5874 { 5875 0x0: 0x104, 5876 0x100000: 0x0, 5877 0x200000: 0x4000100, 5878 0x300000: 0x10104, 5879 0x400000: 0x10004, 5880 0x500000: 0x4000004, 5881 0x600000: 0x4010104, 5882 0x700000: 0x4010000, 5883 0x800000: 0x4000000, 5884 0x900000: 0x4010100, 5885 0xa00000: 0x10100, 5886 0xb00000: 0x4010004, 5887 0xc00000: 0x4000104, 5888 0xd00000: 0x10000, 5889 0xe00000: 0x4, 5890 0xf00000: 0x100, 5891 0x80000: 0x4010100, 5892 0x180000: 0x4010004, 5893 0x280000: 0x0, 5894 0x380000: 0x4000100, 5895 0x480000: 0x4000004, 5896 0x580000: 0x10000, 5897 0x680000: 0x10004, 5898 0x780000: 0x104, 5899 0x880000: 0x4, 5900 0x980000: 0x100, 5901 0xa80000: 0x4010000, 5902 0xb80000: 0x10104, 5903 0xc80000: 0x10100, 5904 0xd80000: 0x4000104, 5905 0xe80000: 0x4010104, 5906 0xf80000: 0x4000000, 5907 0x1000000: 0x4010100, 5908 0x1100000: 0x10004, 5909 0x1200000: 0x10000, 5910 0x1300000: 0x4000100, 5911 0x1400000: 0x100, 5912 0x1500000: 0x4010104, 5913 0x1600000: 0x4000004, 5914 0x1700000: 0x0, 5915 0x1800000: 0x4000104, 5916 0x1900000: 0x4000000, 5917 0x1a00000: 0x4, 5918 0x1b00000: 0x10100, 5919 0x1c00000: 0x4010000, 5920 0x1d00000: 0x104, 5921 0x1e00000: 0x10104, 5922 0x1f00000: 0x4010004, 5923 0x1080000: 0x4000000, 5924 0x1180000: 0x104, 5925 0x1280000: 0x4010100, 5926 0x1380000: 0x0, 5927 0x1480000: 0x10004, 5928 0x1580000: 0x4000100, 5929 0x1680000: 0x100, 5930 0x1780000: 0x4010004, 5931 0x1880000: 0x10000, 5932 0x1980000: 0x4010104, 5933 0x1a80000: 0x10104, 5934 0x1b80000: 0x4000004, 5935 0x1c80000: 0x4000104, 5936 0x1d80000: 0x4010000, 5937 0x1e80000: 0x4, 5938 0x1f80000: 0x10100 5939 }, 5940 { 5941 0x0: 0x80401000, 5942 0x10000: 0x80001040, 5943 0x20000: 0x401040, 5944 0x30000: 0x80400000, 5945 0x40000: 0x0, 5946 0x50000: 0x401000, 5947 0x60000: 0x80000040, 5948 0x70000: 0x400040, 5949 0x80000: 0x80000000, 5950 0x90000: 0x400000, 5951 0xa0000: 0x40, 5952 0xb0000: 0x80001000, 5953 0xc0000: 0x80400040, 5954 0xd0000: 0x1040, 5955 0xe0000: 0x1000, 5956 0xf0000: 0x80401040, 5957 0x8000: 0x80001040, 5958 0x18000: 0x40, 5959 0x28000: 0x80400040, 5960 0x38000: 0x80001000, 5961 0x48000: 0x401000, 5962 0x58000: 0x80401040, 5963 0x68000: 0x0, 5964 0x78000: 0x80400000, 5965 0x88000: 0x1000, 5966 0x98000: 0x80401000, 5967 0xa8000: 0x400000, 5968 0xb8000: 0x1040, 5969 0xc8000: 0x80000000, 5970 0xd8000: 0x400040, 5971 0xe8000: 0x401040, 5972 0xf8000: 0x80000040, 5973 0x100000: 0x400040, 5974 0x110000: 0x401000, 5975 0x120000: 0x80000040, 5976 0x130000: 0x0, 5977 0x140000: 0x1040, 5978 0x150000: 0x80400040, 5979 0x160000: 0x80401000, 5980 0x170000: 0x80001040, 5981 0x180000: 0x80401040, 5982 0x190000: 0x80000000, 5983 0x1a0000: 0x80400000, 5984 0x1b0000: 0x401040, 5985 0x1c0000: 0x80001000, 5986 0x1d0000: 0x400000, 5987 0x1e0000: 0x40, 5988 0x1f0000: 0x1000, 5989 0x108000: 0x80400000, 5990 0x118000: 0x80401040, 5991 0x128000: 0x0, 5992 0x138000: 0x401000, 5993 0x148000: 0x400040, 5994 0x158000: 0x80000000, 5995 0x168000: 0x80001040, 5996 0x178000: 0x40, 5997 0x188000: 0x80000040, 5998 0x198000: 0x1000, 5999 0x1a8000: 0x80001000, 6000 0x1b8000: 0x80400040, 6001 0x1c8000: 0x1040, 6002 0x1d8000: 0x80401000, 6003 0x1e8000: 0x400000, 6004 0x1f8000: 0x401040 6005 }, 6006 { 6007 0x0: 0x80, 6008 0x1000: 0x1040000, 6009 0x2000: 0x40000, 6010 0x3000: 0x20000000, 6011 0x4000: 0x20040080, 6012 0x5000: 0x1000080, 6013 0x6000: 0x21000080, 6014 0x7000: 0x40080, 6015 0x8000: 0x1000000, 6016 0x9000: 0x20040000, 6017 0xa000: 0x20000080, 6018 0xb000: 0x21040080, 6019 0xc000: 0x21040000, 6020 0xd000: 0x0, 6021 0xe000: 0x1040080, 6022 0xf000: 0x21000000, 6023 0x800: 0x1040080, 6024 0x1800: 0x21000080, 6025 0x2800: 0x80, 6026 0x3800: 0x1040000, 6027 0x4800: 0x40000, 6028 0x5800: 0x20040080, 6029 0x6800: 0x21040000, 6030 0x7800: 0x20000000, 6031 0x8800: 0x20040000, 6032 0x9800: 0x0, 6033 0xa800: 0x21040080, 6034 0xb800: 0x1000080, 6035 0xc800: 0x20000080, 6036 0xd800: 0x21000000, 6037 0xe800: 0x1000000, 6038 0xf800: 0x40080, 6039 0x10000: 0x40000, 6040 0x11000: 0x80, 6041 0x12000: 0x20000000, 6042 0x13000: 0x21000080, 6043 0x14000: 0x1000080, 6044 0x15000: 0x21040000, 6045 0x16000: 0x20040080, 6046 0x17000: 0x1000000, 6047 0x18000: 0x21040080, 6048 0x19000: 0x21000000, 6049 0x1a000: 0x1040000, 6050 0x1b000: 0x20040000, 6051 0x1c000: 0x40080, 6052 0x1d000: 0x20000080, 6053 0x1e000: 0x0, 6054 0x1f000: 0x1040080, 6055 0x10800: 0x21000080, 6056 0x11800: 0x1000000, 6057 0x12800: 0x1040000, 6058 0x13800: 0x20040080, 6059 0x14800: 0x20000000, 6060 0x15800: 0x1040080, 6061 0x16800: 0x80, 6062 0x17800: 0x21040000, 6063 0x18800: 0x40080, 6064 0x19800: 0x21040080, 6065 0x1a800: 0x0, 6066 0x1b800: 0x21000000, 6067 0x1c800: 0x1000080, 6068 0x1d800: 0x40000, 6069 0x1e800: 0x20040000, 6070 0x1f800: 0x20000080 6071 }, 6072 { 6073 0x0: 0x10000008, 6074 0x100: 0x2000, 6075 0x200: 0x10200000, 6076 0x300: 0x10202008, 6077 0x400: 0x10002000, 6078 0x500: 0x200000, 6079 0x600: 0x200008, 6080 0x700: 0x10000000, 6081 0x800: 0x0, 6082 0x900: 0x10002008, 6083 0xa00: 0x202000, 6084 0xb00: 0x8, 6085 0xc00: 0x10200008, 6086 0xd00: 0x202008, 6087 0xe00: 0x2008, 6088 0xf00: 0x10202000, 6089 0x80: 0x10200000, 6090 0x180: 0x10202008, 6091 0x280: 0x8, 6092 0x380: 0x200000,
6093 0x480: 0x202008, 6094 0x580: 0x10000008, 6095 0x680: 0x10002000, 6096 0x780: 0x2008, 6097 0x880: 0x200008, 6098 0x980: 0x2000, 6099 0xa80: 0x10002008, 6100 0xb80: 0x10200008, 6101 0xc80: 0x0, 6102 0xd80: 0x10202000, 6103 0xe80: 0x202000, 6104 0xf80: 0x10000000, 6105 0x1000: 0x10002000, 6106 0x1100: 0x10200008, 6107 0x1200: 0x10202008, 6108 0x1300: 0x2008, 6109 0x1400: 0x200000, 6110 0x1500: 0x10000000, 6111 0x1600: 0x10000008, 6112 0x1700: 0x202000, 6113 0x1800: 0x202008, 6114 0x1900: 0x0, 6115 0x1a00: 0x8, 6116 0x1b00: 0x10200000, 6117 0x1c00: 0x2000, 6118 0x1d00: 0x10002008, 6119 0x1e00: 0x10202000, 6120 0x1f00: 0x200008, 6121 0x1080: 0x8, 6122 0x1180: 0x202000, 6123 0x1280: 0x200000, 6124 0x1380: 0x10000008, 6125 0x1480: 0x10002000, 6126 0x1580: 0x2008, 6127 0x1680: 0x10202008, 6128 0x1780: 0x10200000, 6129 0x1880: 0x10202000, 6130 0x1980: 0x10200008, 6131 0x1a80: 0x2000, 6132 0x1b80: 0x202008, 6133 0x1c80: 0x200008, 6134 0x1d80: 0x0, 6135 0x1e80: 0x10000000, 6136 0x1f80: 0x10002008 6137 }, 6138 { 6139 0x0: 0x100000, 6140 0x10: 0x2000401, 6141 0x20: 0x400, 6142 0x30: 0x100401, 6143 0x40: 0x2100401, 6144 0x50: 0x0, 6145 0x60: 0x1, 6146 0x70: 0x2100001, 6147 0x80: 0x2000400, 6148 0x90: 0x100001, 6149 0xa0: 0x2000001, 6150 0xb0: 0x2100400, 6151 0xc0: 0x2100000, 6152 0xd0: 0x401, 6153 0xe0: 0x100400, 6154 0xf0: 0x2000000, 6155 0x8: 0x2100001, 6156 0x18: 0x0, 6157 0x28: 0x2000401, 6158 0x38: 0x2100400, 6159 0x48: 0x100000, 6160 0x58: 0x2000001, 6161 0x68: 0x2000000, 6162 0x78: 0x401, 6163 0x88: 0x100401, 6164 0x98: 0x2000400, 6165 0xa8: 0x2100000, 6166 0xb8: 0x100001, 6167 0xc8: 0x400, 6168 0xd8: 0x2100401, 6169 0xe8: 0x1, 6170 0xf8: 0x100400, 6171 0x100: 0x2000000, 6172 0x110: 0x100000, 6173 0x120: 0x2000401, 6174 0x130: 0x2100001, 6175 0x140: 0x100001, 6176 0x150: 0x2000400, 6177 0x160: 0x2100400, 6178 0x170: 0x100401, 6179 0x180: 0x401, 6180 0x190: 0x2100401, 6181 0x1a0: 0x100400, 6182 0x1b0: 0x1, 6183 0x1c0: 0x0, 6184 0x1d0: 0x2100000, 6185 0x1e0: 0x2000001, 6186 0x1f0: 0x400, 6187 0x108: 0x100400, 6188 0x118: 0x2000401, 6189 0x128: 0x2100001, 6190 0x138: 0x1, 6191 0x148: 0x2000000, 6192 0x158: 0x100000, 6193 0x168: 0x401, 6194 0x178: 0x2100400, 6195 0x188: 0x2000001, 6196 0x198: 0x2100000, 6197 0x1a8: 0x0, 6198 0x1b8: 0x2100401, 6199 0x1c8: 0x100401, 6200 0x1d8: 0x400, 6201 0x1e8: 0x2000400, 6202 0x1f8: 0x100001 6203 }, 6204 { 6205 0x0: 0x8000820, 6206 0x1: 0x20000, 6207 0x2: 0x8000000, 6208 0x3: 0x20, 6209 0x4: 0x20020, 6210 0x5: 0x8020820, 6211 0x6: 0x8020800, 6212 0x7: 0x800, 6213 0x8: 0x8020000, 6214 0x9: 0x8000800, 6215 0xa: 0x20800, 6216 0xb: 0x8020020, 6217 0xc: 0x820, 6218 0xd: 0x0, 6219 0xe: 0x8000020, 6220 0xf: 0x20820, 6221 0x80000000: 0x800, 6222 0x80000001: 0x8020820, 6223 0x80000002: 0x8000820, 6224 0x80000003: 0x8000000, 6225 0x80000004: 0x8020000, 6226 0x80000005: 0x20800, 6227 0x80000006: 0x20820, 6228 0x80000007: 0x20, 6229 0x80000008: 0x8000020, 6230 0x80000009: 0x820, 6231 0x8000000a: 0x20020, 6232 0x8000000b: 0x8020800, 6233 0x8000000c: 0x0, 6234 0x8000000d: 0x8020020, 6235 0x8000000e: 0x8000800, 6236 0x8000000f: 0x20000, 6237 0x10: 0x20820, 6238 0x11: 0x8020800, 6239 0x12: 0x20, 6240 0x13: 0x800, 6241 0x14: 0x8000800, 6242 0x15: 0x8000020, 6243 0x16: 0x8020020, 6244 0x17: 0x20000, 6245 0x18: 0x0, 6246 0x19: 0x20020, 6247 0x1a: 0x8020000, 6248 0x1b: 0x8000820, 6249 0x1c: 0x8020820,
vendor: 5,542 bytes, lines 6250-6406
6250 0x1d: 0x20800, 6251 0x1e: 0x820, 6252 0x1f: 0x8000000, 6253 0x80000010: 0x20000, 6254 0x80000011: 0x800, 6255 0x80000012: 0x8020020, 6256 0x80000013: 0x20820, 6257 0x80000014: 0x20, 6258 0x80000015: 0x8020000, 6259 0x80000016: 0x8000000, 6260 0x80000017: 0x8000820, 6261 0x80000018: 0x8020820, 6262 0x80000019: 0x8000020, 6263 0x8000001a: 0x8000800, 6264 0x8000001b: 0x0, 6265 0x8000001c: 0x20800, 6266 0x8000001d: 0x820, 6267 0x8000001e: 0x20020, 6268 0x8000001f: 0x8020800 6269 } 6270 ]; 6271 6272 // Masks that select the SBOX input 6273 var SBOX_MASK = [ 6274 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 6275 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f 6276 ]; 6277 6278 /** 6279 * DES block cipher algorithm. 6280 */ 6281 var DES = C_algo.DES = BlockCipher.extend({ 6282 _doReset: function () { 6283 // Shortcuts 6284 var key = this._key; 6285 var keyWords = key.words; 6286 6287 // Select 56 bits according to PC1 6288 var keyBits = []; 6289 for (var i = 0; i < 56; i++) { 6290 var keyBitPos = PC1[i] - 1; 6291 keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; 6292 } 6293 6294 // Assemble 16 subkeys 6295 var subKeys = this._subKeys = []; 6296 for (var nSubKey = 0; nSubKey < 16; nSubKey++) { 6297 // Create subkey 6298 var subKey = subKeys[nSubKey] = []; 6299 6300 // Shortcut 6301 var bitShift = BIT_SHIFTS[nSubKey]; 6302 6303 // Select 48 bits according to PC2 6304 for (var i = 0; i < 24; i++) { 6305 // Select from the left 28 key bits 6306 subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); 6307 6308 // Select from the right 28 key bits 6309 subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); 6310 } 6311 6312 // Since each subkey is applied to an expanded 32-bit input, 6313 // the subkey can be broken into 8 values scaled to 32-bits, 6314 // which allows the key to be used without expansion 6315 subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); 6316 for (var i = 1; i < 7; i++) { 6317 subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); 6318 } 6319 subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); 6320 } 6321 6322 // Compute inverse subkeys 6323 var invSubKeys = this._invSubKeys = []; 6324 for (var i = 0; i < 16; i++) { 6325 invSubKeys[i] = subKeys[15 - i]; 6326 } 6327 }, 6328 6329 encryptBlock: function (M, offset) { 6330 this._doCryptBlock(M, offset, this._subKeys); 6331 }, 6332 6333 decryptBlock: function (M, offset) { 6334 this._doCryptBlock(M, offset, this._invSubKeys); 6335 }, 6336 6337 _doCryptBlock: function (M, offset, subKeys) { 6338 // Get input 6339 this._lBlock = M[offset]; 6340 this._rBlock = M[offset + 1]; 6341 6342 // Initial permutation 6343 exchangeLR.call(this, 4, 0x0f0f0f0f); 6344 exchangeLR.call(this, 16, 0x0000ffff); 6345 exchangeRL.call(this, 2, 0x33333333); 6346 exchangeRL.call(this, 8, 0x00ff00ff); 6347 exchangeLR.call(this, 1, 0x55555555); 6348 6349 // Rounds 6350 for (var round = 0; round < 16; round++) { 6351 // Shortcuts 6352 var subKey = subKeys[round]; 6353 var lBlock = this._lBlock; 6354 var rBlock = this._rBlock; 6355 6356 // Feistel function 6357 var f = 0; 6358 for (var i = 0; i < 8; i++) { 6359 f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; 6360 } 6361 this._lBlock = rBlock; 6362 this._rBlock = lBlock ^ f; 6363 } 6364 6365 // Undo swap from last round 6366 var t = this._lBlock; 6367 this._lBlock = this._rBlock; 6368 this._rBlock = t; 6369 6370 // Final permutation 6371 exchangeLR.call(this, 1, 0x55555555); 6372 exchangeRL.call(this, 8, 0x00ff00ff); 6373 exchangeRL.call(this, 2, 0x33333333); 6374 exchangeLR.call(this, 16, 0x0000ffff); 6375 exchangeLR.call(this, 4, 0x0f0f0f0f); 6376 6377 // Set output 6378 M[offset] = this._lBlock; 6379 M[offset + 1] = this._rBlock; 6380 }, 6381 6382 keySize: 64/32, 6383 6384 ivSize: 64/32, 6385 6386 blockSize: 64/32 6387 }); 6388 6389 // Swap bits across the left and right words 6390 function exchangeLR(offset, mask) { 6391 var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; 6392 this._rBlock ^= t; 6393 this._lBlock ^= t << offset; 6394 } 6395 6396 function exchangeRL(offset, mask) { 6397 var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; 6398 this._lBlock ^= t; 6399 this._rBlock ^= t << offset; 6400 } 6401 6402 /** 6403 * Shortcut functions to the cipher's object interface. 6404 * 6405 * @example 6406 *
6407 * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); 6408 * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); 6409 */ 6410 C.DES = BlockCipher._createHelper(DES); 6411 6412 /** 6413 * Triple-DES block cipher algorithm. 6414 */ 6415 var TripleDES = C_algo.TripleDES = BlockCipher.extend({ 6416 _doReset: function () { 6417 // Shortcuts 6418 var key = this._key; 6419 var keyWords = key.words; 6420 // Make sure the key length is valid (64, 128 or >= 192 bit) 6421 if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { 6422 throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); 6423 } 6424 6425 // Extend the key according to the keying options defined in 3DES standard 6426 var key1 = keyWords.slice(0, 2); 6427 var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); 6428 var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); 6429 6430 // Create DES instances 6431 this._des1 = DES.createEncryptor(WordArray.create(key1)); 6432 this._des2 = DES.createEncryptor(WordArray.create(key2)); 6433 this._des3 = DES.createEncryptor(WordArray.create(key3)); 6434 }, 6435 6436 encryptBlock: function (M, offset) { 6437 this._des1.encryptBlock(M, offset); 6438 this._des2.decryptBlock(M, offset); 6439 this._des3.encryptBlock(M, offset); 6440 }, 6441 6442 decryptBlock: function (M, offset) { 6443 this._des3.decryptBlock(M, offset); 6444 this._des2.encryptBlock(M, offset); 6445 this._des1.decryptBlock(M, offset); 6446 }, 6447 6448 keySize: 192/32, 6449 6450 ivSize: 64/32, 6451 6452 blockSize: 64/32 6453 }); 6454 6455 /** 6456 * Shortcut functions to the cipher's object interface. 6457 * 6458 * @example 6459 * 6460 * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); 6461 * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); 6462 */ 6463 C.TripleDES = BlockCipher._createHelper(TripleDES); 6464 }()); 6465 6466 6467 return CryptoJS.TripleDES; 6468 6469 })); 6470 } (tripledes$1)); 6471 return tripledes$1.exports; 6472} 6473 6474var rc4$1 = {exports: {}}; 6475 6476var rc4 = rc4$1.exports; 6477 6478var hasRequiredRc4; 6479 6480function requireRc4 () { 6481 if (hasRequiredRc4) return rc4$1.exports; 6482 hasRequiredRc4 = 1; 6483 (function (module, exports$1) { 6484(function (root, factory, undef) { 6485 { 6486 // CommonJS 6487 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 6488 } 6489 }(rc4, function (CryptoJS) { 6490 6491 (function () { 6492 // Shortcuts 6493 var C = CryptoJS; 6494 var C_lib = C.lib; 6495 var StreamCipher = C_lib.StreamCipher; 6496 var C_algo = C.algo; 6497 6498 /** 6499 * RC4 stream cipher algorithm. 6500 */ 6501 var RC4 = C_algo.RC4 = StreamCipher.extend({ 6502 _doReset: function () { 6503 // Shortcuts 6504 var key = this._key; 6505 var keyWords = key.words; 6506 var keySigBytes = key.sigBytes; 6507 6508 // Init sbox 6509 var S = this._S = []; 6510 for (var i = 0; i < 256; i++) { 6511 S[i] = i; 6512 } 6513 6514 // Key setup 6515 for (var i = 0, j = 0; i < 256; i++) { 6516 var keyByteIndex = i % keySigBytes; 6517 var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; 6518 6519 j = (j + S[i] + keyByte) % 256; 6520 6521 // Swap 6522 var t = S[i]; 6523 S[i] = S[j]; 6524 S[j] = t; 6525 } 6526 6527 // Counters 6528 this._i = this._j = 0; 6529 }, 6530 6531 _doProcessBlock: function (M, offset) { 6532 M[offset] ^= generateKeystreamWord.call(this); 6533 }, 6534 6535 keySize: 256/32, 6536 6537 ivSize: 0 6538 }); 6539 6540 function generateKeystreamWord() { 6541 // Shortcuts 6542 var S = this._S; 6543 var i = this._i; 6544 var j = this._j; 6545 6546 // Generate keystream word 6547 var keystreamWord = 0; 6548 for (var n = 0; n < 4; n++) { 6549 i = (i + 1) % 256; 6550 j = (j + S[i]) % 256; 6551 6552 // Swap 6553 var t = S[i]; 6554 S[i] = S[j]; 6555 S[j] = t; 6556 6557 keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); 6558 } 6559 6560 // Update counters 6561 this._i = i; 6562 this._j = j; 6563 6564 return keystreamWord; 6565 } 6566 6567 /** 6568 * Shortcut functions to the cipher's object interface. 6569 * 6570 * @example 6571 * 6572 * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); 6573 * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); 6574 */ 6575 C.RC4 = StreamCipher._createHelper(RC4); 6576 6577 /** 6578 * Modified RC4 stream cipher algorithm. 6579 */ 6580 var RC4Drop = C_algo.RC4Drop = RC4.extend({ 6581 /** 6582 * Configuration options. 6583 * 6584 * @property {number} drop The number of keystream words to drop. Default 192 6585 */ 6586 cfg: RC4.cfg.extend({ 6587 drop: 192 6588 }), 6589 6590 _doReset: function () { 6591 RC4._doReset.call(this); 6592 6593 // Drop 6594 for (var i = this.cfg.drop; i > 0; i--) { 6595 generateKeystreamWord.call(this); 6596 } 6597 } 6598 }); 6599 6600 /** 6601 * Shortcut functions to the cipher's object interface. 6602 * 6603 * @example 6604 *
6605 * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); 6606 * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); 6607 */ 6608 C.RC4Drop = StreamCipher._createHelper(RC4Drop); 6609 }()); 6610 6611 6612 return CryptoJS.RC4; 6613 6614 })); 6615 } (rc4$1)); 6616 return rc4$1.exports; 6617} 6618 6619var rabbit$1 = {exports: {}}; 6620 6621var rabbit = rabbit$1.exports; 6622 6623var hasRequiredRabbit; 6624 6625function requireRabbit () { 6626 if (hasRequiredRabbit) return rabbit$1.exports; 6627 hasRequiredRabbit = 1; 6628 (function (module, exports$1) { 6629(function (root, factory, undef) { 6630 { 6631 // CommonJS 6632 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 6633 } 6634 }(rabbit, function (CryptoJS) { 6635 6636 (function () { 6637 // Shortcuts 6638 var C = CryptoJS; 6639 var C_lib = C.lib; 6640 var StreamCipher = C_lib.StreamCipher; 6641 var C_algo = C.algo; 6642 6643 // Reusable objects 6644 var S = []; 6645 var C_ = []; 6646 var G = []; 6647 6648 /** 6649 * Rabbit stream cipher algorithm 6650 */ 6651 var Rabbit = C_algo.Rabbit = StreamCipher.extend({ 6652 _doReset: function () { 6653 // Shortcuts 6654 var K = this._key.words; 6655 var iv = this.cfg.iv; 6656 6657 // Swap endian 6658 for (var i = 0; i < 4; i++) { 6659 K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | 6660 (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); 6661 } 6662 6663 // Generate initial state values 6664 var X = this._X = [ 6665 K[0], (K[3] << 16) | (K[2] >>> 16), 6666 K[1], (K[0] << 16) | (K[3] >>> 16), 6667 K[2], (K[1] << 16) | (K[0] >>> 16), 6668 K[3], (K[2] << 16) | (K[1] >>> 16) 6669 ]; 6670 6671 // Generate initial counter values 6672 var C = this._C = [ 6673 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), 6674 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), 6675 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), 6676 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) 6677 ]; 6678 6679 // Carry bit 6680 this._b = 0; 6681 6682 // Iterate the system four times 6683 for (var i = 0; i < 4; i++) { 6684 nextState.call(this); 6685 } 6686 6687 // Modify the counters 6688 for (var i = 0; i < 8; i++) { 6689 C[i] ^= X[(i + 4) & 7]; 6690 } 6691 6692 // IV setup 6693 if (iv) { 6694 // Shortcuts 6695 var IV = iv.words; 6696 var IV_0 = IV[0]; 6697 var IV_1 = IV[1]; 6698 6699 // Generate four subvectors 6700 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); 6701 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); 6702 var i1 = (i0 >>> 16) | (i2 & 0xffff0000); 6703 var i3 = (i2 << 16) | (i0 & 0x0000ffff); 6704 6705 // Modify counter values 6706 C[0] ^= i0; 6707 C[1] ^= i1; 6708 C[2] ^= i2; 6709 C[3] ^= i3; 6710 C[4] ^= i0; 6711 C[5] ^= i1; 6712 C[6] ^= i2; 6713 C[7] ^= i3; 6714 6715 // Iterate the system four times 6716 for (var i = 0; i < 4; i++) { 6717 nextState.call(this); 6718 } 6719 } 6720 }, 6721 6722 _doProcessBlock: function (M, offset) { 6723 // Shortcut 6724 var X = this._X; 6725 6726 // Iterate the system 6727 nextState.call(this); 6728 6729 // Generate four keystream words 6730 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); 6731 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); 6732 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); 6733 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); 6734 6735 for (var i = 0; i < 4; i++) { 6736 // Swap endian 6737 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | 6738 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); 6739 6740 // Encrypt 6741 M[offset + i] ^= S[i]; 6742 } 6743 }, 6744 6745 blockSize: 128/32, 6746 6747 ivSize: 64/32 6748 }); 6749 6750 function nextState() { 6751 // Shortcuts 6752 var X = this._X; 6753 var C = this._C; 6754 6755 // Save old counter values 6756 for (var i = 0; i < 8; i++) { 6757 C_[i] = C[i]; 6758 } 6759 6760 // Calculate new counter values
6761 C[0] = (C[0] + 0x4d34d34d + this._b) | 0; 6762 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; 6763 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; 6764 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; 6765 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; 6766 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; 6767 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; 6768 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; 6769 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; 6770 6771 // Calculate the g-values 6772 for (var i = 0; i < 8; i++) { 6773 var gx = X[i] + C[i]; 6774 6775 // Construct high and low argument for squaring 6776 var ga = gx & 0xffff; 6777 var gb = gx >>> 16; 6778 6779 // Calculate high and low result of squaring 6780 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; 6781 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); 6782 6783 // High XOR low 6784 G[i] = gh ^ gl; 6785 } 6786 6787 // Calculate new state values 6788 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; 6789 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; 6790 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; 6791 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; 6792 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; 6793 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; 6794 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; 6795 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; 6796 } 6797 6798 /** 6799 * Shortcut functions to the cipher's object interface. 6800 * 6801 * @example 6802 * 6803 * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); 6804 * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); 6805 */ 6806 C.Rabbit = StreamCipher._createHelper(Rabbit); 6807 }()); 6808 6809 6810 return CryptoJS.Rabbit; 6811 6812 })); 6813 } (rabbit$1)); 6814 return rabbit$1.exports; 6815} 6816 6817var rabbitLegacy$1 = {exports: {}}; 6818 6819var rabbitLegacy = rabbitLegacy$1.exports; 6820 6821var hasRequiredRabbitLegacy; 6822 6823function requireRabbitLegacy () { 6824 if (hasRequiredRabbitLegacy) return rabbitLegacy$1.exports; 6825 hasRequiredRabbitLegacy = 1; 6826 (function (module, exports$1) { 6827(function (root, factory, undef) { 6828 { 6829 // CommonJS 6830 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 6831 } 6832 }(rabbitLegacy, function (CryptoJS) { 6833 6834 (function () { 6835 // Shortcuts 6836 var C = CryptoJS; 6837 var C_lib = C.lib; 6838 var StreamCipher = C_lib.StreamCipher; 6839 var C_algo = C.algo; 6840 6841 // Reusable objects 6842 var S = []; 6843 var C_ = []; 6844 var G = []; 6845 6846 /** 6847 * Rabbit stream cipher algorithm. 6848 * 6849 * This is a legacy version that neglected to convert the key to little-endian. 6850 * This error doesn't affect the cipher's security, 6851 * but it does affect its compatibility with other implementations. 6852 */ 6853 var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ 6854 _doReset: function () { 6855 // Shortcuts 6856 var K = this._key.words; 6857 var iv = this.cfg.iv; 6858 6859 // Generate initial state values 6860 var X = this._X = [ 6861 K[0], (K[3] << 16) | (K[2] >>> 16), 6862 K[1], (K[0] << 16) | (K[3] >>> 16), 6863 K[2], (K[1] << 16) | (K[0] >>> 16), 6864 K[3], (K[2] << 16) | (K[1] >>> 16) 6865 ]; 6866 6867 // Generate initial counter values 6868 var C = this._C = [ 6869 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), 6870 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), 6871 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), 6872 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) 6873 ]; 6874 6875 // Carry bit 6876 this._b = 0; 6877 6878 // Iterate the system four times 6879 for (var i = 0; i < 4; i++) { 6880 nextState.call(this); 6881 } 6882 6883 // Modify the counters 6884 for (var i = 0; i < 8; i++) {
vendor: 4,390 bytes, lines 6885-6998
6885 C[i] ^= X[(i + 4) & 7]; 6886 } 6887 6888 // IV setup 6889 if (iv) { 6890 // Shortcuts 6891 var IV = iv.words; 6892 var IV_0 = IV[0]; 6893 var IV_1 = IV[1]; 6894 6895 // Generate four subvectors 6896 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); 6897 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); 6898 var i1 = (i0 >>> 16) | (i2 & 0xffff0000); 6899 var i3 = (i2 << 16) | (i0 & 0x0000ffff); 6900 6901 // Modify counter values 6902 C[0] ^= i0; 6903 C[1] ^= i1; 6904 C[2] ^= i2; 6905 C[3] ^= i3; 6906 C[4] ^= i0; 6907 C[5] ^= i1; 6908 C[6] ^= i2; 6909 C[7] ^= i3; 6910 6911 // Iterate the system four times 6912 for (var i = 0; i < 4; i++) { 6913 nextState.call(this); 6914 } 6915 } 6916 }, 6917 6918 _doProcessBlock: function (M, offset) { 6919 // Shortcut 6920 var X = this._X; 6921 6922 // Iterate the system 6923 nextState.call(this); 6924 6925 // Generate four keystream words 6926 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); 6927 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); 6928 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); 6929 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); 6930 6931 for (var i = 0; i < 4; i++) { 6932 // Swap endian 6933 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | 6934 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); 6935 6936 // Encrypt 6937 M[offset + i] ^= S[i]; 6938 } 6939 }, 6940 6941 blockSize: 128/32, 6942 6943 ivSize: 64/32 6944 }); 6945 6946 function nextState() { 6947 // Shortcuts 6948 var X = this._X; 6949 var C = this._C; 6950 6951 // Save old counter values 6952 for (var i = 0; i < 8; i++) { 6953 C_[i] = C[i]; 6954 } 6955 6956 // Calculate new counter values 6957 C[0] = (C[0] + 0x4d34d34d + this._b) | 0; 6958 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; 6959 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; 6960 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; 6961 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; 6962 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; 6963 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; 6964 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; 6965 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; 6966 6967 // Calculate the g-values 6968 for (var i = 0; i < 8; i++) { 6969 var gx = X[i] + C[i]; 6970 6971 // Construct high and low argument for squaring 6972 var ga = gx & 0xffff; 6973 var gb = gx >>> 16; 6974 6975 // Calculate high and low result of squaring 6976 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; 6977 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); 6978 6979 // High XOR low 6980 G[i] = gh ^ gl; 6981 } 6982 6983 // Calculate new state values 6984 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; 6985 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; 6986 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; 6987 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; 6988 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; 6989 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; 6990 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; 6991 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; 6992 } 6993 6994 /** 6995 * Shortcut functions to the cipher's object interface. 6996 * 6997 * @example 6998 *
6999 * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); 7000 * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); 7001 */ 7002 C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); 7003 }()); 7004 7005 7006 return CryptoJS.RabbitLegacy; 7007 7008 })); 7009 } (rabbitLegacy$1)); 7010 return rabbitLegacy$1.exports; 7011} 7012 7013var blowfish$1 = {exports: {}}; 7014 7015var blowfish = blowfish$1.exports; 7016 7017var hasRequiredBlowfish; 7018 7019function requireBlowfish () { 7020 if (hasRequiredBlowfish) return blowfish$1.exports; 7021 hasRequiredBlowfish = 1; 7022 (function (module, exports$1) { 7023(function (root, factory, undef) { 7024 { 7025 // CommonJS 7026 module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore()); 7027 } 7028 }(blowfish, function (CryptoJS) { 7029 7030 (function () { 7031 // Shortcuts 7032 var C = CryptoJS; 7033 var C_lib = C.lib; 7034 var BlockCipher = C_lib.BlockCipher; 7035 var C_algo = C.algo; 7036 7037 const N = 16; 7038 7039 //Origin pbox and sbox, derived from PI 7040 const ORIG_P = [ 7041 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 7042 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, 7043 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 7044 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917, 7045 0x9216D5D9, 0x8979FB1B 7046 ]; 7047 7048 const ORIG_S = [ 7049 [ 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 7050 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99, 7051 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 7052 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E, 7053 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 7054 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013, 7055 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 7056 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E, 7057 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 7058 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440, 7059 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 7060 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A, 7061 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 7062 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677, 7063 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 7064 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032, 7065 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 7066 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239, 7067 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 7068 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0, 7069 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 7070 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98, 7071 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 7072 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE, 7073 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 7074 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D, 7075 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 7076 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7, 7077 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 7078 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463, 7079 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F, 7080 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09, 7081 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3, 7082 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB, 7083 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279, 7084 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8, 7085 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB, 7086 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82, 7087 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB, 7088 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573, 7089 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0, 7090 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B, 7091 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790, 7092 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
7093 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4, 7094 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0, 7095 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7, 7096 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C, 7097 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD, 7098 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1, 7099 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299, 7100 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9, 7101 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477, 7102 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF, 7103 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49, 7104 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF, 7105 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA, 7106 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5, 7107 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41, 7108 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915, 7109 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400, 7110 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915, 7111 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664, 7112 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A ], 7113 [ 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623, 7114 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266, 7115 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1, 7116 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E, 7117 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6, 7118 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1, 7119 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E, 7120 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1, 7121 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737, 7122 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8, 7123 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF, 7124 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD, 7125 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701, 7126 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7, 7127 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41, 7128 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331, 7129 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF, 7130 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF, 7131 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E, 7132 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87, 7133 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C, 7134 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2, 7135 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16, 7136 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD, 7137 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B, 7138 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509, 7139 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E, 7140 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3, 7141 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F, 7142 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A, 7143 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4, 7144 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960, 7145 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66, 7146 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28, 7147 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802, 7148 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84, 7149 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510, 7150 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF, 7151 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14, 7152 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E, 7153 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50, 7154 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7, 7155 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8, 7156 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281, 7157 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
7158 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696, 7159 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128, 7160 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73, 7161 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0, 7162 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0, 7163 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105, 7164 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250, 7165 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3, 7166 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285, 7167 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00, 7168 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061, 7169 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB, 7170 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E, 7171 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735, 7172 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC, 7173 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9, 7174 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340, 7175 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20, 7176 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7 ], 7177 [ 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934, 7178 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068, 7179 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF, 7180 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840, 7181 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45, 7182 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504, 7183 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A, 7184 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB, 7185 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE, 7186 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6, 7187 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42, 7188 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B, 7189 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
7190 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB, 7191 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527, 7192 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B, 7193 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33, 7194 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C, 7195 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3, 7196 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC, 7197 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17, 7198 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564, 7199 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B, 7200 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115, 7201 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922, 7202 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728, 7203 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0, 7204 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E, 7205 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37, 7206 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D, 7207 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804, 7208 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B, 7209 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3, 7210 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB, 7211 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D, 7212 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C, 7213 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350, 7214 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9, 7215 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A, 7216 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE, 7217 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D, 7218 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC, 7219 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F, 7220 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61, 7221 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2, 7222 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9, 7223 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2, 7224 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C, 7225 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E, 7226 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633, 7227 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10, 7228 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169, 7229 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52, 7230 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027, 7231 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5, 7232 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62, 7233 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634, 7234 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76, 7235 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24, 7236 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC, 7237 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4, 7238 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C, 7239 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837, 7240 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0 ], 7241 [ 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B, 7242 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE, 7243 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B, 7244 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4, 7245 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8, 7246 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6, 7247 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304, 7248 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22, 7249 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4, 7250 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6, 7251 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9, 7252 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59, 7253 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593, 7254 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51, 7255 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
vendor: 4,884 bytes, lines 7256-7383
7256 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C, 7257 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B, 7258 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28, 7259 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C, 7260 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD, 7261 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A, 7262 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319, 7263 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB, 7264 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F, 7265 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991, 7266 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32, 7267 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680, 7268 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166, 7269 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE, 7270 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB, 7271 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5, 7272 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47, 7273 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370, 7274 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D, 7275 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84, 7276 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048, 7277 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8, 7278 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD, 7279 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9, 7280 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7, 7281 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38, 7282 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F, 7283 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C, 7284 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525, 7285 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1, 7286 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442, 7287 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964, 7288 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E, 7289 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8, 7290 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D, 7291 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F, 7292 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299, 7293 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02, 7294 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC, 7295 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614, 7296 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A, 7297 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6, 7298 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B, 7299 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0, 7300 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060, 7301 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E, 7302 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9, 7303 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F, 7304 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6 ] 7305 ]; 7306 7307 var BLOWFISH_CTX = { 7308 pbox: [], 7309 sbox: [] 7310 }; 7311 7312 function F(ctx, x){ 7313 let a = (x >> 24) & 0xFF; 7314 let b = (x >> 16) & 0xFF; 7315 let c = (x >> 8) & 0xFF; 7316 let d = x & 0xFF; 7317 7318 let y = ctx.sbox[0][a] + ctx.sbox[1][b]; 7319 y = y ^ ctx.sbox[2][c]; 7320 y = y + ctx.sbox[3][d]; 7321 7322 return y; 7323 } 7324 7325 function BlowFish_Encrypt(ctx, left, right){ 7326 let Xl = left; 7327 let Xr = right; 7328 let temp; 7329 7330 for(let i = 0; i < N; ++i){ 7331 Xl = Xl ^ ctx.pbox[i]; 7332 Xr = F(ctx, Xl) ^ Xr; 7333 7334 temp = Xl; 7335 Xl = Xr; 7336 Xr = temp; 7337 } 7338 7339 temp = Xl; 7340 Xl = Xr; 7341 Xr = temp; 7342 7343 Xr = Xr ^ ctx.pbox[N]; 7344 Xl = Xl ^ ctx.pbox[N + 1]; 7345 7346 return {left: Xl, right: Xr}; 7347 } 7348 7349 function BlowFish_Decrypt(ctx, left, right){ 7350 let Xl = left; 7351 let Xr = right; 7352 let temp; 7353 7354 for(let i = N + 1; i > 1; --i){ 7355 Xl = Xl ^ ctx.pbox[i]; 7356 Xr = F(ctx, Xl) ^ Xr; 7357 7358 temp = Xl; 7359 Xl = Xr; 7360 Xr = temp; 7361 } 7362 7363 temp = Xl; 7364 Xl = Xr; 7365 Xr = temp; 7366 7367 Xr = Xr ^ ctx.pbox[1]; 7368 Xl = Xl ^ ctx.pbox[0]; 7369 7370 return {left: Xl, right: Xr}; 7371 } 7372 7373 /** 7374 * Initialization ctx's pbox and sbox. 7375 * 7376 * @param {Object} ctx The object has pbox and sbox. 7377 * @param {Array} key An array of 32-bit words. 7378 * @param {int} keysize The length of the key. 7379 * 7380 * @example 7381 * 7382 * BlowFishInit(BLOWFISH_CTX, key, 128/32); 7383 */
7384 function BlowFishInit(ctx, key, keysize) 7385 { 7386 for(let Row = 0; Row < 4; Row++) 7387 { 7388 ctx.sbox[Row] = []; 7389 for(let Col = 0; Col < 256; Col++) 7390 { 7391 ctx.sbox[Row][Col] = ORIG_S[Row][Col]; 7392 } 7393 } 7394 7395 let keyIndex = 0; 7396 for(let index = 0; index < N + 2; index++) 7397 { 7398 ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex]; 7399 keyIndex++; 7400 if(keyIndex >= keysize) 7401 { 7402 keyIndex = 0; 7403 } 7404 } 7405 7406 let Data1 = 0; 7407 let Data2 = 0; 7408 let res = 0; 7409 for(let i = 0; i < N + 2; i += 2) 7410 { 7411 res = BlowFish_Encrypt(ctx, Data1, Data2); 7412 Data1 = res.left; 7413 Data2 = res.right; 7414 ctx.pbox[i] = Data1; 7415 ctx.pbox[i + 1] = Data2; 7416 } 7417 7418 for(let i = 0; i < 4; i++) 7419 { 7420 for(let j = 0; j < 256; j += 2) 7421 { 7422 res = BlowFish_Encrypt(ctx, Data1, Data2); 7423 Data1 = res.left; 7424 Data2 = res.right; 7425 ctx.sbox[i][j] = Data1; 7426 ctx.sbox[i][j + 1] = Data2; 7427 } 7428 } 7429 7430 return true; 7431 } 7432 7433 /** 7434 * Blowfish block cipher algorithm. 7435 */ 7436 var Blowfish = C_algo.Blowfish = BlockCipher.extend({ 7437 _doReset: function () { 7438 // Skip reset of nRounds has been set before and key did not change 7439 if (this._keyPriorReset === this._key) { 7440 return; 7441 } 7442 7443 // Shortcuts 7444 var key = this._keyPriorReset = this._key; 7445 var keyWords = key.words; 7446 var keySize = key.sigBytes / 4; 7447 7448 //Initialization pbox and sbox 7449 BlowFishInit(BLOWFISH_CTX, keyWords, keySize); 7450 }, 7451 7452 encryptBlock: function (M, offset) { 7453 var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]); 7454 M[offset] = res.left; 7455 M[offset + 1] = res.right; 7456 }, 7457 7458 decryptBlock: function (M, offset) { 7459 var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]); 7460 M[offset] = res.left; 7461 M[offset + 1] = res.right; 7462 }, 7463 7464 blockSize: 64/32, 7465 7466 keySize: 128/32, 7467 7468 ivSize: 64/32 7469 }); 7470 7471 /** 7472 * Shortcut functions to the cipher's object interface. 7473 * 7474 * @example 7475 * 7476 * var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg); 7477 * var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg); 7478 */ 7479 C.Blowfish = BlockCipher._createHelper(Blowfish); 7480 }()); 7481 7482 7483 return CryptoJS.Blowfish; 7484 7485 })); 7486 } (blowfish$1)); 7487 return blowfish$1.exports; 7488} 7489 7490var cryptoJs = cryptoJs$1.exports; 7491 7492var hasRequiredCryptoJs; 7493 7494function requireCryptoJs () { 7495 if (hasRequiredCryptoJs) return cryptoJs$1.exports; 7496 hasRequiredCryptoJs = 1; 7497 (function (module, exports$1) { 7498(function (root, factory, undef) { 7499 { 7500 // CommonJS 7501 module.exports = factory(requireCore(), requireX64Core(), requireLibTypedarrays(), requireEncUtf16(), requireEncBase64(), requireEncBase64url(), requireMd5(), requireSha1(), requireSha256(), requireSha224(), requireSha512(), requireSha384(), requireSha3(), requireRipemd160(), requireHmac(), requirePbkdf2(), requireEvpkdf(), requireCipherCore(), requireModeCfb(), requireModeCtr(), requireModeCtrGladman(), requireModeOfb(), requireModeEcb(), requirePadAnsix923(), requirePadIso10126(), requirePadIso97971(), requirePadZeropadding(), requirePadNopadding(), requireFormatHex(), requireAes(), requireTripledes(), requireRc4(), requireRabbit(), requireRabbitLegacy(), requireBlowfish()); 7502 } 7503 }(cryptoJs, function (CryptoJS) { 7504 7505 return CryptoJS; 7506 7507 })); 7508 } (cryptoJs$1)); 7509 return cryptoJs$1.exports; 7510} 7511 7512var cryptoJsExports = requireCryptoJs(); 7513const CryptoJS = /*@__PURE__*/getDefaultExportFromCjs(cryptoJsExports); 7514 7515function encrypt(data, key) { 7516 const hashedKey = CryptoJS.SHA256(key).toString(); 7517 const iv = CryptoJS.lib.WordArray.random(16);
7518 const encrypted = CryptoJS.AES.encrypt(data, hashedKey, { 7519 iv, 7520 mode: CryptoJS.mode.CBC, 7521 padding: CryptoJS.pad.Pkcs7 7522 }); 7523 const ivString = CryptoJS.enc.Base64.stringify(iv); 7524 const cipherString = encrypted.toString(); 7525 return ivString + ":" + cipherString; 7526} 7527function decrypt(encryptedData, key) { 7528 const hashedKey = CryptoJS.SHA256(key).toString(); 7529 const [ivString, cipherString] = encryptedData.split(":"); 7530 const iv = CryptoJS.enc.Base64.parse(ivString); 7531 const decrypted = CryptoJS.AES.decrypt(cipherString, hashedKey, { 7532 iv, 7533 mode: CryptoJS.mode.CBC, 7534 padding: CryptoJS.pad.Pkcs7 7535 }); 7536 return decrypted.toString(CryptoJS.enc.Utf8); 7537} 7538 7539function Index($$anchor, $$props) { 7540 push($$props, true); 7541 7542 let props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 7543 let gradio = new Gradio(props); 7544 7545 function load_value() { 7546 const stored = localStorage.getItem(gradio.props.storage_key); 7547 7548 if (!stored) { 7549 gradio.props.value = gradio.props.default_value; 7550 7551 return; 7552 } 7553 7554 try { 7555 const decrypted = decrypt(stored, gradio.props.secret); 7556 7557 gradio.props.value = JSON.parse(decrypted); 7558 } catch(e) { 7559 console.error("Error reading from localStorage:", e); 7560 gradio.props.value = gradio.props.default_value; 7561 } 7562 } 7563 7564 function save_value(value, secret, storage_key) { 7565 if (!value) return; 7566 7567 try { 7568 const encrypted = encrypt(JSON.stringify(value), secret); 7569 7570 localStorage.setItem(storage_key, encrypted); 7571 } catch(e) { 7572 console.error("Error writing to localStorage:", e); 7573 } 7574 } 7575 7576 let old_value = gradio.props.value; 7577 7578 user_effect(() => { 7579 if (old_value !== gradio.props.value) { 7580 old_value = gradio.props.value; 7581 save_value(gradio.props.value, gradio.props.secret, gradio.props.storage_key); 7582 gradio.dispatch("change"); 7583 } 7584 }); 7585 7586 onMount(() => { 7587 load_value(); 7588 }); 7589 7590 pop(); 7591} 7592 7593export { Index as default }; 7594//# sourceMappingURL=Index-CI0xDggI.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.