1 | ;(function (root, factory) {
|
2 | if (typeof exports === "object") {
|
3 |
|
4 | module.exports = exports = factory(require("./core"));
|
5 | }
|
6 | else if (typeof define === "function" && define.amd) {
|
7 |
|
8 | define(["./core"], factory);
|
9 | }
|
10 | else {
|
11 |
|
12 | factory(root.CryptoJS);
|
13 | }
|
14 | }(this, function (CryptoJS) {
|
15 |
|
16 | (function () {
|
17 |
|
18 | if (typeof ArrayBuffer != 'function') {
|
19 | return;
|
20 | }
|
21 |
|
22 |
|
23 | var C = CryptoJS;
|
24 | var C_lib = C.lib;
|
25 | var WordArray = C_lib.WordArray;
|
26 |
|
27 |
|
28 | var superInit = WordArray.init;
|
29 |
|
30 |
|
31 | var subInit = WordArray.init = function (typedArray) {
|
32 |
|
33 | if (typedArray instanceof ArrayBuffer) {
|
34 | typedArray = new Uint8Array(typedArray);
|
35 | }
|
36 |
|
37 |
|
38 | if (
|
39 | typedArray instanceof Int8Array ||
|
40 | (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
|
41 | typedArray instanceof Int16Array ||
|
42 | typedArray instanceof Uint16Array ||
|
43 | typedArray instanceof Int32Array ||
|
44 | typedArray instanceof Uint32Array ||
|
45 | typedArray instanceof Float32Array ||
|
46 | typedArray instanceof Float64Array
|
47 | ) {
|
48 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
|
49 | }
|
50 |
|
51 |
|
52 | if (typedArray instanceof Uint8Array) {
|
53 |
|
54 | var typedArrayByteLength = typedArray.byteLength;
|
55 |
|
56 |
|
57 | var words = [];
|
58 | for (var i = 0; i < typedArrayByteLength; i++) {
|
59 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
|
60 | }
|
61 |
|
62 |
|
63 | superInit.call(this, words, typedArrayByteLength);
|
64 | } else {
|
65 |
|
66 | superInit.apply(this, arguments);
|
67 | }
|
68 | };
|
69 |
|
70 | subInit.prototype = WordArray;
|
71 | }());
|
72 |
|
73 |
|
74 | return CryptoJS.lib.WordArray;
|
75 |
|
76 | })); |
\ | No newline at end of file |