vendor: 7,241 bytes, lines 1-308
1; (function (root, factory) { 2 if (typeof exports === "object") { 3 // CommonJS 4 module.exports = exports = factory(); 5 } 6 else if (typeof define === "function" && define.amd) { 7 // AMD 8 define([], factory); 9 } 10 else { 11 // Global (browser) 12 root.CryptoJS = factory(); 13 } 14}(this, function () { 15 16 /** 17 * CryptoJS core components. 18 */ 19 var CryptoJS = CryptoJS || (function (Math, undefined) { 20 /* 21 * Local polyfil of Object.create 22 */ 23 var create = Object.create || (function () { 24 function F() { }; 25 26 return function (obj) { 27 var subtype; 28 29 F.prototype = obj; 30 31 subtype = new F(); 32 33 F.prototype = null; 34 35 return subtype; 36 }; 37 }()) 38 39 /** 40 * CryptoJS namespace. 41 */ 42 var C = {}; 43 44 /** 45 * Library namespace. 46 */ 47 var C_lib = C.lib = {}; 48 49 /** 50 * Base object for prototypal inheritance. 51 */ 52 var Base = C_lib.Base = (function () { 53 54 55 return { 56 /** 57 * Creates a new object that inherits from this object. 58 * 59 * @param {Object} overrides Properties to copy into the new object. 60 * 61 * @return {Object} The new object. 62 * 63 * @static 64 * 65 * @example 66 * 67 * var MyType = CryptoJS.lib.Base.extend({ 68 * field: 'value', 69 * 70 * method: function () { 71 * } 72 * }); 73 */ 74 extend: function (overrides) { 75 // Spawn 76 var subtype = create(this); 77 78 // Augment 79 if (overrides) { 80 subtype.mixIn(overrides); 81 } 82 83 // Create default initializer 84 if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { 85 subtype.init = function () { 86 subtype.$super.init.apply(this, arguments); 87 }; 88 } 89 90 // Initializer's prototype is the subtype object 91 subtype.init.prototype = subtype; 92 93 // Reference supertype 94 subtype.$super = this; 95 96 return subtype; 97 }, 98 99 /** 100 * Extends this object and runs the init method. 101 * Arguments to create() will be passed to init(). 102 * 103 * @return {Object} The new object. 104 * 105 * @static 106 * 107 * @example 108 * 109 * var instance = MyType.create(); 110 */ 111 create: function () { 112 var instance = this.extend(); 113 instance.init.apply(instance, arguments); 114 115 return instance; 116 }, 117 118 /** 119 * Initializes a newly created object. 120 * Override this method to add some logic when your objects are created. 121 * 122 * @example 123 * 124 * var MyType = CryptoJS.lib.Base.extend({ 125 * init: function () { 126 * // ... 127 * } 128 * }); 129 */ 130 init: function () { 131 }, 132 133 /** 134 * Copies properties into this object. 135 * 136 * @param {Object} properties The properties to mix in. 137 * 138 * @example 139 * 140 * MyType.mixIn({ 141 * field: 'value' 142 * }); 143 */ 144 mixIn: function (properties) { 145 for (var propertyName in properties) { 146 if (properties.hasOwnProperty(propertyName)) { 147 this[propertyName] = properties[propertyName]; 148 } 149 } 150 151 // IE won't copy toString using the loop above 152 if (properties.hasOwnProperty('toString')) { 153 this.toString = properties.toString; 154 } 155 }, 156 157 /** 158 * Creates a copy of this object. 159 * 160 * @return {Object} The clone. 161 * 162 * @example 163 * 164 * var clone = instance.clone(); 165 */ 166 clone: function () { 167 return this.init.prototype.extend(this); 168 } 169 }; 170 }()); 171 172 /** 173 * An array of 32-bit words. 174 * 175 * @property {Array} words The array of 32-bit words. 176 * @property {number} sigBytes The number of significant bytes in this word array. 177 */ 178 var WordArray = C_lib.WordArray = Base.extend({ 179 /** 180 * Initializes a newly created word array. 181 * 182 * @param {Array} words (Optional) An array of 32-bit words. 183 * @param {number} sigBytes (Optional) The number of significant bytes in the words. 184 * 185 * @example 186 * 187 * var wordArray = CryptoJS.lib.WordArray.create(); 188 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); 189 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); 190 */ 191 init: function (words, sigBytes) { 192 words = this.words = words || []; 193 194 if (sigBytes != undefined) { 195 this.sigBytes = sigBytes; 196 } else { 197 this.sigBytes = words.length * 4; 198 } 199 }, 200 201 /** 202 * Converts this word array to a string. 203 * 204 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex 205 * 206 * @return {string} The stringified word array. 207 * 208 * @example 209 * 210 * var string = wordArray + ''; 211 * var string = wordArray.toString(); 212 * var string = wordArray.toString(CryptoJS.enc.Utf8); 213 */ 214 toString: function (encoder) { 215 return (encoder || Hex).stringify(this); 216 }, 217 218 /** 219 * Concatenates a word array to this word array. 220 * 221 * @param {WordArray} wordArray The word array to append. 222 * 223 * @return {WordArray} This word array. 224 * 225 * @example 226 * 227 * wordArray1.concat(wordArray2); 228 */ 229 concat: function (wordArray) { 230 // Shortcuts 231 var thisWords = this.words; 232 var thatWords = wordArray.words; 233 var thisSigBytes = this.sigBytes; 234 var thatSigBytes = wordArray.sigBytes; 235 236 // Clamp excess bits 237 this.clamp(); 238 239 // Concat 240 if (thisSigBytes % 4) { 241 // Copy one byte at a time 242 for (var i = 0; i < thatSigBytes; i++) { 243 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 244 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); 245 } 246 } else { 247 // Copy one word at a time 248 for (var i = 0; i < thatSigBytes; i += 4) { 249 thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; 250 } 251 } 252 this.sigBytes += thatSigBytes; 253 254 // Chainable 255 return this; 256 }, 257 258 /** 259 * Removes insignificant bits. 260 * 261 * @example 262 * 263 * wordArray.clamp(); 264 */ 265 clamp: function () { 266 // Shortcuts 267 var words = this.words; 268 var sigBytes = this.sigBytes; 269 270 // Clamp 271 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); 272 words.length = Math.ceil(sigBytes / 4); 273 }, 274 275 /** 276 * Creates a copy of this word array. 277 * 278 * @return {WordArray} The clone. 279 * 280 * @example 281 * 282 * var clone = wordArray.clone(); 283 */ 284 clone: function () { 285 var clone = Base.clone.call(this); 286 clone.words = this.words.slice(0); 287 288 return clone; 289 }, 290 291 /** 292 * Creates a word array filled with random bytes. 293 * 294 * @param {number} nBytes The number of random bytes to generate. 295 * 296 * @return {WordArray} The random word array. 297 * 298 * @static 299 * 300 * @example 301 * 302 * var wordArray = CryptoJS.lib.WordArray.random(16); 303 */ 304 random: function (nBytes) { 305 var words = []; 306 307 var r = (function (m_w) { 308 var m_w = m_w;
309 var m_z = 0x3ade68b1; 310 var mask = 0xffffffff; 311 312 return function () { 313 m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; 314 m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; 315 var result = ((m_z << 0x10) + m_w) & mask; 316 result /= 0x100000000; 317 result += 0.5; 318 return result * (Math.random() > .5 ? 1 : -1); 319 } 320 }); 321 322 for (var i = 0, rcache; i < nBytes; i += 4) { 323 var _r = r((rcache || Math.random()) * 0x100000000); 324 325 rcache = _r() * 0x3ade67b7; 326 words.push((_r() * 0x100000000) | 0); 327 } 328 329 return new WordArray.init(words, nBytes); 330 } 331 }); 332 333 /** 334 * Encoder namespace. 335 */ 336 var C_enc = C.enc = {}; 337 338 /** 339 * Hex encoding strategy. 340 */ 341 var Hex = C_enc.Hex = { 342 /** 343 * Converts a word array to a hex string. 344 * 345 * @param {WordArray} wordArray The word array. 346 * 347 * @return {string} The hex string. 348 * 349 * @static 350 * 351 * @example 352 * 353 * var hexString = CryptoJS.enc.Hex.stringify(wordArray); 354 */ 355 stringify: function (wordArray) { 356 // Shortcuts 357 var words = wordArray.words; 358 var sigBytes = wordArray.sigBytes; 359 360 // Convert 361 var hexChars = []; 362 for (var i = 0; i < sigBytes; i++) { 363 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 364 hexChars.push((bite >>> 4).toString(16)); 365 hexChars.push((bite & 0x0f).toString(16)); 366 } 367 368 return hexChars.join(''); 369 }, 370 371 /** 372 * Converts a hex string to a word array. 373 * 374 * @param {string} hexStr The hex string. 375 * 376 * @return {WordArray} The word array. 377 * 378 * @static 379 * 380 * @example 381 * 382 * var wordArray = CryptoJS.enc.Hex.parse(hexString); 383 */ 384 parse: function (hexStr) { 385 // Shortcut 386 var hexStrLength = hexStr.length; 387 388 // Convert 389 var words = []; 390 for (var i = 0; i < hexStrLength; i += 2) { 391 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); 392 } 393 394 return new WordArray.init(words, hexStrLength / 2); 395 } 396 }; 397 398 /** 399 * Latin1 encoding strategy. 400 */ 401 var Latin1 = C_enc.Latin1 = { 402 /** 403 * Converts a word array to a Latin1 string. 404 * 405 * @param {WordArray} wordArray The word array. 406 * 407 * @return {string} The Latin1 string. 408 * 409 * @static 410 * 411 * @example 412 * 413 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); 414 */ 415 stringify: function (wordArray) { 416 // Shortcuts 417 var words = wordArray.words; 418 var sigBytes = wordArray.sigBytes; 419 420 // Convert 421 var latin1Chars = []; 422 for (var i = 0; i < sigBytes; i++) { 423 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 424 latin1Chars.push(String.fromCharCode(bite)); 425 } 426 427 return latin1Chars.join(''); 428 }, 429 430 /** 431 * Converts a Latin1 string to a word array. 432 * 433 * @param {string} latin1Str The Latin1 string. 434 * 435 * @return {WordArray} The word array. 436 * 437 * @static 438 * 439 * @example 440 * 441 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); 442 */ 443 parse: function (latin1Str) { 444 // Shortcut 445 var latin1StrLength = latin1Str.length; 446 447 // Convert 448 var words = []; 449 for (var i = 0; i < latin1StrLength; i++) { 450 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); 451 } 452 453 return new WordArray.init(words, latin1StrLength); 454 } 455 }; 456 457 /** 458 * UTF-8 encoding strategy. 459 */ 460 var Utf8 = C_enc.Utf8 = { 461 /** 462 * Converts a word array to a UTF-8 string. 463 * 464 * @param {WordArray} wordArray The word array. 465 * 466 * @return {string} The UTF-8 string. 467 * 468 * @static 469 * 470 * @example 471 * 472 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); 473 */ 474 stringify: function (wordArray) { 475 try { 476 return decodeURIComponent(escape(Latin1.stringify(wordArray))); 477 } catch (e) { 478 throw new Error('Malformed UTF-8 data'); 479 } 480 }, 481 482 /** 483 * Converts a UTF-8 string to a word array. 484 * 485 * @param {string} utf8Str The UTF-8 string. 486 * 487 * @return {WordArray} The word array. 488 * 489 * @static 490 * 491 * @example 492 *
vendor: 8,995 bytes, lines 493-850
493 * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); 494 */ 495 parse: function (utf8Str) { 496 return Latin1.parse(unescape(encodeURIComponent(utf8Str))); 497 } 498 }; 499 500 /** 501 * Abstract buffered block algorithm template. 502 * 503 * The property blockSize must be implemented in a concrete subtype. 504 * 505 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 506 */ 507 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ 508 /** 509 * Resets this block algorithm's data buffer to its initial state. 510 * 511 * @example 512 * 513 * bufferedBlockAlgorithm.reset(); 514 */ 515 reset: function () { 516 // Initial values 517 this._data = new WordArray.init(); 518 this._nDataBytes = 0; 519 }, 520 521 /** 522 * Adds new data to this block algorithm's buffer. 523 * 524 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. 525 * 526 * @example 527 * 528 * bufferedBlockAlgorithm._append('data'); 529 * bufferedBlockAlgorithm._append(wordArray); 530 */ 531 _append: function (data) { 532 // Convert string to WordArray, else assume WordArray already 533 if (typeof data == 'string') { 534 data = Utf8.parse(data); 535 } 536 537 // Append 538 this._data.concat(data); 539 this._nDataBytes += data.sigBytes; 540 }, 541 542 /** 543 * Processes available data blocks. 544 * 545 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. 546 * 547 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. 548 * 549 * @return {WordArray} The processed data. 550 * 551 * @example 552 * 553 * var processedData = bufferedBlockAlgorithm._process(); 554 * var processedData = bufferedBlockAlgorithm._process(!!'flush'); 555 */ 556 _process: function (doFlush) { 557 // Shortcuts 558 var data = this._data; 559 var dataWords = data.words; 560 var dataSigBytes = data.sigBytes; 561 var blockSize = this.blockSize; 562 var blockSizeBytes = blockSize * 4; 563 564 // Count blocks ready 565 var nBlocksReady = dataSigBytes / blockSizeBytes; 566 if (doFlush) { 567 // Round up to include partial blocks 568 nBlocksReady = Math.ceil(nBlocksReady); 569 } else { 570 // Round down to include only full blocks, 571 // less the number of blocks that must remain in the buffer 572 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); 573 } 574 575 // Count words ready 576 var nWordsReady = nBlocksReady * blockSize; 577 578 // Count bytes ready 579 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); 580 581 // Process blocks 582 if (nWordsReady) { 583 for (var offset = 0; offset < nWordsReady; offset += blockSize) { 584 // Perform concrete-algorithm logic 585 this._doProcessBlock(dataWords, offset); 586 } 587 588 // Remove processed words 589 var processedWords = dataWords.splice(0, nWordsReady); 590 data.sigBytes -= nBytesReady; 591 } 592 593 // Return processed words 594 return new WordArray.init(processedWords, nBytesReady); 595 }, 596 597 /** 598 * Creates a copy of this object. 599 * 600 * @return {Object} The clone. 601 * 602 * @example 603 * 604 * var clone = bufferedBlockAlgorithm.clone(); 605 */ 606 clone: function () { 607 var clone = Base.clone.call(this); 608 clone._data = this._data.clone(); 609 610 return clone; 611 }, 612 613 _minBufferSize: 0 614 }); 615 616 /** 617 * Abstract hasher template. 618 * 619 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) 620 */ 621 var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ 622 /** 623 * Configuration options. 624 */ 625 cfg: Base.extend(), 626 627 /** 628 * Initializes a newly created hasher. 629 * 630 * @param {Object} cfg (Optional) The configuration options to use for this hash computation. 631 * 632 * @example 633 * 634 * var hasher = CryptoJS.algo.SHA256.create(); 635 */ 636 init: function (cfg) { 637 // Apply config defaults 638 this.cfg = this.cfg.extend(cfg); 639 640 // Set initial values 641 this.reset(); 642 }, 643 644 /** 645 * Resets this hasher to its initial state. 646 * 647 * @example 648 * 649 * hasher.reset(); 650 */ 651 reset: function () { 652 // Reset data buffer 653 BufferedBlockAlgorithm.reset.call(this); 654 655 // Perform concrete-hasher logic 656 this._doReset(); 657 }, 658 659 /** 660 * Updates this hasher with a message. 661 * 662 * @param {WordArray|string} messageUpdate The message to append. 663 * 664 * @return {Hasher} This hasher. 665 * 666 * @example 667 * 668 * hasher.update('message'); 669 * hasher.update(wordArray); 670 */ 671 update: function (messageUpdate) { 672 // Append 673 this._append(messageUpdate); 674 675 // Update the hash 676 this._process(); 677 678 // Chainable 679 return this; 680 }, 681 682 /** 683 * Finalizes the hash computation. 684 * Note that the finalize operation is effectively a destructive, read-once operation. 685 * 686 * @param {WordArray|string} messageUpdate (Optional) A final message update. 687 * 688 * @return {WordArray} The hash. 689 * 690 * @example 691 * 692 * var hash = hasher.finalize(); 693 * var hash = hasher.finalize('message'); 694 * var hash = hasher.finalize(wordArray); 695 */ 696 finalize: function (messageUpdate) { 697 // Final message update 698 if (messageUpdate) { 699 this._append(messageUpdate); 700 } 701 702 // Perform concrete-hasher logic 703 var hash = this._doFinalize(); 704 705 return hash; 706 }, 707 708 blockSize: 512 / 32, 709 710 /** 711 * Creates a shortcut function to a hasher's object interface. 712 * 713 * @param {Hasher} hasher The hasher to create a helper for. 714 * 715 * @return {Function} The shortcut function. 716 * 717 * @static 718 * 719 * @example 720 * 721 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); 722 */ 723 _createHelper: function (hasher) { 724 return function (message, cfg) { 725 return new hasher.init(cfg).finalize(message); 726 }; 727 }, 728 729 /** 730 * Creates a shortcut function to the HMAC's object interface. 731 * 732 * @param {Hasher} hasher The hasher to use in this HMAC helper. 733 * 734 * @return {Function} The shortcut function. 735 * 736 * @static 737 * 738 * @example 739 * 740 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); 741 */ 742 _createHmacHelper: function (hasher) { 743 return function (message, key) { 744 return new C_algo.HMAC.init(hasher, key).finalize(message); 745 }; 746 } 747 }); 748 749 /** 750 * Algorithm namespace. 751 */ 752 var C_algo = C.algo = {}; 753 754 return C; 755 }(Math)); 756 757 758 return CryptoJS; 759 760})); 761 762 763 764 765; (function (root, factory) { 766 if (typeof exports === "object") { 767 // CommonJS 768 module.exports = exports = factory(require("./core")); 769 } 770 else if (typeof define === "function" && define.amd) { 771 // AMD 772 define(["./core"], factory); 773 } 774 else { 775 // Global (browser) 776 factory(root.CryptoJS); 777 } 778}(this, function (CryptoJS) { 779 780 (function (Math) { 781 // Shortcuts 782 var C = CryptoJS; 783 var C_lib = C.lib; 784 var WordArray = C_lib.WordArray; 785 var Hasher = C_lib.Hasher; 786 var C_algo = C.algo; 787 788 // Constants table 789 var T = []; 790 791 // Compute constants 792 (function () { 793 for (var i = 0; i < 64; i++) { 794 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; 795 } 796 }()); 797 798 /** 799 * MD5 hash algorithm. 800 */ 801 var MD5 = C_algo.MD5 = Hasher.extend({ 802 _doReset: function () { 803 this._hash = new WordArray.init([ 804 0x67452301, 0xefcdab89, 805 0x98badcfe, 0x10325476 806 ]); 807 }, 808 809 _doProcessBlock: function (M, offset) { 810 // Swap endian 811 for (var i = 0; i < 16; i++) { 812 // Shortcuts 813 var offset_i = offset + i; 814 var M_offset_i = M[offset_i]; 815 816 M[offset_i] = ( 817 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 818 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 819 ); 820 } 821 822 // Shortcuts 823 var H = this._hash.words; 824 825 var M_offset_0 = M[offset + 0]; 826 var M_offset_1 = M[offset + 1]; 827 var M_offset_2 = M[offset + 2]; 828 var M_offset_3 = M[offset + 3]; 829 var M_offset_4 = M[offset + 4]; 830 var M_offset_5 = M[offset + 5]; 831 var M_offset_6 = M[offset + 6]; 832 var M_offset_7 = M[offset + 7]; 833 var M_offset_8 = M[offset + 8]; 834 var M_offset_9 = M[offset + 9]; 835 var M_offset_10 = M[offset + 10]; 836 var M_offset_11 = M[offset + 11]; 837 var M_offset_12 = M[offset + 12]; 838 var M_offset_13 = M[offset + 13]; 839 var M_offset_14 = M[offset + 14]; 840 var M_offset_15 = M[offset + 15]; 841 842 // Working varialbes 843 var a = H[0]; 844 var b = H[1]; 845 var c = H[2]; 846 var d = H[3]; 847 848 // Computation 849 a = FF(a, b, c, d, M_offset_0, 7, T[0]); 850 d = FF(d, a, b, c, M_offset_1, 12, T[1]);
851 c = FF(c, d, a, b, M_offset_2, 17, T[2]); 852 b = FF(b, c, d, a, M_offset_3, 22, T[3]); 853 a = FF(a, b, c, d, M_offset_4, 7, T[4]); 854 d = FF(d, a, b, c, M_offset_5, 12, T[5]); 855 c = FF(c, d, a, b, M_offset_6, 17, T[6]); 856 b = FF(b, c, d, a, M_offset_7, 22, T[7]); 857 a = FF(a, b, c, d, M_offset_8, 7, T[8]); 858 d = FF(d, a, b, c, M_offset_9, 12, T[9]); 859 c = FF(c, d, a, b, M_offset_10, 17, T[10]); 860 b = FF(b, c, d, a, M_offset_11, 22, T[11]); 861 a = FF(a, b, c, d, M_offset_12, 7, T[12]); 862 d = FF(d, a, b, c, M_offset_13, 12, T[13]); 863 c = FF(c, d, a, b, M_offset_14, 17, T[14]); 864 b = FF(b, c, d, a, M_offset_15, 22, T[15]); 865 866 a = GG(a, b, c, d, M_offset_1, 5, T[16]); 867 d = GG(d, a, b, c, M_offset_6, 9, T[17]); 868 c = GG(c, d, a, b, M_offset_11, 14, T[18]); 869 b = GG(b, c, d, a, M_offset_0, 20, T[19]); 870 a = GG(a, b, c, d, M_offset_5, 5, T[20]); 871 d = GG(d, a, b, c, M_offset_10, 9, T[21]); 872 c = GG(c, d, a, b, M_offset_15, 14, T[22]); 873 b = GG(b, c, d, a, M_offset_4, 20, T[23]);
vendor: 4,299 bytes, lines 874-1008
874 a = GG(a, b, c, d, M_offset_9, 5, T[24]); 875 d = GG(d, a, b, c, M_offset_14, 9, T[25]); 876 c = GG(c, d, a, b, M_offset_3, 14, T[26]); 877 b = GG(b, c, d, a, M_offset_8, 20, T[27]); 878 a = GG(a, b, c, d, M_offset_13, 5, T[28]); 879 d = GG(d, a, b, c, M_offset_2, 9, T[29]); 880 c = GG(c, d, a, b, M_offset_7, 14, T[30]); 881 b = GG(b, c, d, a, M_offset_12, 20, T[31]); 882 883 a = HH(a, b, c, d, M_offset_5, 4, T[32]); 884 d = HH(d, a, b, c, M_offset_8, 11, T[33]); 885 c = HH(c, d, a, b, M_offset_11, 16, T[34]); 886 b = HH(b, c, d, a, M_offset_14, 23, T[35]); 887 a = HH(a, b, c, d, M_offset_1, 4, T[36]); 888 d = HH(d, a, b, c, M_offset_4, 11, T[37]); 889 c = HH(c, d, a, b, M_offset_7, 16, T[38]); 890 b = HH(b, c, d, a, M_offset_10, 23, T[39]); 891 a = HH(a, b, c, d, M_offset_13, 4, T[40]); 892 d = HH(d, a, b, c, M_offset_0, 11, T[41]); 893 c = HH(c, d, a, b, M_offset_3, 16, T[42]); 894 b = HH(b, c, d, a, M_offset_6, 23, T[43]); 895 a = HH(a, b, c, d, M_offset_9, 4, T[44]); 896 d = HH(d, a, b, c, M_offset_12, 11, T[45]); 897 c = HH(c, d, a, b, M_offset_15, 16, T[46]); 898 b = HH(b, c, d, a, M_offset_2, 23, T[47]); 899 900 a = II(a, b, c, d, M_offset_0, 6, T[48]); 901 d = II(d, a, b, c, M_offset_7, 10, T[49]); 902 c = II(c, d, a, b, M_offset_14, 15, T[50]); 903 b = II(b, c, d, a, M_offset_5, 21, T[51]); 904 a = II(a, b, c, d, M_offset_12, 6, T[52]); 905 d = II(d, a, b, c, M_offset_3, 10, T[53]); 906 c = II(c, d, a, b, M_offset_10, 15, T[54]); 907 b = II(b, c, d, a, M_offset_1, 21, T[55]); 908 a = II(a, b, c, d, M_offset_8, 6, T[56]); 909 d = II(d, a, b, c, M_offset_15, 10, T[57]); 910 c = II(c, d, a, b, M_offset_6, 15, T[58]); 911 b = II(b, c, d, a, M_offset_13, 21, T[59]); 912 a = II(a, b, c, d, M_offset_4, 6, T[60]); 913 d = II(d, a, b, c, M_offset_11, 10, T[61]); 914 c = II(c, d, a, b, M_offset_2, 15, T[62]); 915 b = II(b, c, d, a, M_offset_9, 21, T[63]); 916 917 // Intermediate hash value 918 H[0] = (H[0] + a) | 0; 919 H[1] = (H[1] + b) | 0; 920 H[2] = (H[2] + c) | 0; 921 H[3] = (H[3] + d) | 0; 922 }, 923 924 _doFinalize: function () { 925 // Shortcuts 926 var data = this._data; 927 var dataWords = data.words; 928 929 var nBitsTotal = this._nDataBytes * 8; 930 var nBitsLeft = data.sigBytes * 8; 931 932 // Add padding 933 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 934 935 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); 936 var nBitsTotalL = nBitsTotal; 937 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( 938 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | 939 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) 940 ); 941 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 942 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | 943 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) 944 ); 945 946 data.sigBytes = (dataWords.length + 1) * 4; 947 948 // Hash final blocks 949 this._process(); 950 951 // Shortcuts 952 var hash = this._hash; 953 var H = hash.words; 954 955 // Swap endian 956 for (var i = 0; i < 4; i++) { 957 // Shortcut 958 var H_i = H[i]; 959 960 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 961 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 962 } 963 964 // Return final computed hash 965 return hash; 966 }, 967 968 clone: function () { 969 var clone = Hasher.clone.call(this); 970 clone._hash = this._hash.clone(); 971 972 return clone; 973 } 974 }); 975 976 function FF(a, b, c, d, x, s, t) { 977 var n = a + ((b & c) | (~b & d)) + x + t; 978 return ((n << s) | (n >>> (32 - s))) + b; 979 } 980 981 function GG(a, b, c, d, x, s, t) { 982 var n = a + ((b & d) | (c & ~d)) + x + t; 983 return ((n << s) | (n >>> (32 - s))) + b; 984 } 985 986 function HH(a, b, c, d, x, s, t) { 987 var n = a + (b ^ c ^ d) + x + t; 988 return ((n << s) | (n >>> (32 - s))) + b; 989 } 990 991 function II(a, b, c, d, x, s, t) { 992 var n = a + (c ^ (b | ~d)) + x + t; 993 return ((n << s) | (n >>> (32 - s))) + b; 994 } 995 996 /** 997 * Shortcut function to the hasher's object interface. 998 * 999 * @param {WordArray|string} message The message to hash. 1000 * 1001 * @return {WordArray} The hash. 1002 * 1003 * @static 1004 * 1005 * @example 1006 * 1007 * var hash = CryptoJS.MD5('message'); 1008 * var hash = CryptoJS.MD5(wordArray);
1009 */ 1010 C.MD5 = Hasher._createHelper(MD5); 1011 1012 /** 1013 * Shortcut function to the HMAC's object interface. 1014 * 1015 * @param {WordArray|string} message The message to hash. 1016 * @param {WordArray|string} key The secret key. 1017 * 1018 * @return {WordArray} The HMAC. 1019 * 1020 * @static 1021 * 1022 * @example 1023 * 1024 * var hmac = CryptoJS.HmacMD5(message, key); 1025 */ 1026 C.HmacMD5 = Hasher._createHmacHelper(MD5); 1027 }(Math)); 1028 1029 1030 return CryptoJS.MD5; 1031 1032}));
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.