github.com/theQRL/go-zond@v0.2.1/internal/jsre/deps/web3.js (about)

     1  require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
     2  module.exports=[
     3    {
     4      "constant": true,
     5      "inputs": [
     6        {
     7          "name": "_owner",
     8          "type": "address"
     9        }
    10      ],
    11      "name": "name",
    12      "outputs": [
    13        {
    14          "name": "o_name",
    15          "type": "bytes32"
    16        }
    17      ],
    18      "type": "function"
    19    },
    20    {
    21      "constant": true,
    22      "inputs": [
    23        {
    24          "name": "_name",
    25          "type": "bytes32"
    26        }
    27      ],
    28      "name": "owner",
    29      "outputs": [
    30        {
    31          "name": "",
    32          "type": "address"
    33        }
    34      ],
    35      "type": "function"
    36    },
    37    {
    38      "constant": true,
    39      "inputs": [
    40        {
    41          "name": "_name",
    42          "type": "bytes32"
    43        }
    44      ],
    45      "name": "content",
    46      "outputs": [
    47        {
    48          "name": "",
    49          "type": "bytes32"
    50        }
    51      ],
    52      "type": "function"
    53    },
    54    {
    55      "constant": true,
    56      "inputs": [
    57        {
    58          "name": "_name",
    59          "type": "bytes32"
    60        }
    61      ],
    62      "name": "addr",
    63      "outputs": [
    64        {
    65          "name": "",
    66          "type": "address"
    67        }
    68      ],
    69      "type": "function"
    70    },
    71    {
    72      "constant": false,
    73      "inputs": [
    74        {
    75          "name": "_name",
    76          "type": "bytes32"
    77        }
    78      ],
    79      "name": "reserve",
    80      "outputs": [],
    81      "type": "function"
    82    },
    83    {
    84      "constant": true,
    85      "inputs": [
    86        {
    87          "name": "_name",
    88          "type": "bytes32"
    89        }
    90      ],
    91      "name": "subRegistrar",
    92      "outputs": [
    93        {
    94          "name": "",
    95          "type": "address"
    96        }
    97      ],
    98      "type": "function"
    99    },
   100    {
   101      "constant": false,
   102      "inputs": [
   103        {
   104          "name": "_name",
   105          "type": "bytes32"
   106        },
   107        {
   108          "name": "_newOwner",
   109          "type": "address"
   110        }
   111      ],
   112      "name": "transfer",
   113      "outputs": [],
   114      "type": "function"
   115    },
   116    {
   117      "constant": false,
   118      "inputs": [
   119        {
   120          "name": "_name",
   121          "type": "bytes32"
   122        },
   123        {
   124          "name": "_registrar",
   125          "type": "address"
   126        }
   127      ],
   128      "name": "setSubRegistrar",
   129      "outputs": [],
   130      "type": "function"
   131    },
   132    {
   133      "constant": false,
   134      "inputs": [],
   135      "name": "Registrar",
   136      "outputs": [],
   137      "type": "function"
   138    },
   139    {
   140      "constant": false,
   141      "inputs": [
   142        {
   143          "name": "_name",
   144          "type": "bytes32"
   145        },
   146        {
   147          "name": "_a",
   148          "type": "address"
   149        },
   150        {
   151          "name": "_primary",
   152          "type": "bool"
   153        }
   154      ],
   155      "name": "setAddress",
   156      "outputs": [],
   157      "type": "function"
   158    },
   159    {
   160      "constant": false,
   161      "inputs": [
   162        {
   163          "name": "_name",
   164          "type": "bytes32"
   165        },
   166        {
   167          "name": "_content",
   168          "type": "bytes32"
   169        }
   170      ],
   171      "name": "setContent",
   172      "outputs": [],
   173      "type": "function"
   174    },
   175    {
   176      "constant": false,
   177      "inputs": [
   178        {
   179          "name": "_name",
   180          "type": "bytes32"
   181        }
   182      ],
   183      "name": "disown",
   184      "outputs": [],
   185      "type": "function"
   186    },
   187    {
   188      "anonymous": false,
   189      "inputs": [
   190        {
   191          "indexed": true,
   192          "name": "_name",
   193          "type": "bytes32"
   194        },
   195        {
   196          "indexed": false,
   197          "name": "_winner",
   198          "type": "address"
   199        }
   200      ],
   201      "name": "AuctionEnded",
   202      "type": "event"
   203    },
   204    {
   205      "anonymous": false,
   206      "inputs": [
   207        {
   208          "indexed": true,
   209          "name": "_name",
   210          "type": "bytes32"
   211        },
   212        {
   213          "indexed": false,
   214          "name": "_bidder",
   215          "type": "address"
   216        },
   217        {
   218          "indexed": false,
   219          "name": "_value",
   220          "type": "uint256"
   221        }
   222      ],
   223      "name": "NewBid",
   224      "type": "event"
   225    },
   226    {
   227      "anonymous": false,
   228      "inputs": [
   229        {
   230          "indexed": true,
   231          "name": "name",
   232          "type": "bytes32"
   233        }
   234      ],
   235      "name": "Changed",
   236      "type": "event"
   237    },
   238    {
   239      "anonymous": false,
   240      "inputs": [
   241        {
   242          "indexed": true,
   243          "name": "name",
   244          "type": "bytes32"
   245        },
   246        {
   247          "indexed": true,
   248          "name": "addr",
   249          "type": "address"
   250        }
   251      ],
   252      "name": "PrimaryChanged",
   253      "type": "event"
   254    }
   255  ]
   256  
   257  },{}],2:[function(require,module,exports){
   258  module.exports=[
   259    {
   260      "constant": true,
   261      "inputs": [
   262        {
   263          "name": "_name",
   264          "type": "bytes32"
   265        }
   266      ],
   267      "name": "owner",
   268      "outputs": [
   269        {
   270          "name": "",
   271          "type": "address"
   272        }
   273      ],
   274      "type": "function"
   275    },
   276    {
   277      "constant": false,
   278      "inputs": [
   279        {
   280          "name": "_name",
   281          "type": "bytes32"
   282        },
   283        {
   284          "name": "_refund",
   285          "type": "address"
   286        }
   287      ],
   288      "name": "disown",
   289      "outputs": [],
   290      "type": "function"
   291    },
   292    {
   293      "constant": true,
   294      "inputs": [
   295        {
   296          "name": "_name",
   297          "type": "bytes32"
   298        }
   299      ],
   300      "name": "addr",
   301      "outputs": [
   302        {
   303          "name": "",
   304          "type": "address"
   305        }
   306      ],
   307      "type": "function"
   308    },
   309    {
   310      "constant": false,
   311      "inputs": [
   312        {
   313          "name": "_name",
   314          "type": "bytes32"
   315        }
   316      ],
   317      "name": "reserve",
   318      "outputs": [],
   319      "type": "function"
   320    },
   321    {
   322      "constant": false,
   323      "inputs": [
   324        {
   325          "name": "_name",
   326          "type": "bytes32"
   327        },
   328        {
   329          "name": "_newOwner",
   330          "type": "address"
   331        }
   332      ],
   333      "name": "transfer",
   334      "outputs": [],
   335      "type": "function"
   336    },
   337    {
   338      "constant": false,
   339      "inputs": [
   340        {
   341          "name": "_name",
   342          "type": "bytes32"
   343        },
   344        {
   345          "name": "_a",
   346          "type": "address"
   347        }
   348      ],
   349      "name": "setAddr",
   350      "outputs": [],
   351      "type": "function"
   352    },
   353    {
   354      "anonymous": false,
   355      "inputs": [
   356        {
   357          "indexed": true,
   358          "name": "name",
   359          "type": "bytes32"
   360        }
   361      ],
   362      "name": "Changed",
   363      "type": "event"
   364    }
   365  ]
   366  
   367  },{}],3:[function(require,module,exports){
   368  module.exports=[
   369    {
   370      "constant": false,
   371      "inputs": [
   372        {
   373          "name": "from",
   374          "type": "bytes32"
   375        },
   376        {
   377          "name": "to",
   378          "type": "address"
   379        },
   380        {
   381          "name": "value",
   382          "type": "uint256"
   383        }
   384      ],
   385      "name": "transfer",
   386      "outputs": [],
   387      "type": "function"
   388    },
   389    {
   390      "constant": false,
   391      "inputs": [
   392        {
   393          "name": "from",
   394          "type": "bytes32"
   395        },
   396        {
   397          "name": "to",
   398          "type": "address"
   399        },
   400        {
   401          "name": "indirectId",
   402          "type": "bytes32"
   403        },
   404        {
   405          "name": "value",
   406          "type": "uint256"
   407        }
   408      ],
   409      "name": "icapTransfer",
   410      "outputs": [],
   411      "type": "function"
   412    },
   413    {
   414      "constant": false,
   415      "inputs": [
   416        {
   417          "name": "to",
   418          "type": "bytes32"
   419        }
   420      ],
   421      "name": "deposit",
   422      "outputs": [],
   423      "payable": true,
   424      "type": "function"
   425    },
   426    {
   427      "anonymous": false,
   428      "inputs": [
   429        {
   430          "indexed": true,
   431          "name": "from",
   432          "type": "address"
   433        },
   434        {
   435          "indexed": false,
   436          "name": "value",
   437          "type": "uint256"
   438        }
   439      ],
   440      "name": "AnonymousDeposit",
   441      "type": "event"
   442    },
   443    {
   444      "anonymous": false,
   445      "inputs": [
   446        {
   447          "indexed": true,
   448          "name": "from",
   449          "type": "address"
   450        },
   451        {
   452          "indexed": true,
   453          "name": "to",
   454          "type": "bytes32"
   455        },
   456        {
   457          "indexed": false,
   458          "name": "value",
   459          "type": "uint256"
   460        }
   461      ],
   462      "name": "Deposit",
   463      "type": "event"
   464    },
   465    {
   466      "anonymous": false,
   467      "inputs": [
   468        {
   469          "indexed": true,
   470          "name": "from",
   471          "type": "bytes32"
   472        },
   473        {
   474          "indexed": true,
   475          "name": "to",
   476          "type": "address"
   477        },
   478        {
   479          "indexed": false,
   480          "name": "value",
   481          "type": "uint256"
   482        }
   483      ],
   484      "name": "Transfer",
   485      "type": "event"
   486    },
   487    {
   488      "anonymous": false,
   489      "inputs": [
   490        {
   491          "indexed": true,
   492          "name": "from",
   493          "type": "bytes32"
   494        },
   495        {
   496          "indexed": true,
   497          "name": "to",
   498          "type": "address"
   499        },
   500        {
   501          "indexed": false,
   502          "name": "indirectId",
   503          "type": "bytes32"
   504        },
   505        {
   506          "indexed": false,
   507          "name": "value",
   508          "type": "uint256"
   509        }
   510      ],
   511      "name": "IcapTransfer",
   512      "type": "event"
   513    }
   514  ]
   515  
   516  },{}],4:[function(require,module,exports){
   517  var f = require('./formatters');
   518  var HyperionType = require('./type');
   519  
   520  /**
   521   * HyperionTypeAddress is a prototype that represents address type
   522   * It matches:
   523   * address
   524   * address[]
   525   * address[4]
   526   * address[][]
   527   * address[3][]
   528   * address[][6][], ...
   529   */
   530  var HyperionTypeAddress = function () {
   531      this._inputFormatter = f.formatInputInt;
   532      this._outputFormatter = f.formatOutputAddress;
   533  };
   534  
   535  HyperionTypeAddress.prototype = new HyperionType({});
   536  HyperionTypeAddress.prototype.constructor = HyperionTypeAddress;
   537  
   538  HyperionTypeAddress.prototype.isType = function (name) {
   539      return !!name.match(/address(\[([0-9]*)\])?/);
   540  };
   541  
   542  module.exports = HyperionTypeAddress;
   543  
   544  },{"./formatters":9,"./type":14}],5:[function(require,module,exports){
   545  var f = require('./formatters');
   546  var HyperionType = require('./type');
   547  
   548  /**
   549   * HyperionTypeBool is a prototype that represents bool type
   550   * It matches:
   551   * bool
   552   * bool[]
   553   * bool[4]
   554   * bool[][]
   555   * bool[3][]
   556   * bool[][6][], ...
   557   */
   558  var HyperionTypeBool = function () {
   559      this._inputFormatter = f.formatInputBool;
   560      this._outputFormatter = f.formatOutputBool;
   561  };
   562  
   563  HyperionTypeBool.prototype = new HyperionType({});
   564  HyperionTypeBool.prototype.constructor = HyperionTypeBool;
   565  
   566  HyperionTypeBool.prototype.isType = function (name) {
   567      return !!name.match(/^bool(\[([0-9]*)\])*$/);
   568  };
   569  
   570  module.exports = HyperionTypeBool;
   571  
   572  },{"./formatters":9,"./type":14}],6:[function(require,module,exports){
   573  var f = require('./formatters');
   574  var HyperionType = require('./type');
   575  
   576  /**
   577   * HyperionTypeBytes is a prototype that represents the bytes type.
   578   * It matches:
   579   * bytes
   580   * bytes[]
   581   * bytes[4]
   582   * bytes[][]
   583   * bytes[3][]
   584   * bytes[][6][], ...
   585   * bytes32
   586   * bytes8[4]
   587   * bytes[3][]
   588   */
   589  var HyperionTypeBytes = function () {
   590      this._inputFormatter = f.formatInputBytes;
   591      this._outputFormatter = f.formatOutputBytes;
   592  };
   593  
   594  HyperionTypeBytes.prototype = new HyperionType({});
   595  HyperionTypeBytes.prototype.constructor = HyperionTypeBytes;
   596  
   597  HyperionTypeBytes.prototype.isType = function (name) {
   598      return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
   599  };
   600  
   601  module.exports = HyperionTypeBytes;
   602  
   603  },{"./formatters":9,"./type":14}],7:[function(require,module,exports){
   604  /*
   605      This file is part of web3.js.
   606  
   607      web3.js is free software: you can redistribute it and/or modify
   608      it under the terms of the GNU Lesser General Public License as published by
   609      the Free Software Foundation, either version 3 of the License, or
   610      (at your option) any later version.
   611  
   612      web3.js is distributed in the hope that it will be useful,
   613      but WITHOUT ANY WARRANTY; without even the implied warranty of
   614      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   615      GNU Lesser General Public License for more details.
   616  
   617      You should have received a copy of the GNU Lesser General Public License
   618      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
   619  */
   620  /**
   621   * @file coder.js
   622   * @author Marek Kotewicz <marek@ethdev.com>
   623   * @date 2015
   624   */
   625  
   626  var f = require('./formatters');
   627  
   628  var HyperionTypeAddress = require('./address');
   629  var HyperionTypeBool = require('./bool');
   630  var HyperionTypeInt = require('./int');
   631  var HyperionTypeUInt = require('./uint');
   632  var HyperionTypeDynamicBytes = require('./dynamicbytes');
   633  var HyperionTypeString = require('./string');
   634  var HyperionTypeReal = require('./real');
   635  var HyperionTypeUReal = require('./ureal');
   636  var HyperionTypeBytes = require('./bytes');
   637  
   638  var isDynamic = function (hyperionType, type) {
   639     return hyperionType.isDynamicType(type) ||
   640            hyperionType.isDynamicArray(type);
   641  };
   642  
   643  /**
   644   * HyperionCoder prototype should be used to encode/decode hyperion params of any type
   645   */
   646  var HyperionCoder = function (types) {
   647      this._types = types;
   648  };
   649  
   650  /**
   651   * This method should be used to transform type to HyperionType
   652   *
   653   * @method _requireType
   654   * @param {String} type
   655   * @returns {HyperionType}
   656   * @throws {Error} throws if no matching type is found
   657   */
   658  HyperionCoder.prototype._requireType = function (type) {
   659      var hyperionType = this._types.filter(function (t) {
   660          return t.isType(type);
   661      })[0];
   662  
   663      if (!hyperionType) {
   664          throw Error('invalid hyperion type!: ' + type);
   665      }
   666  
   667      return hyperionType;
   668  };
   669  
   670  /**
   671   * Should be used to encode plain param
   672   *
   673   * @method encodeParam
   674   * @param {String} type
   675   * @param {Object} plain param
   676   * @return {String} encoded plain param
   677   */
   678  HyperionCoder.prototype.encodeParam = function (type, param) {
   679      return this.encodeParams([type], [param]);
   680  };
   681  
   682  /**
   683   * Should be used to encode list of params
   684   *
   685   * @method encodeParams
   686   * @param {Array} types
   687   * @param {Array} params
   688   * @return {String} encoded list of params
   689   */
   690  HyperionCoder.prototype.encodeParams = function (types, params) {
   691      var hyperionTypes = this.getHyperionTypes(types);
   692  
   693      var encodeds = hyperionTypes.map(function (hyperionType, index) {
   694          return hyperionType.encode(params[index], types[index]);
   695      });
   696  
   697      var dynamicOffset = hyperionTypes.reduce(function (acc, hyperionType, index) {
   698          var staticPartLength = hyperionType.staticPartLength(types[index]);
   699          var roundedStaticPartLength = Math.floor((staticPartLength + 31) / 32) * 32;
   700  
   701          return acc + (isDynamic(hyperionTypes[index], types[index]) ?
   702              32 :
   703              roundedStaticPartLength);
   704      }, 0);
   705  
   706      var result = this.encodeMultiWithOffset(types, hyperionTypes, encodeds, dynamicOffset);
   707  
   708      return result;
   709  };
   710  
   711  HyperionCoder.prototype.encodeMultiWithOffset = function (types, hyperionTypes, encodeds, dynamicOffset) {
   712      var result = "";
   713      var self = this;
   714  
   715      types.forEach(function (type, i) {
   716          if (isDynamic(hyperionTypes[i], types[i])) {
   717              result += f.formatInputInt(dynamicOffset).encode();
   718              var e = self.encodeWithOffset(types[i], hyperionTypes[i], encodeds[i], dynamicOffset);
   719              dynamicOffset += e.length / 2;
   720          } else {
   721              // don't add length to dynamicOffset. it's already counted
   722              result += self.encodeWithOffset(types[i], hyperionTypes[i], encodeds[i], dynamicOffset);
   723          }
   724  
   725          // TODO: figure out nested arrays
   726      });
   727  
   728      types.forEach(function (type, i) {
   729          if (isDynamic(hyperionTypes[i], types[i])) {
   730              var e = self.encodeWithOffset(types[i], hyperionTypes[i], encodeds[i], dynamicOffset);
   731              dynamicOffset += e.length / 2;
   732              result += e;
   733          }
   734      });
   735      return result;
   736  };
   737  
   738  // TODO: refactor whole encoding!
   739  HyperionCoder.prototype.encodeWithOffset = function (type, hyperionType, encoded, offset) {
   740      var self = this;
   741      if (hyperionType.isDynamicArray(type)) {
   742          return (function () {
   743              // offset was already set
   744              var nestedName = hyperionType.nestedName(type);
   745              var nestedStaticPartLength = hyperionType.staticPartLength(nestedName);
   746              var result = encoded[0];
   747  
   748              (function () {
   749                  var previousLength = 2; // in int
   750                  if (hyperionType.isDynamicArray(nestedName)) {
   751                      for (var i = 1; i < encoded.length; i++) {
   752                          previousLength += +(encoded[i - 1])[0] || 0;
   753                          result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
   754                      }
   755                  }
   756              })();
   757  
   758              // first element is length, skip it
   759              (function () {
   760                  for (var i = 0; i < encoded.length - 1; i++) {
   761                      var additionalOffset = result / 2;
   762                      result += self.encodeWithOffset(nestedName, hyperionType, encoded[i + 1], offset +  additionalOffset);
   763                  }
   764              })();
   765  
   766              return result;
   767          })();
   768  
   769      } else if (hyperionType.isStaticArray(type)) {
   770          return (function () {
   771              var nestedName = hyperionType.nestedName(type);
   772              var nestedStaticPartLength = hyperionType.staticPartLength(nestedName);
   773              var result = "";
   774  
   775  
   776              if (hyperionType.isDynamicArray(nestedName)) {
   777                  (function () {
   778                      var previousLength = 0; // in int
   779                      for (var i = 0; i < encoded.length; i++) {
   780                          // calculate length of previous item
   781                          previousLength += +(encoded[i - 1] || [])[0] || 0;
   782                          result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
   783                      }
   784                  })();
   785              }
   786  
   787              (function () {
   788                  for (var i = 0; i < encoded.length; i++) {
   789                      var additionalOffset = result / 2;
   790                      result += self.encodeWithOffset(nestedName, hyperionType, encoded[i], offset + additionalOffset);
   791                  }
   792              })();
   793  
   794              return result;
   795          })();
   796      }
   797  
   798      return encoded;
   799  };
   800  
   801  /**
   802   * Should be used to decode bytes to plain param
   803   *
   804   * @method decodeParam
   805   * @param {String} type
   806   * @param {String} bytes
   807   * @return {Object} plain param
   808   */
   809  HyperionCoder.prototype.decodeParam = function (type, bytes) {
   810      return this.decodeParams([type], bytes)[0];
   811  };
   812  
   813  /**
   814   * Should be used to decode list of params
   815   *
   816   * @method decodeParam
   817   * @param {Array} types
   818   * @param {String} bytes
   819   * @return {Array} array of plain params
   820   */
   821  HyperionCoder.prototype.decodeParams = function (types, bytes) {
   822      var hyperionTypes = this.getHyperionTypes(types);
   823      var offsets = this.getOffsets(types, hyperionTypes);
   824  
   825      return hyperionTypes.map(function (hyperionType, index) {
   826          return hyperionType.decode(bytes, offsets[index],  types[index], index);
   827      });
   828  };
   829  
   830  HyperionCoder.prototype.getOffsets = function (types, hyperionTypes) {
   831      var lengths =  hyperionTypes.map(function (hyperionType, index) {
   832          return hyperionType.staticPartLength(types[index]);
   833      });
   834  
   835      for (var i = 1; i < lengths.length; i++) {
   836           // sum with length of previous element
   837          lengths[i] += lengths[i - 1];
   838      }
   839  
   840      return lengths.map(function (length, index) {
   841          // remove the current length, so the length is sum of previous elements
   842          var staticPartLength = hyperionTypes[index].staticPartLength(types[index]);
   843          return length - staticPartLength;
   844      });
   845  };
   846  
   847  HyperionCoder.prototype.getHyperionTypes = function (types) {
   848      var self = this;
   849      return types.map(function (type) {
   850          return self._requireType(type);
   851      });
   852  };
   853  
   854  var coder = new HyperionCoder([
   855      new HyperionTypeAddress(),
   856      new HyperionTypeBool(),
   857      new HyperionTypeInt(),
   858      new HyperionTypeUInt(),
   859      new HyperionTypeDynamicBytes(),
   860      new HyperionTypeBytes(),
   861      new HyperionTypeString(),
   862      new HyperionTypeReal(),
   863      new HyperionTypeUReal()
   864  ]);
   865  
   866  module.exports = coder;
   867  
   868  },{"./address":4,"./bool":5,"./bytes":6,"./dynamicbytes":8,"./formatters":9,"./int":10,"./real":12,"./string":13,"./uint":15,"./ureal":16}],8:[function(require,module,exports){
   869  var f = require('./formatters');
   870  var HyperionType = require('./type');
   871  
   872  var HyperionTypeDynamicBytes = function () {
   873      this._inputFormatter = f.formatInputDynamicBytes;
   874      this._outputFormatter = f.formatOutputDynamicBytes;
   875  };
   876  
   877  HyperionTypeDynamicBytes.prototype = new HyperionType({});
   878  HyperionTypeDynamicBytes.prototype.constructor = HyperionTypeDynamicBytes;
   879  
   880  HyperionTypeDynamicBytes.prototype.isType = function (name) {
   881      return !!name.match(/^bytes(\[([0-9]*)\])*$/);
   882  };
   883  
   884  HyperionTypeDynamicBytes.prototype.isDynamicType = function () {
   885      return true;
   886  };
   887  
   888  module.exports = HyperionTypeDynamicBytes;
   889  
   890  },{"./formatters":9,"./type":14}],9:[function(require,module,exports){
   891  /*
   892      This file is part of web3.js.
   893  
   894      web3.js is free software: you can redistribute it and/or modify
   895      it under the terms of the GNU Lesser General Public License as published by
   896      the Free Software Foundation, either version 3 of the License, or
   897      (at your option) any later version.
   898  
   899      web3.js is distributed in the hope that it will be useful,
   900      but WITHOUT ANY WARRANTY; without even the implied warranty of
   901      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   902      GNU Lesser General Public License for more details.
   903  
   904      You should have received a copy of the GNU Lesser General Public License
   905      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
   906  */
   907  /**
   908   * @file formatters.js
   909   * @author Marek Kotewicz <marek@ethdev.com>
   910   * @date 2015
   911   */
   912  
   913  var BigNumber = require('bignumber.js');
   914  var utils = require('../utils/utils');
   915  var c = require('../utils/config');
   916  var HyperionParam = require('./param');
   917  
   918  
   919  /**
   920   * Formats input value to byte representation of int
   921   * If value is negative, return it's two's complement
   922   * If the value is floating point, round it down
   923   *
   924   * @method formatInputInt
   925   * @param {String|Number|BigNumber} value that needs to be formatted
   926   * @returns {HyperionParam}
   927   */
   928  var formatInputInt = function (value) {
   929      BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);
   930      var result = utils.padLeft(utils.toTwosComplement(value).toString(16), 64);
   931      return new HyperionParam(result);
   932  };
   933  
   934  /**
   935   * Formats input bytes
   936   *
   937   * @method formatInputBytes
   938   * @param {String}
   939   * @returns {HyperionParam}
   940   */
   941  var formatInputBytes = function (value) {
   942      var result = utils.toHex(value).substr(2);
   943      var l = Math.floor((result.length + 63) / 64);
   944      result = utils.padRight(result, l * 64);
   945      return new HyperionParam(result);
   946  };
   947  
   948  /**
   949   * Formats input bytes
   950   *
   951   * @method formatDynamicInputBytes
   952   * @param {String}
   953   * @returns {HyperionParam}
   954   */
   955  var formatInputDynamicBytes = function (value) {
   956      var result = utils.toHex(value).substr(2);
   957      var length = result.length / 2;
   958      var l = Math.floor((result.length + 63) / 64);
   959      result = utils.padRight(result, l * 64);
   960      return new HyperionParam(formatInputInt(length).value + result);
   961  };
   962  
   963  /**
   964   * Formats input value to byte representation of string
   965   *
   966   * @method formatInputString
   967   * @param {String}
   968   * @returns {HyperionParam}
   969   */
   970  var formatInputString = function (value) {
   971      var result = utils.fromUtf8(value).substr(2);
   972      var length = result.length / 2;
   973      var l = Math.floor((result.length + 63) / 64);
   974      result = utils.padRight(result, l * 64);
   975      return new HyperionParam(formatInputInt(length).value + result);
   976  };
   977  
   978  /**
   979   * Formats input value to byte representation of bool
   980   *
   981   * @method formatInputBool
   982   * @param {Boolean}
   983   * @returns {HyperionParam}
   984   */
   985  var formatInputBool = function (value) {
   986      var result = '000000000000000000000000000000000000000000000000000000000000000' + (value ?  '1' : '0');
   987      return new HyperionParam(result);
   988  };
   989  
   990  /**
   991   * Formats input value to byte representation of real
   992   * Values are multiplied by 2^m and encoded as integers
   993   *
   994   * @method formatInputReal
   995   * @param {String|Number|BigNumber}
   996   * @returns {HyperionParam}
   997   */
   998  var formatInputReal = function (value) {
   999      return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128)));
  1000  };
  1001  
  1002  /**
  1003   * Check if input value is negative
  1004   *
  1005   * @method signedIsNegative
  1006   * @param {String} value is hex format
  1007   * @returns {Boolean} true if it is negative, otherwise false
  1008   */
  1009  var signedIsNegative = function (value) {
  1010      return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1';
  1011  };
  1012  
  1013  /**
  1014   * Formats right-aligned output bytes to int
  1015   *
  1016   * @method formatOutputInt
  1017   * @param {HyperionParam} param
  1018   * @returns {BigNumber} right-aligned output bytes formatted to big number
  1019   */
  1020  var formatOutputInt = function (param) {
  1021      var value = param.staticPart() || "0";
  1022  
  1023      // check if it's negative number
  1024      // it is, return two's complement
  1025      if (signedIsNegative(value)) {
  1026          return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);
  1027      }
  1028      return new BigNumber(value, 16);
  1029  };
  1030  
  1031  /**
  1032   * Formats right-aligned output bytes to uint
  1033   *
  1034   * @method formatOutputUInt
  1035   * @param {HyperionParam}
  1036   * @returns {BigNumeber} right-aligned output bytes formatted to uint
  1037   */
  1038  var formatOutputUInt = function (param) {
  1039      var value = param.staticPart() || "0";
  1040      return new BigNumber(value, 16);
  1041  };
  1042  
  1043  /**
  1044   * Formats right-aligned output bytes to real
  1045   *
  1046   * @method formatOutputReal
  1047   * @param {HyperionParam}
  1048   * @returns {BigNumber} input bytes formatted to real
  1049   */
  1050  var formatOutputReal = function (param) {
  1051      return formatOutputInt(param).dividedBy(new BigNumber(2).pow(128));
  1052  };
  1053  
  1054  /**
  1055   * Formats right-aligned output bytes to ureal
  1056   *
  1057   * @method formatOutputUReal
  1058   * @param {HyperionParam}
  1059   * @returns {BigNumber} input bytes formatted to ureal
  1060   */
  1061  var formatOutputUReal = function (param) {
  1062      return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
  1063  };
  1064  
  1065  /**
  1066   * Should be used to format output bool
  1067   *
  1068   * @method formatOutputBool
  1069   * @param {HyperionParam}
  1070   * @returns {Boolean} right-aligned input bytes formatted to bool
  1071   */
  1072  var formatOutputBool = function (param) {
  1073      return param.staticPart() === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false;
  1074  };
  1075  
  1076  /**
  1077   * Should be used to format output bytes
  1078   *
  1079   * @method formatOutputBytes
  1080   * @param {HyperionParam} left-aligned hex representation of string
  1081   * @param {String} name type name
  1082   * @returns {String} hex string
  1083   */
  1084  var formatOutputBytes = function (param, name) {
  1085      var matches = name.match(/^bytes([0-9]*)/);
  1086      var size = parseInt(matches[1]);
  1087      return '0x' + param.staticPart().slice(0, 2 * size);
  1088  };
  1089  
  1090  /**
  1091   * Should be used to format output bytes
  1092   *
  1093   * @method formatOutputDynamicBytes
  1094   * @param {HyperionParam} left-aligned hex representation of string
  1095   * @returns {String} hex string
  1096   */
  1097  var formatOutputDynamicBytes = function (param) {
  1098      var length = (new BigNumber(param.dynamicPart().slice(0, 64), 16)).toNumber() * 2;
  1099      return '0x' + param.dynamicPart().substr(64, length);
  1100  };
  1101  
  1102  /**
  1103   * Should be used to format output string
  1104   *
  1105   * @method formatOutputString
  1106   * @param {HyperionParam} left-aligned hex representation of string
  1107   * @returns {String} ascii string
  1108   */
  1109  var formatOutputString = function (param) {
  1110      var length = (new BigNumber(param.dynamicPart().slice(0, 64), 16)).toNumber() * 2;
  1111      return utils.toUtf8(param.dynamicPart().substr(64, length));
  1112  };
  1113  
  1114  /**
  1115   * Should be used to format output address
  1116   *
  1117   * @method formatOutputAddress
  1118   * @param {HyperionParam} right-aligned input bytes
  1119   * @returns {String} address
  1120   */
  1121  var formatOutputAddress = function (param) {
  1122      var value = param.staticPart();
  1123      return "Z" + value.slice(value.length - 40, value.length);
  1124  };
  1125  
  1126  module.exports = {
  1127      formatInputInt: formatInputInt,
  1128      formatInputBytes: formatInputBytes,
  1129      formatInputDynamicBytes: formatInputDynamicBytes,
  1130      formatInputString: formatInputString,
  1131      formatInputBool: formatInputBool,
  1132      formatInputReal: formatInputReal,
  1133      formatOutputInt: formatOutputInt,
  1134      formatOutputUInt: formatOutputUInt,
  1135      formatOutputReal: formatOutputReal,
  1136      formatOutputUReal: formatOutputUReal,
  1137      formatOutputBool: formatOutputBool,
  1138      formatOutputBytes: formatOutputBytes,
  1139      formatOutputDynamicBytes: formatOutputDynamicBytes,
  1140      formatOutputString: formatOutputString,
  1141      formatOutputAddress: formatOutputAddress
  1142  };
  1143  
  1144  },{"../utils/config":18,"../utils/utils":20,"./param":11,"bignumber.js":"bignumber.js"}],10:[function(require,module,exports){
  1145  var f = require('./formatters');
  1146  var HyperionType = require('./type');
  1147  
  1148  /**
  1149   * HyperionTypeInt is a prototype that represents int type
  1150   * It matches:
  1151   * int
  1152   * int[]
  1153   * int[4]
  1154   * int[][]
  1155   * int[3][]
  1156   * int[][6][], ...
  1157   * int32
  1158   * int64[]
  1159   * int8[4]
  1160   * int256[][]
  1161   * int[3][]
  1162   * int64[][6][], ...
  1163   */
  1164  var HyperionTypeInt = function () {
  1165      this._inputFormatter = f.formatInputInt;
  1166      this._outputFormatter = f.formatOutputInt;
  1167  };
  1168  
  1169  HyperionTypeInt.prototype = new HyperionType({});
  1170  HyperionTypeInt.prototype.constructor = HyperionTypeInt;
  1171  
  1172  HyperionTypeInt.prototype.isType = function (name) {
  1173      return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/);
  1174  };
  1175  
  1176  module.exports = HyperionTypeInt;
  1177  
  1178  },{"./formatters":9,"./type":14}],11:[function(require,module,exports){
  1179  /*
  1180      This file is part of web3.js.
  1181  
  1182      web3.js is free software: you can redistribute it and/or modify
  1183      it under the terms of the GNU Lesser General Public License as published by
  1184      the Free Software Foundation, either version 3 of the License, or
  1185      (at your option) any later version.
  1186  
  1187      web3.js is distributed in the hope that it will be useful,
  1188      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1189      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1190      GNU Lesser General Public License for more details.
  1191  
  1192      You should have received a copy of the GNU Lesser General Public License
  1193      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1194  */
  1195  /** 
  1196   * @file param.js
  1197   * @author Marek Kotewicz <marek@ethdev.com>
  1198   * @date 2015
  1199   */
  1200  
  1201  var utils = require('../utils/utils');
  1202  
  1203  /**
  1204   * HyperionParam object prototype.
  1205   * Should be used when encoding, decoding hyperion bytes
  1206   */
  1207  var HyperionParam = function (value, offset) {
  1208      this.value = value || '';
  1209      this.offset = offset; // offset in bytes
  1210  };
  1211  
  1212  /**
  1213   * This method should be used to get length of params's dynamic part
  1214   * 
  1215   * @method dynamicPartLength
  1216   * @returns {Number} length of dynamic part (in bytes)
  1217   */
  1218  HyperionParam.prototype.dynamicPartLength = function () {
  1219      return this.dynamicPart().length / 2;
  1220  };
  1221  
  1222  /**
  1223   * This method should be used to create copy of hyperion param with different offset
  1224   *
  1225   * @method withOffset
  1226   * @param {Number} offset length in bytes
  1227   * @returns {HyperionParam} new hyperion param with applied offset
  1228   */
  1229  HyperionParam.prototype.withOffset = function (offset) {
  1230      return new HyperionParam(this.value, offset);
  1231  };
  1232  
  1233  /**
  1234   * This method should be used to combine hyperion params together
  1235   * eg. when appending an array
  1236   *
  1237   * @method combine
  1238   * @param {HyperionParam} param with which we should combine
  1239   * @param {HyperionParam} result of combination
  1240   */
  1241  HyperionParam.prototype.combine = function (param) {
  1242      return new HyperionParam(this.value + param.value); 
  1243  };
  1244  
  1245  /**
  1246   * This method should be called to check if param has dynamic size.
  1247   * If it has, it returns true, otherwise false
  1248   *
  1249   * @method isDynamic
  1250   * @returns {Boolean}
  1251   */
  1252  HyperionParam.prototype.isDynamic = function () {
  1253      return this.offset !== undefined;
  1254  };
  1255  
  1256  /**
  1257   * This method should be called to transform offset to bytes
  1258   *
  1259   * @method offsetAsBytes
  1260   * @returns {String} bytes representation of offset
  1261   */
  1262  HyperionParam.prototype.offsetAsBytes = function () {
  1263      return !this.isDynamic() ? '' : utils.padLeft(utils.toTwosComplement(this.offset).toString(16), 64);
  1264  };
  1265  
  1266  /**
  1267   * This method should be called to get static part of param
  1268   *
  1269   * @method staticPart
  1270   * @returns {String} offset if it is a dynamic param, otherwise value
  1271   */
  1272  HyperionParam.prototype.staticPart = function () {
  1273      if (!this.isDynamic()) {
  1274          return this.value; 
  1275      } 
  1276      return this.offsetAsBytes();
  1277  };
  1278  
  1279  /**
  1280   * This method should be called to get dynamic part of param
  1281   *
  1282   * @method dynamicPart
  1283   * @returns {String} returns a value if it is a dynamic param, otherwise empty string
  1284   */
  1285  HyperionParam.prototype.dynamicPart = function () {
  1286      return this.isDynamic() ? this.value : '';
  1287  };
  1288  
  1289  /**
  1290   * This method should be called to encode param
  1291   *
  1292   * @method encode
  1293   * @returns {String}
  1294   */
  1295  HyperionParam.prototype.encode = function () {
  1296      return this.staticPart() + this.dynamicPart();
  1297  };
  1298  
  1299  /**
  1300   * This method should be called to encode array of params
  1301   *
  1302   * @method encodeList
  1303   * @param {Array[HyperionParam]} params
  1304   * @returns {String}
  1305   */
  1306  HyperionParam.encodeList = function (params) {
  1307      
  1308      // updating offsets
  1309      var totalOffset = params.length * 32;
  1310      var offsetParams = params.map(function (param) {
  1311          if (!param.isDynamic()) {
  1312              return param;
  1313          }
  1314          var offset = totalOffset;
  1315          totalOffset += param.dynamicPartLength();
  1316          return param.withOffset(offset);
  1317      });
  1318  
  1319      // encode everything!
  1320      return offsetParams.reduce(function (result, param) {
  1321          return result + param.dynamicPart();
  1322      }, offsetParams.reduce(function (result, param) {
  1323          return result + param.staticPart();
  1324      }, ''));
  1325  };
  1326  
  1327  
  1328  
  1329  module.exports = HyperionParam;
  1330  
  1331  
  1332  },{"../utils/utils":20}],12:[function(require,module,exports){
  1333  var f = require('./formatters');
  1334  var HyperionType = require('./type');
  1335  
  1336  /**
  1337   * HyperionTypeReal is a prototype that represents real type
  1338   * It matches:
  1339   * real
  1340   * real[]
  1341   * real[4]
  1342   * real[][]
  1343   * real[3][]
  1344   * real[][6][], ...
  1345   * real32
  1346   * real64[]
  1347   * real8[4]
  1348   * real256[][]
  1349   * real[3][]
  1350   * real64[][6][], ...
  1351   */
  1352  var HyperionTypeReal = function () {
  1353      this._inputFormatter = f.formatInputReal;
  1354      this._outputFormatter = f.formatOutputReal;
  1355  };
  1356  
  1357  HyperionTypeReal.prototype = new HyperionType({});
  1358  HyperionTypeReal.prototype.constructor = HyperionTypeReal;
  1359  
  1360  HyperionTypeReal.prototype.isType = function (name) {
  1361      return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/);
  1362  };
  1363  
  1364  module.exports = HyperionTypeReal;
  1365  
  1366  },{"./formatters":9,"./type":14}],13:[function(require,module,exports){
  1367  var f = require('./formatters');
  1368  var HyperionType = require('./type');
  1369  
  1370  var HyperionTypeString = function () {
  1371      this._inputFormatter = f.formatInputString;
  1372      this._outputFormatter = f.formatOutputString;
  1373  };
  1374  
  1375  HyperionTypeString.prototype = new HyperionType({});
  1376  HyperionTypeString.prototype.constructor = HyperionTypeString;
  1377  
  1378  HyperionTypeString.prototype.isType = function (name) {
  1379      return !!name.match(/^string(\[([0-9]*)\])*$/);
  1380  };
  1381  
  1382  HyperionTypeString.prototype.isDynamicType = function () {
  1383      return true;
  1384  };
  1385  
  1386  module.exports = HyperionTypeString;
  1387  
  1388  },{"./formatters":9,"./type":14}],14:[function(require,module,exports){
  1389  var f = require('./formatters');
  1390  var HyperionParam = require('./param');
  1391  
  1392  /**
  1393   * HyperionType prototype is used to encode/decode hyperion params of certain type
  1394   */
  1395  var HyperionType = function (config) {
  1396      this._inputFormatter = config.inputFormatter;
  1397      this._outputFormatter = config.outputFormatter;
  1398  };
  1399  
  1400  /**
  1401   * Should be used to determine if this HyperionType do match given name
  1402   *
  1403   * @method isType
  1404   * @param {String} name
  1405   * @return {Bool} true if type match this HyperionType, otherwise false
  1406   */
  1407  HyperionType.prototype.isType = function (name) {
  1408      throw "this method should be overrwritten for type " + name;
  1409  };
  1410  
  1411  /**
  1412   * Should be used to determine what is the length of static part in given type
  1413   *
  1414   * @method staticPartLength
  1415   * @param {String} name
  1416   * @return {Number} length of static part in bytes
  1417   */
  1418  HyperionType.prototype.staticPartLength = function (name) {
  1419      // If name isn't an array then treat it like a single element array.
  1420      return (this.nestedTypes(name) || ['[1]'])
  1421          .map(function (type) {
  1422              // the length of the nested array
  1423              return parseInt(type.slice(1, -1), 10) || 1;
  1424          })
  1425          .reduce(function (previous, current) {
  1426              return previous * current;
  1427          // all basic types are 32 bytes long
  1428          }, 32);
  1429  };
  1430  
  1431  /**
  1432   * Should be used to determine if type is dynamic array
  1433   * eg:
  1434   * "type[]" => true
  1435   * "type[4]" => false
  1436   *
  1437   * @method isDynamicArray
  1438   * @param {String} name
  1439   * @return {Bool} true if the type is dynamic array
  1440   */
  1441  HyperionType.prototype.isDynamicArray = function (name) {
  1442      var nestedTypes = this.nestedTypes(name);
  1443      return !!nestedTypes && !nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g);
  1444  };
  1445  
  1446  /**
  1447   * Should be used to determine if type is static array
  1448   * eg:
  1449   * "type[]" => false
  1450   * "type[4]" => true
  1451   *
  1452   * @method isStaticArray
  1453   * @param {String} name
  1454   * @return {Bool} true if the type is static array
  1455   */
  1456  HyperionType.prototype.isStaticArray = function (name) {
  1457      var nestedTypes = this.nestedTypes(name);
  1458      return !!nestedTypes && !!nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g);
  1459  };
  1460  
  1461  /**
  1462   * Should return length of static array
  1463   * eg.
  1464   * "int[32]" => 32
  1465   * "int256[14]" => 14
  1466   * "int[2][3]" => 3
  1467   * "int" => 1
  1468   * "int[1]" => 1
  1469   * "int[]" => 1
  1470   *
  1471   * @method staticArrayLength
  1472   * @param {String} name
  1473   * @return {Number} static array length
  1474   */
  1475  HyperionType.prototype.staticArrayLength = function (name) {
  1476      var nestedTypes = this.nestedTypes(name);
  1477      if (nestedTypes) {
  1478         return parseInt(nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g) || 1);
  1479      }
  1480      return 1;
  1481  };
  1482  
  1483  /**
  1484   * Should return nested type
  1485   * eg.
  1486   * "int[32]" => "int"
  1487   * "int256[14]" => "int256"
  1488   * "int[2][3]" => "int[2]"
  1489   * "int" => "int"
  1490   * "int[]" => "int"
  1491   *
  1492   * @method nestedName
  1493   * @param {String} name
  1494   * @return {String} nested name
  1495   */
  1496  HyperionType.prototype.nestedName = function (name) {
  1497      // remove last [] in name
  1498      var nestedTypes = this.nestedTypes(name);
  1499      if (!nestedTypes) {
  1500          return name;
  1501      }
  1502  
  1503      return name.substr(0, name.length - nestedTypes[nestedTypes.length - 1].length);
  1504  };
  1505  
  1506  /**
  1507   * Should return true if type has dynamic size by default
  1508   * such types are "string", "bytes"
  1509   *
  1510   * @method isDynamicType
  1511   * @param {String} name
  1512   * @return {Bool} true if is dynamic, otherwise false
  1513   */
  1514  HyperionType.prototype.isDynamicType = function () {
  1515      return false;
  1516  };
  1517  
  1518  /**
  1519   * Should return array of nested types
  1520   * eg.
  1521   * "int[2][3][]" => ["[2]", "[3]", "[]"]
  1522   * "int[] => ["[]"]
  1523   * "int" => null
  1524   *
  1525   * @method nestedTypes
  1526   * @param {String} name
  1527   * @return {Array} array of nested types
  1528   */
  1529  HyperionType.prototype.nestedTypes = function (name) {
  1530      // return list of strings eg. "[]", "[3]", "[]", "[2]"
  1531      return name.match(/(\[[0-9]*\])/g);
  1532  };
  1533  
  1534  /**
  1535   * Should be used to encode the value
  1536   *
  1537   * @method encode
  1538   * @param {Object} value
  1539   * @param {String} name
  1540   * @return {String} encoded value
  1541   */
  1542  HyperionType.prototype.encode = function (value, name) {
  1543      var self = this;
  1544      if (this.isDynamicArray(name)) {
  1545  
  1546          return (function () {
  1547              var length = value.length;                          // in int
  1548              var nestedName = self.nestedName(name);
  1549  
  1550              var result = [];
  1551              result.push(f.formatInputInt(length).encode());
  1552  
  1553              value.forEach(function (v) {
  1554                  result.push(self.encode(v, nestedName));
  1555              });
  1556  
  1557              return result;
  1558          })();
  1559  
  1560      } else if (this.isStaticArray(name)) {
  1561  
  1562          return (function () {
  1563              var length = self.staticArrayLength(name);          // in int
  1564              var nestedName = self.nestedName(name);
  1565  
  1566              var result = [];
  1567              for (var i = 0; i < length; i++) {
  1568                  result.push(self.encode(value[i], nestedName));
  1569              }
  1570  
  1571              return result;
  1572          })();
  1573  
  1574      }
  1575  
  1576      return this._inputFormatter(value, name).encode();
  1577  };
  1578  
  1579  /**
  1580   * Should be used to decode value from bytes
  1581   *
  1582   * @method decode
  1583   * @param {String} bytes
  1584   * @param {Number} offset in bytes
  1585   * @param {String} name type name
  1586   * @returns {Object} decoded value
  1587   */
  1588  HyperionType.prototype.decode = function (bytes, offset, name) {
  1589      var self = this;
  1590  
  1591      if (this.isDynamicArray(name)) {
  1592  
  1593          return (function () {
  1594              var arrayOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes
  1595              var length = parseInt('0x' + bytes.substr(arrayOffset * 2, 64)); // in int
  1596              var arrayStart = arrayOffset + 32; // array starts after length; // in bytes
  1597  
  1598              var nestedName = self.nestedName(name);
  1599              var nestedStaticPartLength = self.staticPartLength(nestedName);  // in bytes
  1600              var roundedNestedStaticPartLength = Math.floor((nestedStaticPartLength + 31) / 32) * 32;
  1601              var result = [];
  1602  
  1603              for (var i = 0; i < length * roundedNestedStaticPartLength; i += roundedNestedStaticPartLength) {
  1604                  result.push(self.decode(bytes, arrayStart + i, nestedName));
  1605              }
  1606  
  1607              return result;
  1608          })();
  1609  
  1610      } else if (this.isStaticArray(name)) {
  1611  
  1612          return (function () {
  1613              var length = self.staticArrayLength(name);                      // in int
  1614              var arrayStart = offset;                                        // in bytes
  1615  
  1616              var nestedName = self.nestedName(name);
  1617              var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes
  1618              var roundedNestedStaticPartLength = Math.floor((nestedStaticPartLength + 31) / 32) * 32;
  1619              var result = [];
  1620  
  1621              for (var i = 0; i < length * roundedNestedStaticPartLength; i += roundedNestedStaticPartLength) {
  1622                  result.push(self.decode(bytes, arrayStart + i, nestedName));
  1623              }
  1624  
  1625              return result;
  1626          })();
  1627      } else if (this.isDynamicType(name)) {
  1628  
  1629          return (function () {
  1630              var dynamicOffset = parseInt('0x' + bytes.substr(offset * 2, 64));      // in bytes
  1631              var length = parseInt('0x' + bytes.substr(dynamicOffset * 2, 64));      // in bytes
  1632              var roundedLength = Math.floor((length + 31) / 32);                     // in int
  1633              var param = new HyperionParam(bytes.substr(dynamicOffset * 2, ( 1 + roundedLength) * 64), 0);
  1634              return self._outputFormatter(param, name);
  1635          })();
  1636      }
  1637  
  1638      var length = this.staticPartLength(name);
  1639      var param = new HyperionParam(bytes.substr(offset * 2, length * 2));
  1640      return this._outputFormatter(param, name);
  1641  };
  1642  
  1643  module.exports = HyperionType;
  1644  
  1645  },{"./formatters":9,"./param":11}],15:[function(require,module,exports){
  1646  var f = require('./formatters');
  1647  var HyperionType = require('./type');
  1648  
  1649  /**
  1650   * HyperionTypeUInt is a prototype that represents uint type
  1651   * It matches:
  1652   * uint
  1653   * uint[]
  1654   * uint[4]
  1655   * uint[][]
  1656   * uint[3][]
  1657   * uint[][6][], ...
  1658   * uint32
  1659   * uint64[]
  1660   * uint8[4]
  1661   * uint256[][]
  1662   * uint[3][]
  1663   * uint64[][6][], ...
  1664   */
  1665  var HyperionTypeUInt = function () {
  1666      this._inputFormatter = f.formatInputInt;
  1667      this._outputFormatter = f.formatOutputUInt;
  1668  };
  1669  
  1670  HyperionTypeUInt.prototype = new HyperionType({});
  1671  HyperionTypeUInt.prototype.constructor = HyperionTypeUInt;
  1672  
  1673  HyperionTypeUInt.prototype.isType = function (name) {
  1674      return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/);
  1675  };
  1676  
  1677  module.exports = HyperionTypeUInt;
  1678  
  1679  },{"./formatters":9,"./type":14}],16:[function(require,module,exports){
  1680  var f = require('./formatters');
  1681  var HyperionType = require('./type');
  1682  
  1683  /**
  1684   * HyperionTypeUReal is a prototype that represents ureal type
  1685   * It matches:
  1686   * ureal
  1687   * ureal[]
  1688   * ureal[4]
  1689   * ureal[][]
  1690   * ureal[3][]
  1691   * ureal[][6][], ...
  1692   * ureal32
  1693   * ureal64[]
  1694   * ureal8[4]
  1695   * ureal256[][]
  1696   * ureal[3][]
  1697   * ureal64[][6][], ...
  1698   */
  1699  var HyperionTypeUReal = function () {
  1700      this._inputFormatter = f.formatInputReal;
  1701      this._outputFormatter = f.formatOutputUReal;
  1702  };
  1703  
  1704  HyperionTypeUReal.prototype = new HyperionType({});
  1705  HyperionTypeUReal.prototype.constructor = HyperionTypeUReal;
  1706  
  1707  HyperionTypeUReal.prototype.isType = function (name) {
  1708      return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/);
  1709  };
  1710  
  1711  module.exports = HyperionTypeUReal;
  1712  
  1713  },{"./formatters":9,"./type":14}],17:[function(require,module,exports){
  1714  'use strict';
  1715  
  1716  // go env doesn't have and need XMLHttpRequest
  1717  if (typeof XMLHttpRequest === 'undefined') {
  1718      exports.XMLHttpRequest = {};
  1719  } else {
  1720      exports.XMLHttpRequest = XMLHttpRequest; // jshint ignore:line
  1721  }
  1722  
  1723  
  1724  },{}],18:[function(require,module,exports){
  1725  /*
  1726      This file is part of web3.js.
  1727  
  1728      web3.js is free software: you can redistribute it and/or modify
  1729      it under the terms of the GNU Lesser General Public License as published by
  1730      the Free Software Foundation, either version 3 of the License, or
  1731      (at your option) any later version.
  1732  
  1733      web3.js is distributed in the hope that it will be useful,
  1734      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1735      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1736      GNU Lesser General Public License for more details.
  1737  
  1738      You should have received a copy of the GNU Lesser General Public License
  1739      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1740  */
  1741  /** @file config.js
  1742   * @authors:
  1743   *   Marek Kotewicz <marek@ethdev.com>
  1744   * @date 2015
  1745   */
  1746  
  1747  /**
  1748   * Utils
  1749   * 
  1750   * @module utils
  1751   */
  1752  
  1753  /**
  1754   * Utility functions
  1755   * 
  1756   * @class [utils] config
  1757   * @constructor
  1758   */
  1759  
  1760  
  1761  /// required to define ETH_BIGNUMBER_ROUNDING_MODE
  1762  var BigNumber = require('bignumber.js');
  1763  
  1764  var ETH_UNITS = [
  1765      'wei',
  1766      'kwei',
  1767      'Mwei',
  1768      'Gwei',
  1769      'szabo',
  1770      'finney',
  1771      'femtoether',
  1772      'picoether',
  1773      'nanoether',
  1774      'microether',
  1775      'milliether',
  1776      'nano',
  1777      'micro',
  1778      'milli',
  1779      'ether',
  1780      'grand',
  1781      'Mether',
  1782      'Gether',
  1783      'Tether',
  1784      'Pether',
  1785      'Eether',
  1786      'Zether',
  1787      'Yether',
  1788      'Nether',
  1789      'Dether',
  1790      'Vether',
  1791      'Uether'
  1792  ];
  1793  
  1794  module.exports = {
  1795      ETH_PADDING: 32,
  1796      ETH_SIGNATURE_LENGTH: 4,
  1797      ETH_UNITS: ETH_UNITS,
  1798      ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN },
  1799      ETH_POLLING_TIMEOUT: 1000/2,
  1800      defaultBlock: 'latest',
  1801      defaultAccount: undefined
  1802  };
  1803  
  1804  
  1805  },{"bignumber.js":"bignumber.js"}],19:[function(require,module,exports){
  1806  /*
  1807      This file is part of web3.js.
  1808  
  1809      web3.js is free software: you can redistribute it and/or modify
  1810      it under the terms of the GNU Lesser General Public License as published by
  1811      the Free Software Foundation, either version 3 of the License, or
  1812      (at your option) any later version.
  1813  
  1814      web3.js is distributed in the hope that it will be useful,
  1815      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1816      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1817      GNU Lesser General Public License for more details.
  1818  
  1819      You should have received a copy of the GNU Lesser General Public License
  1820      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1821  */
  1822  /** 
  1823   * @file sha3.js
  1824   * @author Marek Kotewicz <marek@ethdev.com>
  1825   * @date 2015
  1826   */
  1827  
  1828  var CryptoJS = require('crypto-js');
  1829  var sha3 = require('crypto-js/sha3');
  1830  
  1831  module.exports = function (value, options) {
  1832      if (options && options.encoding === 'hex') {
  1833          if (value.length > 2 && value.substr(0, 2) === '0x') {
  1834              value = value.substr(2);
  1835          }
  1836          value = CryptoJS.enc.Hex.parse(value);
  1837      }
  1838  
  1839      return sha3(value, {
  1840          outputLength: 256
  1841      }).toString();
  1842  };
  1843  
  1844  
  1845  },{"crypto-js":59,"crypto-js/sha3":80}],20:[function(require,module,exports){
  1846  /*
  1847      This file is part of web3.js.
  1848  
  1849      web3.js is free software: you can redistribute it and/or modify
  1850      it under the terms of the GNU Lesser General Public License as published by
  1851      the Free Software Foundation, either version 3 of the License, or
  1852      (at your option) any later version.
  1853  
  1854      web3.js is distributed in the hope that it will be useful,
  1855      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1856      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1857      GNU Lesser General Public License for more details.
  1858  
  1859      You should have received a copy of the GNU Lesser General Public License
  1860      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1861  */
  1862  /**
  1863   * @file utils.js
  1864   * @author Marek Kotewicz <marek@ethdev.com>
  1865   * @date 2015
  1866   */
  1867  
  1868  /**
  1869   * Utils
  1870   *
  1871   * @module utils
  1872   */
  1873  
  1874  /**
  1875   * Utility functions
  1876   *
  1877   * @class [utils] utils
  1878   * @constructor
  1879   */
  1880  
  1881  
  1882  var BigNumber = require('bignumber.js');
  1883  var sha3 = require('./sha3.js');
  1884  var utf8 = require('utf8');
  1885  
  1886  var unitMap = {
  1887      'noether':      '0',
  1888      'wei':          '1',
  1889      'kwei':         '1000',
  1890      'Kwei':         '1000',
  1891      'babbage':      '1000',
  1892      'femtoether':   '1000',
  1893      'mwei':         '1000000',
  1894      'Mwei':         '1000000',
  1895      'lovelace':     '1000000',
  1896      'picoether':    '1000000',
  1897      'gwei':         '1000000000',
  1898      'Gwei':         '1000000000',
  1899      'shannon':      '1000000000',
  1900      'nanoether':    '1000000000',
  1901      'nano':         '1000000000',
  1902      'szabo':        '1000000000000',
  1903      'microether':   '1000000000000',
  1904      'micro':        '1000000000000',
  1905      'finney':       '1000000000000000',
  1906      'milliether':    '1000000000000000',
  1907      'milli':         '1000000000000000',
  1908      'ether':        '1000000000000000000',
  1909      'kether':       '1000000000000000000000',
  1910      'grand':        '1000000000000000000000',
  1911      'mether':       '1000000000000000000000000',
  1912      'gether':       '1000000000000000000000000000',
  1913      'tether':       '1000000000000000000000000000000'
  1914  };
  1915  
  1916  /**
  1917   * Should be called to pad string to expected length
  1918   *
  1919   * @method padLeft
  1920   * @param {String} string to be padded
  1921   * @param {Number} characters that result string should have
  1922   * @param {String} sign, by default 0
  1923   * @returns {String} right aligned string
  1924   */
  1925  var padLeft = function (string, chars, sign) {
  1926      return new Array(chars - string.length + 1).join(sign ? sign : "0") + string;
  1927  };
  1928  
  1929  /**
  1930   * Should be called to pad string to expected length
  1931   *
  1932   * @method padRight
  1933   * @param {String} string to be padded
  1934   * @param {Number} characters that result string should have
  1935   * @param {String} sign, by default 0
  1936   * @returns {String} right aligned string
  1937   */
  1938  var padRight = function (string, chars, sign) {
  1939      return string + (new Array(chars - string.length + 1).join(sign ? sign : "0"));
  1940  };
  1941  
  1942  /**
  1943   * Should be called to get utf8 from it's hex representation
  1944   *
  1945   * @method toUtf8
  1946   * @param {String} string in hex
  1947   * @returns {String} ascii string representation of hex value
  1948   */
  1949  var toUtf8 = function(hex) {
  1950  // Find termination
  1951      var str = "";
  1952      var i = 0, l = hex.length;
  1953      if (hex.substring(0, 2) === '0x') {
  1954          i = 2;
  1955      }
  1956      for (; i < l; i+=2) {
  1957          var code = parseInt(hex.substr(i, 2), 16);
  1958          if (code === 0)
  1959              break;
  1960          str += String.fromCharCode(code);
  1961      }
  1962  
  1963      return utf8.decode(str);
  1964  };
  1965  
  1966  /**
  1967   * Should be called to get ascii from it's hex representation
  1968   *
  1969   * @method toAscii
  1970   * @param {String} string in hex
  1971   * @returns {String} ascii string representation of hex value
  1972   */
  1973  var toAscii = function(hex) {
  1974  // Find termination
  1975      var str = "";
  1976      var i = 0, l = hex.length;
  1977      if (hex.substring(0, 2) === '0x') {
  1978          i = 2;
  1979      }
  1980      for (; i < l; i+=2) {
  1981          var code = parseInt(hex.substr(i, 2), 16);
  1982          str += String.fromCharCode(code);
  1983      }
  1984  
  1985      return str;
  1986  };
  1987  
  1988  /**
  1989   * Should be called to get hex representation (prefixed by 0x) of utf8 string
  1990   *
  1991   * @method fromUtf8
  1992   * @param {String} string
  1993   * @param {Number} optional padding
  1994   * @returns {String} hex representation of input string
  1995   */
  1996  var fromUtf8 = function(str) {
  1997      str = utf8.encode(str);
  1998      var hex = "";
  1999      for(var i = 0; i < str.length; i++) {
  2000          var code = str.charCodeAt(i);
  2001          if (code === 0)
  2002              break;
  2003          var n = code.toString(16);
  2004          hex += n.length < 2 ? '0' + n : n;
  2005      }
  2006  
  2007      return "0x" + hex;
  2008  };
  2009  
  2010  /**
  2011   * Should be called to get hex representation (prefixed by 0x) of ascii string
  2012   *
  2013   * @method fromAscii
  2014   * @param {String} string
  2015   * @param {Number} optional padding
  2016   * @returns {String} hex representation of input string
  2017   */
  2018  var fromAscii = function(str) {
  2019      var hex = "";
  2020      for(var i = 0; i < str.length; i++) {
  2021          var code = str.charCodeAt(i);
  2022          var n = code.toString(16);
  2023          hex += n.length < 2 ? '0' + n : n;
  2024      }
  2025  
  2026      return "0x" + hex;
  2027  };
  2028  
  2029  /**
  2030   * Should be used to create full function/event name from json abi
  2031   *
  2032   * @method transformToFullName
  2033   * @param {Object} json-abi
  2034   * @return {String} full fnction/event name
  2035   */
  2036  var transformToFullName = function (json) {
  2037      if (json.name.indexOf('(') !== -1) {
  2038          return json.name;
  2039      }
  2040  
  2041      var typeName = json.inputs.map(function(i){return i.type; }).join();
  2042      return json.name + '(' + typeName + ')';
  2043  };
  2044  
  2045  /**
  2046   * Should be called to get display name of contract function
  2047   *
  2048   * @method extractDisplayName
  2049   * @param {String} name of function/event
  2050   * @returns {String} display name for function/event eg. multiply(uint256) -> multiply
  2051   */
  2052  var extractDisplayName = function (name) {
  2053      var length = name.indexOf('(');
  2054      return length !== -1 ? name.substr(0, length) : name;
  2055  };
  2056  
  2057  /// @returns overloaded part of function/event name
  2058  var extractTypeName = function (name) {
  2059      /// TODO: make it invulnerable
  2060      var length = name.indexOf('(');
  2061      return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : "";
  2062  };
  2063  
  2064  /**
  2065   * Converts value to it's decimal representation in string
  2066   *
  2067   * @method toDecimal
  2068   * @param {String|Number|BigNumber}
  2069   * @return {String}
  2070   */
  2071  var toDecimal = function (value) {
  2072      return toBigNumber(value).toNumber();
  2073  };
  2074  
  2075  /**
  2076   * Converts value to it's hex representation
  2077   *
  2078   * @method fromDecimal
  2079   * @param {String|Number|BigNumber}
  2080   * @return {String}
  2081   */
  2082  var fromDecimal = function (value) {
  2083      var number = toBigNumber(value);
  2084      var result = number.toString(16);
  2085  
  2086      return number.lessThan(0) ? '-0x' + result.substr(1) : '0x' + result;
  2087  };
  2088  
  2089  /**
  2090   * Auto converts any given value into it's hex representation.
  2091   *
  2092   * And even stringifys objects before.
  2093   *
  2094   * @method toHex
  2095   * @param {String|Number|BigNumber|Object}
  2096   * @return {String}
  2097   */
  2098  var toHex = function (val) {
  2099      /*jshint maxcomplexity: 8 */
  2100  
  2101      if (isBoolean(val))
  2102          return fromDecimal(+val);
  2103  
  2104      if (isBigNumber(val))
  2105          return fromDecimal(val);
  2106  
  2107      if (typeof val === 'object')
  2108          return fromUtf8(JSON.stringify(val));
  2109  
  2110      // if its a negative number, pass it through fromDecimal
  2111      if (isString(val)) {
  2112          if (val.indexOf('-0x') === 0)
  2113              return fromDecimal(val);
  2114          else if(val.indexOf('0x') === 0)
  2115              return val;
  2116          else if (!isFinite(val))
  2117              return fromAscii(val);
  2118      }
  2119  
  2120      return fromDecimal(val);
  2121  };
  2122  
  2123  /**
  2124   * Returns value of unit in Wei
  2125   *
  2126   * @method getValueOfUnit
  2127   * @param {String} unit the unit to convert to, default ether
  2128   * @returns {BigNumber} value of the unit (in Wei)
  2129   * @throws error if the unit is not correct:w
  2130   */
  2131  var getValueOfUnit = function (unit) {
  2132      unit = unit ? unit.toLowerCase() : 'ether';
  2133      var unitValue = unitMap[unit];
  2134      if (unitValue === undefined) {
  2135          throw new Error('This unit doesn\'t exists, please use the one of the following units' + JSON.stringify(unitMap, null, 2));
  2136      }
  2137      return new BigNumber(unitValue, 10);
  2138  };
  2139  
  2140  /**
  2141   * Takes a number of wei and converts it to any other ether unit.
  2142   *
  2143   * Possible units are:
  2144   *   SI Short   SI Full        Effigy       Other
  2145   * - kwei       femtoether     babbage
  2146   * - mwei       picoether      lovelace
  2147   * - gwei       nanoether      shannon      nano
  2148   * - --         microether     szabo        micro
  2149   * - --         milliether     finney       milli
  2150   * - ether      --             --
  2151   * - kether                    --           grand
  2152   * - mether
  2153   * - gether
  2154   * - tether
  2155   *
  2156   * @method fromWei
  2157   * @param {Number|String} number can be a number, number string or a HEX of a decimal
  2158   * @param {String} unit the unit to convert to, default ether
  2159   * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number
  2160  */
  2161  var fromWei = function(number, unit) {
  2162      var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
  2163  
  2164      return isBigNumber(number) ? returnValue : returnValue.toString(10);
  2165  };
  2166  
  2167  /**
  2168   * Takes a number of a unit and converts it to wei.
  2169   *
  2170   * Possible units are:
  2171   *   SI Short   SI Full        Effigy       Other
  2172   * - kwei       femtoether     babbage
  2173   * - mwei       picoether      lovelace
  2174   * - gwei       nanoether      shannon      nano
  2175   * - --         microether     szabo        micro
  2176   * - --         microether     szabo        micro
  2177   * - --         milliether     finney       milli
  2178   * - ether      --             --
  2179   * - kether                    --           grand
  2180   * - mether
  2181   * - gether
  2182   * - tether
  2183   *
  2184   * @method toWei
  2185   * @param {Number|String|BigNumber} number can be a number, number string or a HEX of a decimal
  2186   * @param {String} unit the unit to convert from, default ether
  2187   * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number
  2188  */
  2189  var toWei = function(number, unit) {
  2190      var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
  2191  
  2192      return isBigNumber(number) ? returnValue : returnValue.toString(10);
  2193  };
  2194  
  2195  /**
  2196   * Takes an input and transforms it into a bignumber
  2197   *
  2198   * @method toBigNumber
  2199   * @param {Number|String|BigNumber} a number, string, HEX string or BigNumber
  2200   * @return {BigNumber} BigNumber
  2201  */
  2202  var toBigNumber = function(number) {
  2203      /*jshint maxcomplexity:5 */
  2204      number = number || 0;
  2205      if (isBigNumber(number))
  2206          return number;
  2207  
  2208      if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {
  2209          return new BigNumber(number.replace('0x',''), 16);
  2210      }
  2211  
  2212      return new BigNumber(number.toString(10), 10);
  2213  };
  2214  
  2215  /**
  2216   * Takes and input transforms it into bignumber and if it is negative value, into two's complement
  2217   *
  2218   * @method toTwosComplement
  2219   * @param {Number|String|BigNumber}
  2220   * @return {BigNumber}
  2221   */
  2222  var toTwosComplement = function (number) {
  2223      var bigNumber = toBigNumber(number).round();
  2224      if (bigNumber.lessThan(0)) {
  2225          return new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).plus(bigNumber).plus(1);
  2226      }
  2227      return bigNumber;
  2228  };
  2229  
  2230  /**
  2231   * Checks if the given string is strictly an address
  2232   *
  2233   * @method isStrictAddress
  2234   * @param {String} address the given HEX address
  2235   * @return {Boolean}
  2236  */
  2237  var isStrictAddress = function (address) {
  2238      return /^Z[0-9a-f]{40}$/i.test(address);
  2239  };
  2240  
  2241  /**
  2242   * Checks if the given string is an address
  2243   *
  2244   * @method isAddress
  2245   * @param {String} address the given HEX address
  2246   * @return {Boolean}
  2247  */
  2248  var isAddress = function (address) {
  2249      if (!/^Z[0-9a-f]{40}$/i.test(address)) {
  2250          // check if it has the basic requirements of an address
  2251          return false;
  2252      } else if (/^Z[0-9a-f]{40}$/.test(address)) {
  2253          return true;
  2254      } else {
  2255          // Otherwise check each case
  2256          return isChecksumAddress(address);
  2257      }
  2258  };
  2259  
  2260  /**
  2261   * Checks if the given string is a checksummed address
  2262   *
  2263   * @method isChecksumAddress
  2264   * @param {String} address the given HEX address
  2265   * @return {Boolean}
  2266  */
  2267  var isChecksumAddress = function (address) {
  2268      // Check each case
  2269      address = address.replace('Z','');
  2270      var addressHash = sha3(address.toLowerCase());
  2271  
  2272      for (var i = 0; i < 40; i++ ) {
  2273          // the nth letter should be uppercase if the nth digit of casemap is 1
  2274          if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
  2275              return false;
  2276          }
  2277      }
  2278      return true;
  2279  };
  2280  
  2281  
  2282  
  2283  /**
  2284   * Makes a checksum address
  2285   *
  2286   * @method toChecksumAddress
  2287   * @param {String} address the given HEX address
  2288   * @return {String}
  2289  */
  2290  var toChecksumAddress = function (address) {
  2291      if (typeof address === 'undefined') return '';
  2292  
  2293      address = address.toLowerCase().replace('Z','');
  2294      var addressHash = sha3(address);
  2295      var checksumAddress = 'Z';
  2296  
  2297      for (var i = 0; i < address.length; i++ ) {
  2298          // If ith character is 9 to f then make it uppercase
  2299          if (parseInt(addressHash[i], 16) > 7) {
  2300            checksumAddress += address[i].toUpperCase();
  2301          } else {
  2302              checksumAddress += address[i];
  2303          }
  2304      }
  2305      return checksumAddress;
  2306  };
  2307  
  2308  /**
  2309   * Transforms given string to valid 20 bytes-length address with Z prefix
  2310   *
  2311   * @method toAddress
  2312   * @param {String} address
  2313   * @return {String} formatted address
  2314   */
  2315  var toAddress = function (address) {
  2316      if (isStrictAddress(address)) {
  2317          return address;
  2318      }
  2319  
  2320      if (/^[0-9a-f]{40}$/.test(address)) {
  2321          return 'Z' + address;
  2322      }
  2323  
  2324      return 'Z' + padLeft(toHex(address).substr(2), 40);
  2325  };
  2326  
  2327  /**
  2328   * Returns true if object is BigNumber, otherwise false
  2329   *
  2330   * @method isBigNumber
  2331   * @param {Object}
  2332   * @return {Boolean}
  2333   */
  2334  var isBigNumber = function (object) {
  2335      return object instanceof BigNumber ||
  2336          (object && object.constructor && object.constructor.name === 'BigNumber');
  2337  };
  2338  
  2339  /**
  2340   * Returns true if object is string, otherwise false
  2341   *
  2342   * @method isString
  2343   * @param {Object}
  2344   * @return {Boolean}
  2345   */
  2346  var isString = function (object) {
  2347      return typeof object === 'string' ||
  2348          (object && object.constructor && object.constructor.name === 'String');
  2349  };
  2350  
  2351  /**
  2352   * Returns true if object is function, otherwise false
  2353   *
  2354   * @method isFunction
  2355   * @param {Object}
  2356   * @return {Boolean}
  2357   */
  2358  var isFunction = function (object) {
  2359      return typeof object === 'function';
  2360  };
  2361  
  2362  /**
  2363   * Returns true if object is Objet, otherwise false
  2364   *
  2365   * @method isObject
  2366   * @param {Object}
  2367   * @return {Boolean}
  2368   */
  2369  var isObject = function (object) {
  2370      return object !== null && !(object instanceof Array) && typeof object === 'object';
  2371  };
  2372  
  2373  /**
  2374   * Returns true if object is boolean, otherwise false
  2375   *
  2376   * @method isBoolean
  2377   * @param {Object}
  2378   * @return {Boolean}
  2379   */
  2380  var isBoolean = function (object) {
  2381      return typeof object === 'boolean';
  2382  };
  2383  
  2384  /**
  2385   * Returns true if object is array, otherwise false
  2386   *
  2387   * @method isArray
  2388   * @param {Object}
  2389   * @return {Boolean}
  2390   */
  2391  var isArray = function (object) {
  2392      return object instanceof Array;
  2393  };
  2394  
  2395  /**
  2396   * Returns true if given string is valid json object
  2397   *
  2398   * @method isJson
  2399   * @param {String}
  2400   * @return {Boolean}
  2401   */
  2402  var isJson = function (str) {
  2403      try {
  2404          return !!JSON.parse(str);
  2405      } catch (e) {
  2406          return false;
  2407      }
  2408  };
  2409  
  2410  /**
  2411   * Returns true if given string is a valid Zond block header bloom.
  2412   *
  2413   * @method isBloom
  2414   * @param {String} hex encoded bloom filter
  2415   * @return {Boolean}
  2416   */
  2417  var isBloom = function (bloom) {
  2418      if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) {
  2419          return false;
  2420      } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) {
  2421          return true;
  2422      }
  2423      return false;
  2424  };
  2425  
  2426  /**
  2427   * Returns true if given string is a valid log topic.
  2428   *
  2429   * @method isTopic
  2430   * @param {String} hex encoded topic
  2431   * @return {Boolean}
  2432   */
  2433  var isTopic = function (topic) {
  2434      if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) {
  2435          return false;
  2436      } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) {
  2437          return true;
  2438      }
  2439      return false;
  2440  };
  2441  
  2442  module.exports = {
  2443      padLeft: padLeft,
  2444      padRight: padRight,
  2445      toHex: toHex,
  2446      toDecimal: toDecimal,
  2447      fromDecimal: fromDecimal,
  2448      toUtf8: toUtf8,
  2449      toAscii: toAscii,
  2450      fromUtf8: fromUtf8,
  2451      fromAscii: fromAscii,
  2452      transformToFullName: transformToFullName,
  2453      extractDisplayName: extractDisplayName,
  2454      extractTypeName: extractTypeName,
  2455      toWei: toWei,
  2456      fromWei: fromWei,
  2457      toBigNumber: toBigNumber,
  2458      toTwosComplement: toTwosComplement,
  2459      toAddress: toAddress,
  2460      isBigNumber: isBigNumber,
  2461      isStrictAddress: isStrictAddress,
  2462      isAddress: isAddress,
  2463      isChecksumAddress: isChecksumAddress,
  2464      toChecksumAddress: toChecksumAddress,
  2465      isFunction: isFunction,
  2466      isString: isString,
  2467      isObject: isObject,
  2468      isBoolean: isBoolean,
  2469      isArray: isArray,
  2470      isJson: isJson,
  2471      isBloom: isBloom,
  2472      isTopic: isTopic,
  2473  };
  2474  
  2475  },{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":85}],21:[function(require,module,exports){
  2476  module.exports={
  2477      "version": "0.20.1"
  2478  }
  2479  
  2480  },{}],22:[function(require,module,exports){
  2481  /*
  2482      This file is part of web3.js.
  2483  
  2484      web3.js is free software: you can redistribute it and/or modify
  2485      it under the terms of the GNU Lesser General Public License as published by
  2486      the Free Software Foundation, either version 3 of the License, or
  2487      (at your option) any later version.
  2488  
  2489      web3.js is distributed in the hope that it will be useful,
  2490      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2491      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2492      GNU Lesser General Public License for more details.
  2493  
  2494      You should have received a copy of the GNU Lesser General Public License
  2495      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2496  */
  2497  /**
  2498   * @file web3.js
  2499   * @authors:
  2500   *   Jeffrey Wilcke <jeff@ethdev.com>
  2501   *   Marek Kotewicz <marek@ethdev.com>
  2502   *   Marian Oancea <marian@ethdev.com>
  2503   *   Fabian Vogelsteller <fabian@ethdev.com>
  2504   *   Gav Wood <g@ethdev.com>
  2505   * @date 2014
  2506   */
  2507  
  2508  var RequestManager = require('./web3/requestmanager');
  2509  var Iban = require('./web3/iban');
  2510  var Zond = require('./web3/methods/zond');
  2511  var DB = require('./web3/methods/db');
  2512  var Net = require('./web3/methods/net');
  2513  var Settings = require('./web3/settings');
  2514  var version = require('./version.json');
  2515  var utils = require('./utils/utils');
  2516  var sha3 = require('./utils/sha3');
  2517  var extend = require('./web3/extend');
  2518  var Batch = require('./web3/batch');
  2519  var Property = require('./web3/property');
  2520  var HttpProvider = require('./web3/httpprovider');
  2521  var IpcProvider = require('./web3/ipcprovider');
  2522  var BigNumber = require('bignumber.js');
  2523  
  2524  
  2525  
  2526  function Web3 (provider) {
  2527      this._requestManager = new RequestManager(provider);
  2528      this.currentProvider = provider;
  2529      this.zond = new Zond(this);
  2530      this.db = new DB(this);
  2531      this.net = new Net(this);
  2532      this.settings = new Settings();
  2533      this.version = {
  2534          api: version.version
  2535      };
  2536      this.providers = {
  2537          HttpProvider: HttpProvider,
  2538          IpcProvider: IpcProvider
  2539      };
  2540      this._extend = extend(this);
  2541      this._extend({
  2542          properties: properties()
  2543      });
  2544  }
  2545  
  2546  // expose providers on the class
  2547  Web3.providers = {
  2548      HttpProvider: HttpProvider,
  2549      IpcProvider: IpcProvider
  2550  };
  2551  
  2552  Web3.prototype.setProvider = function (provider) {
  2553      this._requestManager.setProvider(provider);
  2554      this.currentProvider = provider;
  2555  };
  2556  
  2557  Web3.prototype.reset = function (keepIsSyncing) {
  2558      this._requestManager.reset(keepIsSyncing);
  2559      this.settings = new Settings();
  2560  };
  2561  
  2562  Web3.prototype.BigNumber = BigNumber;
  2563  Web3.prototype.toHex = utils.toHex;
  2564  Web3.prototype.toAscii = utils.toAscii;
  2565  Web3.prototype.toUtf8 = utils.toUtf8;
  2566  Web3.prototype.fromAscii = utils.fromAscii;
  2567  Web3.prototype.fromUtf8 = utils.fromUtf8;
  2568  Web3.prototype.toDecimal = utils.toDecimal;
  2569  Web3.prototype.fromDecimal = utils.fromDecimal;
  2570  Web3.prototype.toBigNumber = utils.toBigNumber;
  2571  Web3.prototype.toWei = utils.toWei;
  2572  Web3.prototype.fromWei = utils.fromWei;
  2573  Web3.prototype.isAddress = utils.isAddress;
  2574  Web3.prototype.isChecksumAddress = utils.isChecksumAddress;
  2575  Web3.prototype.toChecksumAddress = utils.toChecksumAddress;
  2576  Web3.prototype.isIBAN = utils.isIBAN;
  2577  Web3.prototype.padLeft = utils.padLeft;
  2578  Web3.prototype.padRight = utils.padRight;
  2579  
  2580  
  2581  Web3.prototype.sha3 = function(string, options) {
  2582      return '0x' + sha3(string, options);
  2583  };
  2584  
  2585  /**
  2586   * Transforms direct icap to address
  2587   */
  2588  Web3.prototype.fromICAP = function (icap) {
  2589      var iban = new Iban(icap);
  2590      return iban.address();
  2591  };
  2592  
  2593  var properties = function () {
  2594      return [
  2595          new Property({
  2596              name: 'version.node',
  2597              getter: 'web3_clientVersion'
  2598          }),
  2599          new Property({
  2600              name: 'version.network',
  2601              getter: 'net_version',
  2602              inputFormatter: utils.toDecimal
  2603          }),
  2604          new Property({
  2605              name: 'version.zond',
  2606              getter: 'zond_protocolVersion',
  2607              inputFormatter: utils.toDecimal
  2608          })
  2609      ];
  2610  };
  2611  
  2612  Web3.prototype.isConnected = function(){
  2613      return (this.currentProvider && this.currentProvider.isConnected());
  2614  };
  2615  
  2616  Web3.prototype.createBatch = function () {
  2617      return new Batch(this);
  2618  };
  2619  
  2620  module.exports = Web3;
  2621  
  2622  
  2623  },{"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/extend":28,"./web3/httpprovider":32,"./web3/iban":33,"./web3/ipcprovider":34,"./web3/methods/db":37,"./web3/methods/zond":38,"./web3/methods/net":39,"./web3/methods/personal":40,"./web3/methods/shh":41,"./web3/methods/swarm":42,"./web3/property":45,"./web3/requestmanager":46,"./web3/settings":47,"bignumber.js":"bignumber.js"}],23:[function(require,module,exports){
  2624  /*
  2625      This file is part of web3.js.
  2626  
  2627      web3.js is free software: you can redistribute it and/or modify
  2628      it under the terms of the GNU Lesser General Public License as published by
  2629      the Free Software Foundation, either version 3 of the License, or
  2630      (at your option) any later version.
  2631  
  2632      web3.js is distributed in the hope that it will be useful,
  2633      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2634      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2635      GNU Lesser General Public License for more details.
  2636  
  2637      You should have received a copy of the GNU Lesser General Public License
  2638      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2639  */
  2640  /**
  2641   * @file allevents.js
  2642   * @author Marek Kotewicz <marek@ethdev.com>
  2643   * @date 2014
  2644   */
  2645  
  2646  var sha3 = require('../utils/sha3');
  2647  var HyperionEvent = require('./event');
  2648  var formatters = require('./formatters');
  2649  var utils = require('../utils/utils');
  2650  var Filter = require('./filter');
  2651  var watches = require('./methods/watches');
  2652  
  2653  var AllHyperionEvents = function (requestManager, json, address) {
  2654      this._requestManager = requestManager;
  2655      this._json = json;
  2656      this._address = address;
  2657  };
  2658  
  2659  AllHyperionEvents.prototype.encode = function (options) {
  2660      options = options || {};
  2661      var result = {};
  2662  
  2663      ['fromBlock', 'toBlock'].filter(function (f) {
  2664          return options[f] !== undefined;
  2665      }).forEach(function (f) {
  2666          result[f] = formatters.inputBlockNumberFormatter(options[f]);
  2667      });
  2668  
  2669      result.address = this._address;
  2670  
  2671      return result;
  2672  };
  2673  
  2674  AllHyperionEvents.prototype.decode = function (data) {
  2675      data.data = data.data || '';
  2676      data.topics = data.topics || [];
  2677  
  2678      var eventTopic = data.topics[0].slice(2);
  2679      var match = this._json.filter(function (j) {
  2680          return eventTopic === sha3(utils.transformToFullName(j));
  2681      })[0];
  2682  
  2683      if (!match) { // cannot find matching event?
  2684          console.warn('cannot find event for log');
  2685          return data;
  2686      }
  2687  
  2688      var event = new HyperionEvent(this._requestManager, match, this._address);
  2689      return event.decode(data);
  2690  };
  2691  
  2692  AllHyperionEvents.prototype.execute = function (options, callback) {
  2693  
  2694      if (utils.isFunction(arguments[arguments.length - 1])) {
  2695          callback = arguments[arguments.length - 1];
  2696          if(arguments.length === 1)
  2697              options = null;
  2698      }
  2699  
  2700      var o = this.encode(options);
  2701      var formatter = this.decode.bind(this);
  2702      return new Filter(o, 'zond', this._requestManager, watches.zond(), formatter, callback);
  2703  };
  2704  
  2705  AllHyperionEvents.prototype.attachToContract = function (contract) {
  2706      var execute = this.execute.bind(this);
  2707      contract.allEvents = execute;
  2708  };
  2709  
  2710  module.exports = AllHyperionEvents;
  2711  
  2712  
  2713  },{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":43}],24:[function(require,module,exports){
  2714  /*
  2715      This file is part of web3.js.
  2716  
  2717      web3.js is free software: you can redistribute it and/or modify
  2718      it under the terms of the GNU Lesser General Public License as published by
  2719      the Free Software Foundation, either version 3 of the License, or
  2720      (at your option) any later version.
  2721  
  2722      web3.js is distributed in the hope that it will be useful,
  2723      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2724      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2725      GNU Lesser General Public License for more details.
  2726  
  2727      You should have received a copy of the GNU Lesser General Public License
  2728      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2729  */
  2730  /** 
  2731   * @file batch.js
  2732   * @author Marek Kotewicz <marek@ethdev.com>
  2733   * @date 2015
  2734   */
  2735  
  2736  var Jsonrpc = require('./jsonrpc');
  2737  var errors = require('./errors');
  2738  
  2739  var Batch = function (web3) {
  2740      this.requestManager = web3._requestManager;
  2741      this.requests = [];
  2742  };
  2743  
  2744  /**
  2745   * Should be called to add create new request to batch request
  2746   *
  2747   * @method add
  2748   * @param {Object} jsonrpc requet object
  2749   */
  2750  Batch.prototype.add = function (request) {
  2751      this.requests.push(request);
  2752  };
  2753  
  2754  /**
  2755   * Should be called to execute batch request
  2756   *
  2757   * @method execute
  2758   */
  2759  Batch.prototype.execute = function () {
  2760      var requests = this.requests;
  2761      this.requestManager.sendBatch(requests, function (err, results) {
  2762          results = results || [];
  2763          requests.map(function (request, index) {
  2764              return results[index] || {};
  2765          }).forEach(function (result, index) {
  2766              if (requests[index].callback) {
  2767  
  2768                  if (!Jsonrpc.isValidResponse(result)) {
  2769                      return requests[index].callback(errors.InvalidResponse(result));
  2770                  }
  2771  
  2772                  requests[index].callback(null, (requests[index].format ? requests[index].format(result.result) : result.result));
  2773              }
  2774          });
  2775      }); 
  2776  };
  2777  
  2778  module.exports = Batch;
  2779  
  2780  
  2781  },{"./errors":26,"./jsonrpc":35}],25:[function(require,module,exports){
  2782  /*
  2783      This file is part of web3.js.
  2784  
  2785      web3.js is free software: you can redistribute it and/or modify
  2786      it under the terms of the GNU Lesser General Public License as published by
  2787      the Free Software Foundation, either version 3 of the License, or
  2788      (at your option) any later version.
  2789  
  2790      web3.js is distributed in the hope that it will be useful,
  2791      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2792      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2793      GNU Lesser General Public License for more details.
  2794  
  2795      You should have received a copy of the GNU Lesser General Public License
  2796      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2797  */
  2798  /**
  2799   * @file contract.js
  2800   * @author Marek Kotewicz <marek@ethdev.com>
  2801   * @date 2014
  2802   */
  2803  
  2804  var utils = require('../utils/utils');
  2805  var coder = require('../hyperion/coder');
  2806  var HyperionEvent = require('./event');
  2807  var HyperionFunction = require('./function');
  2808  var AllEvents = require('./allevents');
  2809  
  2810  /**
  2811   * Should be called to encode constructor params
  2812   *
  2813   * @method encodeConstructorParams
  2814   * @param {Array} abi
  2815   * @param {Array} constructor params
  2816   */
  2817  var encodeConstructorParams = function (abi, params) {
  2818      return abi.filter(function (json) {
  2819          return json.type === 'constructor' && json.inputs.length === params.length;
  2820      }).map(function (json) {
  2821          return json.inputs.map(function (input) {
  2822              return input.type;
  2823          });
  2824      }).map(function (types) {
  2825          return coder.encodeParams(types, params);
  2826      })[0] || '';
  2827  };
  2828  
  2829  /**
  2830   * Should be called to add functions to contract object
  2831   *
  2832   * @method addFunctionsToContract
  2833   * @param {Contract} contract
  2834   * @param {Array} abi
  2835   */
  2836  var addFunctionsToContract = function (contract) {
  2837      contract.abi.filter(function (json) {
  2838          return json.type === 'function';
  2839      }).map(function (json) {
  2840          return new HyperionFunction(contract._zond, json, contract.address);
  2841      }).forEach(function (f) {
  2842          f.attachToContract(contract);
  2843      });
  2844  };
  2845  
  2846  /**
  2847   * Should be called to add events to contract object
  2848   *
  2849   * @method addEventsToContract
  2850   * @param {Contract} contract
  2851   * @param {Array} abi
  2852   */
  2853  var addEventsToContract = function (contract) {
  2854      var events = contract.abi.filter(function (json) {
  2855          return json.type === 'event';
  2856      });
  2857  
  2858      var All = new AllEvents(contract._zond._requestManager, events, contract.address);
  2859      All.attachToContract(contract);
  2860  
  2861      events.map(function (json) {
  2862          return new HyperionEvent(contract._zond._requestManager, json, contract.address);
  2863      }).forEach(function (e) {
  2864          e.attachToContract(contract);
  2865      });
  2866  };
  2867  
  2868  
  2869  /**
  2870   * Should be called to check if the contract gets properly deployed on the blockchain.
  2871   *
  2872   * @method checkForContractAddress
  2873   * @param {Object} contract
  2874   * @param {Function} callback
  2875   * @returns {Undefined}
  2876   */
  2877  var checkForContractAddress = function(contract, callback){
  2878      var count = 0,
  2879          callbackFired = false;
  2880  
  2881      // wait for receipt
  2882      var filter = contract._zond.filter('latest', function(e){
  2883          if (!e && !callbackFired) {
  2884              count++;
  2885  
  2886              // stop watching after 50 blocks (timeout)
  2887              if (count > 50) {
  2888  
  2889                  filter.stopWatching(function() {});
  2890                  callbackFired = true;
  2891  
  2892                  if (callback)
  2893                      callback(new Error('Contract transaction couldn\'t be found after 50 blocks'));
  2894                  else
  2895                      throw new Error('Contract transaction couldn\'t be found after 50 blocks');
  2896  
  2897  
  2898              } else {
  2899  
  2900                  contract._zond.getTransactionReceipt(contract.transactionHash, function(e, receipt){
  2901                      if(receipt && !callbackFired) {
  2902  
  2903                          contract._zond.getCode(receipt.contractAddress, function(e, code){
  2904                              /*jshint maxcomplexity: 6 */
  2905  
  2906                              if(callbackFired || !code)
  2907                                  return;
  2908  
  2909                              filter.stopWatching(function() {});
  2910                              callbackFired = true;
  2911  
  2912                              if(code.length > 3) {
  2913  
  2914                                  // console.log('Contract code deployed!');
  2915  
  2916                                  contract.address = receipt.contractAddress;
  2917  
  2918                                  // attach events and methods again after we have
  2919                                  addFunctionsToContract(contract);
  2920                                  addEventsToContract(contract);
  2921  
  2922                                  // call callback for the second time
  2923                                  if(callback)
  2924                                      callback(null, contract);
  2925  
  2926                              } else {
  2927                                  if(callback)
  2928                                      callback(new Error('The contract code couldn\'t be stored, please check your gas amount.'));
  2929                                  else
  2930                                      throw new Error('The contract code couldn\'t be stored, please check your gas amount.');
  2931                              }
  2932                          });
  2933                      }
  2934                  });
  2935              }
  2936          }
  2937      });
  2938  };
  2939  
  2940  /**
  2941   * Should be called to create new ContractFactory instance
  2942   *
  2943   * @method ContractFactory
  2944   * @param {Array} abi
  2945   */
  2946  var ContractFactory = function (zond, abi) {
  2947      this.zond = zond;
  2948      this.abi = abi;
  2949  
  2950      /**
  2951       * Should be called to create new contract on a blockchain
  2952       *
  2953       * @method new
  2954       * @param {Any} contract constructor param1 (optional)
  2955       * @param {Any} contract constructor param2 (optional)
  2956       * @param {Object} contract transaction object (required)
  2957       * @param {Function} callback
  2958       * @returns {Contract} returns contract instance
  2959       */
  2960      this.new = function () {
  2961          /*jshint maxcomplexity: 7 */
  2962          
  2963          var contract = new Contract(this.zond, this.abi);
  2964  
  2965          // parse arguments
  2966          var options = {}; // required!
  2967          var callback;
  2968  
  2969          var args = Array.prototype.slice.call(arguments);
  2970          if (utils.isFunction(args[args.length - 1])) {
  2971              callback = args.pop();
  2972          }
  2973  
  2974          var last = args[args.length - 1];
  2975          if (utils.isObject(last) && !utils.isArray(last)) {
  2976              options = args.pop();
  2977          }
  2978  
  2979          if (options.value > 0) {
  2980              var constructorAbi = abi.filter(function (json) {
  2981                  return json.type === 'constructor' && json.inputs.length === args.length;
  2982              })[0] || {};
  2983  
  2984              if (!constructorAbi.payable) {
  2985                  throw new Error('Cannot send value to non-payable constructor');
  2986              }
  2987          }
  2988  
  2989          var bytes = encodeConstructorParams(this.abi, args);
  2990          options.data += bytes;
  2991  
  2992          if (callback) {
  2993  
  2994              // wait for the contract address and check if the code was deployed
  2995              this.zond.sendTransaction(options, function (err, hash) {
  2996                  if (err) {
  2997                      callback(err);
  2998                  } else {
  2999                      // add the transaction hash
  3000                      contract.transactionHash = hash;
  3001  
  3002                      // call callback for the first time
  3003                      callback(null, contract);
  3004  
  3005                      checkForContractAddress(contract, callback);
  3006                  }
  3007              });
  3008          } else {
  3009              var hash = this.zond.sendTransaction(options);
  3010              // add the transaction hash
  3011              contract.transactionHash = hash;
  3012              checkForContractAddress(contract);
  3013          }
  3014  
  3015          return contract;
  3016      };
  3017  
  3018      this.new.getData = this.getData.bind(this);
  3019  };
  3020  
  3021  /**
  3022   * Should be called to create new ContractFactory
  3023   *
  3024   * @method contract
  3025   * @param {Array} abi
  3026   * @returns {ContractFactory} new contract factory
  3027   */
  3028  //var contract = function (abi) {
  3029      //return new ContractFactory(abi);
  3030  //};
  3031  
  3032  
  3033  
  3034  /**
  3035   * Should be called to get access to existing contract on a blockchain
  3036   *
  3037   * @method at
  3038   * @param {Address} contract address (required)
  3039   * @param {Function} callback {optional)
  3040   * @returns {Contract} returns contract if no callback was passed,
  3041   * otherwise calls callback function (err, contract)
  3042   */
  3043  ContractFactory.prototype.at = function (address, callback) {
  3044      var contract = new Contract(this.zond, this.abi, address);
  3045  
  3046      // this functions are not part of prototype,
  3047      // because we don't want to spoil the interface
  3048      addFunctionsToContract(contract);
  3049      addEventsToContract(contract);
  3050  
  3051      if (callback) {
  3052          callback(null, contract);
  3053      }
  3054      return contract;
  3055  };
  3056  
  3057  /**
  3058   * Gets the data, which is data to deploy plus constructor params
  3059   *
  3060   * @method getData
  3061   */
  3062  ContractFactory.prototype.getData = function () {
  3063      var options = {}; // required!
  3064      var args = Array.prototype.slice.call(arguments);
  3065  
  3066      var last = args[args.length - 1];
  3067      if (utils.isObject(last) && !utils.isArray(last)) {
  3068          options = args.pop();
  3069      }
  3070  
  3071      var bytes = encodeConstructorParams(this.abi, args);
  3072      options.data += bytes;
  3073  
  3074      return options.data;
  3075  };
  3076  
  3077  /**
  3078   * Should be called to create new contract instance
  3079   *
  3080   * @method Contract
  3081   * @param {Array} abi
  3082   * @param {Address} contract address
  3083   */
  3084  var Contract = function (zond, abi, address) {
  3085      this._zond = zond;
  3086      this.transactionHash = null;
  3087      this.address = address;
  3088      this.abi = abi;
  3089  };
  3090  
  3091  module.exports = ContractFactory;
  3092  
  3093  },{"../hyperion/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(require,module,exports){
  3094  /*
  3095      This file is part of web3.js.
  3096  
  3097      web3.js is free software: you can redistribute it and/or modify
  3098      it under the terms of the GNU Lesser General Public License as published by
  3099      the Free Software Foundation, either version 3 of the License, or
  3100      (at your option) any later version.
  3101  
  3102      web3.js is distributed in the hope that it will be useful,
  3103      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3104      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3105      GNU Lesser General Public License for more details.
  3106  
  3107      You should have received a copy of the GNU Lesser General Public License
  3108      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3109  */
  3110  /** 
  3111   * @file errors.js
  3112   * @author Marek Kotewicz <marek@ethdev.com>
  3113   * @date 2015
  3114   */
  3115  
  3116  module.exports = {
  3117      InvalidNumberOfHyperionArgs: function () {
  3118          return new Error('Invalid number of arguments to Hyperion function');
  3119      },
  3120      InvalidNumberOfRPCParams: function () {
  3121          return new Error('Invalid number of input parameters to RPC method');
  3122      },
  3123      InvalidConnection: function (host){
  3124          return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.');
  3125      },
  3126      InvalidProvider: function () {
  3127          return new Error('Provider not set or invalid');
  3128      },
  3129      InvalidResponse: function (result){
  3130          var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result);
  3131          return new Error(message);
  3132      },
  3133      ConnectionTimeout: function (ms){
  3134          return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived');
  3135      }
  3136  };
  3137  
  3138  },{}],27:[function(require,module,exports){
  3139  /*
  3140      This file is part of web3.js.
  3141  
  3142      web3.js is free software: you can redistribute it and/or modify
  3143      it under the terms of the GNU Lesser General Public License as published by
  3144      the Free Software Foundation, either version 3 of the License, or
  3145      (at your option) any later version.
  3146  
  3147      web3.js is distributed in the hope that it will be useful,
  3148      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3149      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3150      GNU Lesser General Public License for more details.
  3151  
  3152      You should have received a copy of the GNU Lesser General Public License
  3153      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3154  */
  3155  /**
  3156   * @file event.js
  3157   * @author Marek Kotewicz <marek@ethdev.com>
  3158   * @date 2014
  3159   */
  3160  
  3161  var utils = require('../utils/utils');
  3162  var coder = require('../hyperion/coder'); // TODO(rgeraldes24)
  3163  var formatters = require('./formatters');
  3164  var sha3 = require('../utils/sha3');
  3165  var Filter = require('./filter');
  3166  var watches = require('./methods/watches');
  3167  
  3168  /**
  3169   * This prototype should be used to create event filters
  3170   */
  3171  var HyperionEvent = function (requestManager, json, address) {
  3172      this._requestManager = requestManager;
  3173      this._params = json.inputs;
  3174      this._name = utils.transformToFullName(json);
  3175      this._address = address;
  3176      this._anonymous = json.anonymous;
  3177  };
  3178  
  3179  /**
  3180   * Should be used to get filtered param types
  3181   *
  3182   * @method types
  3183   * @param {Bool} decide if returned typed should be indexed
  3184   * @return {Array} array of types
  3185   */
  3186  HyperionEvent.prototype.types = function (indexed) {
  3187      return this._params.filter(function (i) {
  3188          return i.indexed === indexed;
  3189      }).map(function (i) {
  3190          return i.type;
  3191      });
  3192  };
  3193  
  3194  /**
  3195   * Should be used to get event display name
  3196   *
  3197   * @method displayName
  3198   * @return {String} event display name
  3199   */
  3200  HyperionEvent.prototype.displayName = function () {
  3201      return utils.extractDisplayName(this._name);
  3202  };
  3203  
  3204  /**
  3205   * Should be used to get event type name
  3206   *
  3207   * @method typeName
  3208   * @return {String} event type name
  3209   */
  3210  HyperionEvent.prototype.typeName = function () {
  3211      return utils.extractTypeName(this._name);
  3212  };
  3213  
  3214  /**
  3215   * Should be used to get event signature
  3216   *
  3217   * @method signature
  3218   * @return {String} event signature
  3219   */
  3220  HyperionEvent.prototype.signature = function () {
  3221      return sha3(this._name);
  3222  };
  3223  
  3224  /**
  3225   * Should be used to encode indexed params and options to one final object
  3226   *
  3227   * @method encode
  3228   * @param {Object} indexed
  3229   * @param {Object} options
  3230   * @return {Object} everything combined together and encoded
  3231   */
  3232  HyperionEvent.prototype.encode = function (indexed, options) {
  3233      indexed = indexed || {};
  3234      options = options || {};
  3235      var result = {};
  3236  
  3237      ['fromBlock', 'toBlock'].filter(function (f) {
  3238          return options[f] !== undefined;
  3239      }).forEach(function (f) {
  3240          result[f] = formatters.inputBlockNumberFormatter(options[f]);
  3241      });
  3242  
  3243      result.topics = [];
  3244  
  3245      result.address = this._address;
  3246      if (!this._anonymous) {
  3247          result.topics.push('0x' + this.signature());
  3248      }
  3249  
  3250      var indexedTopics = this._params.filter(function (i) {
  3251          return i.indexed === true;
  3252      }).map(function (i) {
  3253          var value = indexed[i.name];
  3254          if (value === undefined || value === null) {
  3255              return null;
  3256          }
  3257  
  3258          if (utils.isArray(value)) {
  3259              return value.map(function (v) {
  3260                  return '0x' + coder.encodeParam(i.type, v);
  3261              });
  3262          }
  3263          return '0x' + coder.encodeParam(i.type, value);
  3264      });
  3265  
  3266      result.topics = result.topics.concat(indexedTopics);
  3267  
  3268      return result;
  3269  };
  3270  
  3271  /**
  3272   * Should be used to decode indexed params and options
  3273   *
  3274   * @method decode
  3275   * @param {Object} data
  3276   * @return {Object} result object with decoded indexed && not indexed params
  3277   */
  3278  HyperionEvent.prototype.decode = function (data) {
  3279  
  3280      data.data = data.data || '';
  3281      data.topics = data.topics || [];
  3282  
  3283      var argTopics = this._anonymous ? data.topics : data.topics.slice(1);
  3284      var indexedData = argTopics.map(function (topics) { return topics.slice(2); }).join("");
  3285      var indexedParams = coder.decodeParams(this.types(true), indexedData);
  3286  
  3287      var notIndexedData = data.data.slice(2);
  3288      var notIndexedParams = coder.decodeParams(this.types(false), notIndexedData);
  3289  
  3290      var result = formatters.outputLogFormatter(data);
  3291      result.event = this.displayName();
  3292      result.address = data.address;
  3293  
  3294      result.args = this._params.reduce(function (acc, current) {
  3295          acc[current.name] = current.indexed ? indexedParams.shift() : notIndexedParams.shift();
  3296          return acc;
  3297      }, {});
  3298  
  3299      delete result.data;
  3300      delete result.topics;
  3301  
  3302      return result;
  3303  };
  3304  
  3305  /**
  3306   * Should be used to create new filter object from event
  3307   *
  3308   * @method execute
  3309   * @param {Object} indexed
  3310   * @param {Object} options
  3311   * @return {Object} filter object
  3312   */
  3313  HyperionEvent.prototype.execute = function (indexed, options, callback) {
  3314  
  3315      if (utils.isFunction(arguments[arguments.length - 1])) {
  3316          callback = arguments[arguments.length - 1];
  3317          if(arguments.length === 2)
  3318              options = null;
  3319          if(arguments.length === 1) {
  3320              options = null;
  3321              indexed = {};
  3322          }
  3323      }
  3324  
  3325      var o = this.encode(indexed, options);
  3326      var formatter = this.decode.bind(this);
  3327      return new Filter(o, 'zond', this._requestManager, watches.zond(), formatter, callback);
  3328  };
  3329  
  3330  /**
  3331   * Should be used to attach event to contract object
  3332   *
  3333   * @method attachToContract
  3334   * @param {Contract}
  3335   */
  3336  HyperionEvent.prototype.attachToContract = function (contract) {
  3337      var execute = this.execute.bind(this);
  3338      var displayName = this.displayName();
  3339      if (!contract[displayName]) {
  3340          contract[displayName] = execute;
  3341      }
  3342      contract[displayName][this.typeName()] = this.execute.bind(this, contract);
  3343  };
  3344  
  3345  module.exports = HyperionEvent;
  3346  
  3347  
  3348  },{"../hyperion/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":43}],28:[function(require,module,exports){
  3349  var formatters = require('./formatters');
  3350  var utils = require('./../utils/utils');
  3351  var Method = require('./method');
  3352  var Property = require('./property');
  3353  
  3354  // TODO: refactor, so the input params are not altered.
  3355  // it's necessary to make same 'extension' work with multiple providers
  3356  var extend = function (web3) {
  3357      /* jshint maxcomplexity:5 */
  3358      var ex = function (extension) {
  3359  
  3360          var extendedObject;
  3361          if (extension.property) {
  3362              if (!web3[extension.property]) {
  3363                  web3[extension.property] = {};
  3364              }
  3365              extendedObject = web3[extension.property];
  3366          } else {
  3367              extendedObject = web3;
  3368          }
  3369  
  3370          if (extension.methods) {
  3371              extension.methods.forEach(function (method) {
  3372                  method.attachToObject(extendedObject);
  3373                  method.setRequestManager(web3._requestManager);
  3374              });
  3375          }
  3376  
  3377          if (extension.properties) {
  3378              extension.properties.forEach(function (property) {
  3379                  property.attachToObject(extendedObject);
  3380                  property.setRequestManager(web3._requestManager);
  3381              });
  3382          }
  3383      };
  3384  
  3385      ex.formatters = formatters; 
  3386      ex.utils = utils;
  3387      ex.Method = Method;
  3388      ex.Property = Property;
  3389  
  3390      return ex;
  3391  };
  3392  
  3393  
  3394  
  3395  module.exports = extend;
  3396  
  3397  
  3398  },{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(require,module,exports){
  3399  /*
  3400      This file is part of web3.js.
  3401  
  3402      web3.js is free software: you can redistribute it and/or modify
  3403      it under the terms of the GNU Lesser General Public License as published by
  3404      the Free Software Foundation, either version 3 of the License, or
  3405      (at your option) any later version.
  3406  
  3407      web3.js is distributed in the hope that it will be useful,
  3408      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3409      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3410      GNU Lesser General Public License for more details.
  3411  
  3412      You should have received a copy of the GNU Lesser General Public License
  3413      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3414  */
  3415  /** @file filter.js
  3416   * @authors:
  3417   *   Jeffrey Wilcke <jeff@ethdev.com>
  3418   *   Marek Kotewicz <marek@ethdev.com>
  3419   *   Marian Oancea <marian@ethdev.com>
  3420   *   Fabian Vogelsteller <fabian@ethdev.com>
  3421   *   Gav Wood <g@ethdev.com>
  3422   * @date 2014
  3423   */
  3424  
  3425  var formatters = require('./formatters');
  3426  var utils = require('../utils/utils');
  3427  
  3428  /**
  3429  * Converts a given topic to a hex string, but also allows null values.
  3430  *
  3431  * @param {Mixed} value
  3432  * @return {String}
  3433  */
  3434  var toTopic = function(value){
  3435  
  3436      if(value === null || typeof value === 'undefined')
  3437          return null;
  3438  
  3439      value = String(value);
  3440  
  3441      if(value.indexOf('0x') === 0)
  3442          return value;
  3443      else
  3444          return utils.fromUtf8(value);
  3445  };
  3446  
  3447  /// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones
  3448  /// @param should be string or object
  3449  /// @returns options string or object
  3450  var getOptions = function (options, type) {
  3451      /*jshint maxcomplexity: 6 */
  3452  
  3453      if (utils.isString(options)) {
  3454          return options;
  3455      }
  3456  
  3457      options = options || {};
  3458  
  3459  
  3460      switch(type) {
  3461          case 'zond':
  3462  
  3463              // make sure topics, get converted to hex
  3464              options.topics = options.topics || [];
  3465              options.topics = options.topics.map(function(topic){
  3466                  return (utils.isArray(topic)) ? topic.map(toTopic) : toTopic(topic);
  3467              });
  3468  
  3469              return {
  3470                  topics: options.topics,
  3471                  from: options.from,
  3472                  to: options.to,
  3473                  address: options.address,
  3474                  fromBlock: formatters.inputBlockNumberFormatter(options.fromBlock),
  3475                  toBlock: formatters.inputBlockNumberFormatter(options.toBlock)
  3476              };
  3477          case 'shh':
  3478              return options;
  3479      }
  3480  };
  3481  
  3482  /**
  3483  Adds the callback and sets up the methods, to iterate over the results.
  3484  
  3485  @method getLogsAtStart
  3486  @param {Object} self
  3487  @param {function} callback
  3488  */
  3489  var getLogsAtStart = function(self, callback){
  3490      // call getFilterLogs for the first watch callback start
  3491      if (!utils.isString(self.options)) {
  3492          self.get(function (err, messages) {
  3493              // don't send all the responses to all the watches again... just to self one
  3494              if (err) {
  3495                  callback(err);
  3496              }
  3497  
  3498              if(utils.isArray(messages)) {
  3499                  messages.forEach(function (message) {
  3500                      callback(null, message);
  3501                  });
  3502              }
  3503          });
  3504      }
  3505  };
  3506  
  3507  /**
  3508  Adds the callback and sets up the methods, to iterate over the results.
  3509  
  3510  @method pollFilter
  3511  @param {Object} self
  3512  */
  3513  var pollFilter = function(self) {
  3514  
  3515      var onMessage = function (error, messages) {
  3516          if (error) {
  3517              return self.callbacks.forEach(function (callback) {
  3518                  callback(error);
  3519              });
  3520          }
  3521  
  3522          if(utils.isArray(messages)) {
  3523              messages.forEach(function (message) {
  3524                  message = self.formatter ? self.formatter(message) : message;
  3525                  self.callbacks.forEach(function (callback) {
  3526                      callback(null, message);
  3527                  });
  3528              });
  3529          }
  3530      };
  3531  
  3532      self.requestManager.startPolling({
  3533          method: self.implementation.poll.call,
  3534          params: [self.filterId],
  3535      }, self.filterId, onMessage, self.stopWatching.bind(self));
  3536  
  3537  };
  3538  
  3539  var Filter = function (options, type, requestManager, methods, formatter, callback, filterCreationErrorCallback) {
  3540      var self = this;
  3541      var implementation = {};
  3542      methods.forEach(function (method) {
  3543          method.setRequestManager(requestManager);
  3544          method.attachToObject(implementation);
  3545      });
  3546      this.requestManager = requestManager;
  3547      this.options = getOptions(options, type);
  3548      this.implementation = implementation;
  3549      this.filterId = null;
  3550      this.callbacks = [];
  3551      this.getLogsCallbacks = [];
  3552      this.pollFilters = [];
  3553      this.formatter = formatter;
  3554      this.implementation.newFilter(this.options, function(error, id){
  3555          if(error) {
  3556              self.callbacks.forEach(function(cb){
  3557                  cb(error);
  3558              });
  3559              if (typeof filterCreationErrorCallback === 'function') {
  3560                filterCreationErrorCallback(error);
  3561              }
  3562          } else {
  3563              self.filterId = id;
  3564  
  3565              // check if there are get pending callbacks as a consequence
  3566              // of calling get() with filterId unassigned.
  3567              self.getLogsCallbacks.forEach(function (cb){
  3568                  self.get(cb);
  3569              });
  3570              self.getLogsCallbacks = [];
  3571  
  3572              // get filter logs for the already existing watch calls
  3573              self.callbacks.forEach(function(cb){
  3574                  getLogsAtStart(self, cb);
  3575              });
  3576              if(self.callbacks.length > 0)
  3577                  pollFilter(self);
  3578  
  3579              // start to watch immediately
  3580              if(typeof callback === 'function') {
  3581                  return self.watch(callback);
  3582              }
  3583          }
  3584      });
  3585  
  3586      return this;
  3587  };
  3588  
  3589  Filter.prototype.watch = function (callback) {
  3590      this.callbacks.push(callback);
  3591  
  3592      if(this.filterId) {
  3593          getLogsAtStart(this, callback);
  3594          pollFilter(this);
  3595      }
  3596  
  3597      return this;
  3598  };
  3599  
  3600  Filter.prototype.stopWatching = function (callback) {
  3601      this.requestManager.stopPolling(this.filterId);
  3602      this.callbacks = [];
  3603      // remove filter async
  3604      if (callback) {
  3605          this.implementation.uninstallFilter(this.filterId, callback);
  3606      } else {
  3607          return this.implementation.uninstallFilter(this.filterId);
  3608      }
  3609  };
  3610  
  3611  Filter.prototype.get = function (callback) {
  3612      var self = this;
  3613      if (utils.isFunction(callback)) {
  3614          if (this.filterId === null) {
  3615              // If filterId is not set yet, call it back
  3616              // when newFilter() assigns it.
  3617              this.getLogsCallbacks.push(callback);
  3618          } else {
  3619              this.implementation.getLogs(this.filterId, function(err, res){
  3620                  if (err) {
  3621                      callback(err);
  3622                  } else {
  3623                      callback(null, res.map(function (log) {
  3624                          return self.formatter ? self.formatter(log) : log;
  3625                      }));
  3626                  }
  3627              });
  3628          }
  3629      } else {
  3630          if (this.filterId === null) {
  3631              throw new Error('Filter ID Error: filter().get() can\'t be chained synchronous, please provide a callback for the get() method.');
  3632          }
  3633          var logs = this.implementation.getLogs(this.filterId);
  3634          return logs.map(function (log) {
  3635              return self.formatter ? self.formatter(log) : log;
  3636          });
  3637      }
  3638  
  3639      return this;
  3640  };
  3641  
  3642  module.exports = Filter;
  3643  
  3644  
  3645  },{"../utils/utils":20,"./formatters":30}],30:[function(require,module,exports){
  3646  'use strict'
  3647  
  3648  /*
  3649      This file is part of web3.js.
  3650  
  3651      web3.js is free software: you can redistribute it and/or modify
  3652      it under the terms of the GNU Lesser General Public License as published by
  3653      the Free Software Foundation, either version 3 of the License, or
  3654      (at your option) any later version.
  3655  
  3656      web3.js is distributed in the hope that it will be useful,
  3657      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3658      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3659      GNU Lesser General Public License for more details.
  3660  
  3661      You should have received a copy of the GNU Lesser General Public License
  3662      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3663  */
  3664  /**
  3665   * @file formatters.js
  3666   * @author Marek Kotewicz <marek@ethdev.com>
  3667   * @author Fabian Vogelsteller <fabian@ethdev.com>
  3668   * @date 2015
  3669   */
  3670  
  3671  var utils = require('../utils/utils');
  3672  var config = require('../utils/config');
  3673  var Iban = require('./iban');
  3674  
  3675  /**
  3676   * Should the format output to a big number
  3677   *
  3678   * @method outputBigNumberFormatter
  3679   * @param {String|Number|BigNumber}
  3680   * @returns {BigNumber} object
  3681   */
  3682  var outputBigNumberFormatter = function (number) {
  3683      return utils.toBigNumber(number);
  3684  };
  3685  
  3686  var isPredefinedBlockNumber = function (blockNumber) {
  3687      return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest' || blockNumber === 'finalized' || blockNumber === 'safe';
  3688  };
  3689  
  3690  var inputDefaultBlockNumberFormatter = function (blockNumber) {
  3691      if (blockNumber === undefined) {
  3692          return config.defaultBlock;
  3693      }
  3694      return inputBlockNumberFormatter(blockNumber);
  3695  };
  3696  
  3697  var inputBlockNumberFormatter = function (blockNumber) {
  3698      if (blockNumber === undefined) {
  3699          return undefined;
  3700      } else if (isPredefinedBlockNumber(blockNumber)) {
  3701          return blockNumber;
  3702      }
  3703      return utils.toHex(blockNumber);
  3704  };
  3705  
  3706  /**
  3707   * Formats the input of a transaction and converts all values to HEX
  3708   *
  3709   * @method inputCallFormatter
  3710   * @param {Object} transaction options
  3711   * @returns object
  3712  */
  3713  var inputCallFormatter = function (options){
  3714  
  3715      options.from = options.from || config.defaultAccount;
  3716  
  3717      if (options.from) {
  3718          options.from = inputAddressFormatter(options.from);
  3719      }
  3720  
  3721      if (options.to) { // it might be contract creation
  3722          options.to = inputAddressFormatter(options.to);
  3723      }
  3724  
  3725      ['maxFeePerGas', 'maxPriorityFeePerGas',  'gas', 'value', 'nonce'].filter(function (key) {
  3726          return options[key] !== undefined;
  3727      }).forEach(function(key){
  3728          options[key] = utils.fromDecimal(options[key]);
  3729      });
  3730  
  3731      return options;
  3732  };
  3733  
  3734  /**
  3735   * Formats the input of a transaction and converts all values to HEX
  3736   *
  3737   * @method inputTransactionFormatter
  3738   * @param {Object} transaction options
  3739   * @returns object
  3740  */
  3741  var inputTransactionFormatter = function (options){
  3742  
  3743      options.from = options.from || config.defaultAccount;
  3744      options.from = inputAddressFormatter(options.from);
  3745  
  3746      if (options.to) { // it might be contract creation
  3747          options.to = inputAddressFormatter(options.to);
  3748      }
  3749  
  3750      ['maxFeePerGas', 'maxPriorityFeePerGas', 'gas', 'value', 'nonce'].filter(function (key) {
  3751          return options[key] !== undefined;
  3752      }).forEach(function(key){
  3753          options[key] = utils.fromDecimal(options[key]);
  3754      });
  3755  
  3756      return options;
  3757  };
  3758  
  3759  /**
  3760   * Formats the output of a transaction to its proper values
  3761   *
  3762   * @method outputTransactionFormatter
  3763   * @param {Object} tx
  3764   * @returns {Object}
  3765  */
  3766  var outputTransactionFormatter = function (tx){
  3767      if(tx.blockNumber !== null)
  3768          tx.blockNumber = utils.toDecimal(tx.blockNumber);
  3769      if(tx.transactionIndex !== null)
  3770          tx.transactionIndex = utils.toDecimal(tx.transactionIndex);
  3771      tx.nonce = utils.toDecimal(tx.nonce);
  3772      tx.gas = utils.toDecimal(tx.gas);
  3773      if(tx.maxFeePerGas !== undefined) {
  3774        tx.maxFeePerGas = utils.toBigNumber(tx.maxFeePerGas);
  3775      }
  3776      if(tx.maxPriorityFeePerGas !== undefined) {
  3777        tx.maxPriorityFeePerGas = utils.toBigNumber(tx.maxPriorityFeePerGas);
  3778      }
  3779      tx.value = utils.toBigNumber(tx.value);
  3780      return tx;
  3781  };
  3782  
  3783  /**
  3784   * Formats the output of a transaction receipt to its proper values
  3785   *
  3786   * @method outputTransactionReceiptFormatter
  3787   * @param {Object} receipt
  3788   * @returns {Object}
  3789  */
  3790  var outputTransactionReceiptFormatter = function (receipt){
  3791      if(receipt.blockNumber !== null)
  3792          receipt.blockNumber = utils.toDecimal(receipt.blockNumber);
  3793      if(receipt.transactionIndex !== null)
  3794          receipt.transactionIndex = utils.toDecimal(receipt.transactionIndex);
  3795      receipt.cumulativeGasUsed = utils.toDecimal(receipt.cumulativeGasUsed);
  3796      receipt.gasUsed = utils.toDecimal(receipt.gasUsed);
  3797      if(receipt.effectiveGasPrice !== undefined) {
  3798        receipt.effectiveGasPrice = utils.toBigNumber(receipt.effectiveGasPrice);
  3799      }
  3800      if(utils.isArray(receipt.logs)) {
  3801          receipt.logs = receipt.logs.map(function(log){
  3802              return outputLogFormatter(log);
  3803          });
  3804      }
  3805  
  3806      return receipt;
  3807  };
  3808  
  3809  /**
  3810   * Formats the output of a block to its proper values
  3811   *
  3812   * @method outputBlockFormatter
  3813   * @param {Object} block
  3814   * @returns {Object}
  3815  */
  3816  var outputBlockFormatter = function(block) {
  3817      // transform to number
  3818      if (block.baseFeePerGas !== undefined) {
  3819        block.baseFeePerGas = utils.toBigNumber(block.baseFeePerGas);
  3820      }
  3821      block.gasLimit = utils.toDecimal(block.gasLimit);
  3822      block.gasUsed = utils.toDecimal(block.gasUsed);
  3823      block.size = utils.toDecimal(block.size);
  3824      block.timestamp = utils.toDecimal(block.timestamp);
  3825      if(block.number !== null)
  3826          block.number = utils.toDecimal(block.number);
  3827  
  3828      if (utils.isArray(block.transactions)) {
  3829          block.transactions.forEach(function(item){
  3830              if(!utils.isString(item))
  3831                  return outputTransactionFormatter(item);
  3832          });
  3833      }
  3834  
  3835      return block;
  3836  };
  3837  
  3838  /**
  3839   * Formats the output of a log
  3840   *
  3841   * @method outputLogFormatter
  3842   * @param {Object} log object
  3843   * @returns {Object} log
  3844  */
  3845  var outputLogFormatter = function(log) {
  3846      if(log.blockNumber)
  3847          log.blockNumber = utils.toDecimal(log.blockNumber);
  3848      if(log.transactionIndex)
  3849          log.transactionIndex = utils.toDecimal(log.transactionIndex);
  3850      if(log.logIndex)
  3851          log.logIndex = utils.toDecimal(log.logIndex);
  3852  
  3853      return log;
  3854  };
  3855  
  3856  /**
  3857   * Formats the input of a whisper post and converts all values to HEX
  3858   *
  3859   * @method inputPostFormatter
  3860   * @param {Object} transaction object
  3861   * @returns {Object}
  3862  */
  3863  var inputPostFormatter = function(post) {
  3864  
  3865      // post.payload = utils.toHex(post.payload);
  3866      post.ttl = utils.fromDecimal(post.ttl);
  3867      post.workToProve = utils.fromDecimal(post.workToProve);
  3868      post.priority = utils.fromDecimal(post.priority);
  3869  
  3870      // fallback
  3871      if (!utils.isArray(post.topics)) {
  3872          post.topics = post.topics ? [post.topics] : [];
  3873      }
  3874  
  3875      // format the following options
  3876      post.topics = post.topics.map(function(topic){
  3877          // convert only if not hex
  3878          return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);
  3879      });
  3880  
  3881      return post;
  3882  };
  3883  
  3884  /**
  3885   * Formats the output of a received post message
  3886   *
  3887   * @method outputPostFormatter
  3888   * @param {Object}
  3889   * @returns {Object}
  3890   */
  3891  var outputPostFormatter = function(post){
  3892  
  3893      post.expiry = utils.toDecimal(post.expiry);
  3894      post.sent = utils.toDecimal(post.sent);
  3895      post.ttl = utils.toDecimal(post.ttl);
  3896      post.workProved = utils.toDecimal(post.workProved);
  3897      // post.payloadRaw = post.payload;
  3898      // post.payload = utils.toAscii(post.payload);
  3899  
  3900      // if (utils.isJson(post.payload)) {
  3901      //     post.payload = JSON.parse(post.payload);
  3902      // }
  3903  
  3904      // format the following options
  3905      if (!post.topics) {
  3906          post.topics = [];
  3907      }
  3908      post.topics = post.topics.map(function(topic){
  3909          return utils.toAscii(topic);
  3910      });
  3911  
  3912      return post;
  3913  };
  3914  
  3915  var inputAddressFormatter = function (address) {
  3916      var iban = new Iban(address);
  3917      if (iban.isValid() && iban.isDirect()) {
  3918          return 'Z' + iban.address();
  3919      } else if (utils.isStrictAddress(address)) {
  3920          return address;
  3921      } else if (utils.isAddress(address)) {
  3922          return 'Z' + address;
  3923      }
  3924      throw new Error('invalid address');
  3925  };
  3926  
  3927  
  3928  var outputSyncingFormatter = function(result) {
  3929      if (!result) {
  3930          return result;
  3931      }
  3932  
  3933      result.startingBlock = utils.toDecimal(result.startingBlock);
  3934      result.currentBlock = utils.toDecimal(result.currentBlock);
  3935      result.highestBlock = utils.toDecimal(result.highestBlock);
  3936      result.syncedAccounts = utils.toDecimal(result.syncedAccounts);
  3937      result.syncedAccountBytes = utils.toDecimal(result.syncedAccountBytes);
  3938      result.syncedBytecodes = utils.toDecimal(result.syncedBytecodes);
  3939      result.syncedBytecodeBytes = utils.toDecimal(result.syncedBytecodeBytes);
  3940      result.syncedStorage = utils.toDecimal(result.syncedStorage);
  3941      result.syncedStorageBytes = utils.toDecimal(result.syncedStorageBytes);
  3942      result.healedTrienodes = utils.toDecimal(result.healedTrienodes);
  3943      result.healedTrienodeBytes = utils.toDecimal(result.healedTrienodeBytes);
  3944      result.healedBytecodes = utils.toDecimal(result.healedBytecodes);
  3945      result.healedBytecodeBytes = utils.toDecimal(result.healedBytecodeBytes);
  3946      result.healingTrienodes = utils.toDecimal(result.healingTrienodes);
  3947      result.healingBytecode = utils.toDecimal(result.healingBytecode);
  3948  
  3949      return result;
  3950  };
  3951  
  3952  module.exports = {
  3953      inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
  3954      inputBlockNumberFormatter: inputBlockNumberFormatter,
  3955      inputCallFormatter: inputCallFormatter,
  3956      inputTransactionFormatter: inputTransactionFormatter,
  3957      inputAddressFormatter: inputAddressFormatter,
  3958      inputPostFormatter: inputPostFormatter,
  3959      outputBigNumberFormatter: outputBigNumberFormatter,
  3960      outputTransactionFormatter: outputTransactionFormatter,
  3961      outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,
  3962      outputBlockFormatter: outputBlockFormatter,
  3963      outputLogFormatter: outputLogFormatter,
  3964      outputPostFormatter: outputPostFormatter,
  3965      outputSyncingFormatter: outputSyncingFormatter
  3966  };
  3967  
  3968  
  3969  },{"../utils/config":18,"../utils/utils":20,"./iban":33}],31:[function(require,module,exports){
  3970  /*
  3971      This file is part of web3.js.
  3972  
  3973      web3.js is free software: you can redistribute it and/or modify
  3974      it under the terms of the GNU Lesser General Public License as published by
  3975      the Free Software Foundation, either version 3 of the License, or
  3976      (at your option) any later version.
  3977  
  3978      web3.js is distributed in the hope that it will be useful,
  3979      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3980      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3981      GNU Lesser General Public License for more details.
  3982  
  3983      You should have received a copy of the GNU Lesser General Public License
  3984      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3985  */
  3986  /**
  3987   * @file function.js
  3988   * @author Marek Kotewicz <marek@ethdev.com>
  3989   * @date 2015
  3990   */
  3991  
  3992  var coder = require('../hyperion/coder');
  3993  var utils = require('../utils/utils');
  3994  var errors = require('./errors');
  3995  var formatters = require('./formatters');
  3996  var sha3 = require('../utils/sha3');
  3997  
  3998  /**
  3999   * This prototype should be used to call/sendTransaction to hyperion functions
  4000   */
  4001  var HyperionFunction = function (zond, json, address) {
  4002      this._zond = zond;
  4003      this._inputTypes = json.inputs.map(function (i) {
  4004          return i.type;
  4005      });
  4006      this._outputTypes = json.outputs.map(function (i) {
  4007          return i.type;
  4008      });
  4009      this._constant = json.constant;
  4010      this._payable = json.payable;
  4011      this._name = utils.transformToFullName(json);
  4012      this._address = address;
  4013  };
  4014  
  4015  HyperionFunction.prototype.extractCallback = function (args) {
  4016      if (utils.isFunction(args[args.length - 1])) {
  4017          return args.pop(); // modify the args array!
  4018      }
  4019  };
  4020  
  4021  HyperionFunction.prototype.extractDefaultBlock = function (args) {
  4022      if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) {
  4023          return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array!
  4024      }
  4025  };
  4026  
  4027  /**
  4028   * Should be called to check if the number of arguments is correct
  4029   *
  4030   * @method validateArgs
  4031   * @param {Array} arguments
  4032   * @throws {Error} if it is not
  4033   */
  4034  HyperionFunction.prototype.validateArgs = function (args) {
  4035      var inputArgs = args.filter(function (a) {
  4036        // filter the options object but not arguments that are arrays
  4037        return !( (utils.isObject(a) === true) &&
  4038                  (utils.isArray(a) === false) &&
  4039                  (utils.isBigNumber(a) === false)
  4040                );
  4041      });
  4042      if (inputArgs.length !== this._inputTypes.length) {
  4043          throw errors.InvalidNumberOfHyperionArgs();
  4044      }
  4045  };
  4046  
  4047  /**
  4048   * Should be used to create payload from arguments
  4049   *
  4050   * @method toPayload
  4051   * @param {Array} hyperion function params
  4052   * @param {Object} optional payload options
  4053   */
  4054  HyperionFunction.prototype.toPayload = function (args) {
  4055      var options = {};
  4056      if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
  4057          options = args[args.length - 1];
  4058      }
  4059      this.validateArgs(args);
  4060      options.to = this._address;
  4061      options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
  4062      return options;
  4063  };
  4064  
  4065  /**
  4066   * Should be used to get function signature
  4067   *
  4068   * @method signature
  4069   * @return {String} function signature
  4070   */
  4071  HyperionFunction.prototype.signature = function () {
  4072      return sha3(this._name).slice(0, 8);
  4073  };
  4074  
  4075  
  4076  HyperionFunction.prototype.unpackOutput = function (output) {
  4077      if (!output) {
  4078          return;
  4079      }
  4080  
  4081      output = output.length >= 2 ? output.slice(2) : output;
  4082      var result = coder.decodeParams(this._outputTypes, output);
  4083      return result.length === 1 ? result[0] : result;
  4084  };
  4085  
  4086  /**
  4087   * Calls a contract function.
  4088   *
  4089   * @method call
  4090   * @param {...Object} Contract function arguments
  4091   * @param {function} If the last argument is a function, the contract function
  4092   *   call will be asynchronous, and the callback will be passed the
  4093   *   error and result.
  4094   * @return {String} output bytes
  4095   */
  4096  HyperionFunction.prototype.call = function () {
  4097      var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
  4098      var callback = this.extractCallback(args);
  4099      var defaultBlock = this.extractDefaultBlock(args);
  4100      var payload = this.toPayload(args);
  4101  
  4102  
  4103      if (!callback) {
  4104          var output = this._zond.call(payload, defaultBlock);
  4105          return this.unpackOutput(output);
  4106      }
  4107  
  4108      var self = this;
  4109      this._zond.call(payload, defaultBlock, function (error, output) {
  4110          if (error) return callback(error, null);
  4111  
  4112          var unpacked = null;
  4113          try {
  4114              unpacked = self.unpackOutput(output);
  4115          }
  4116          catch (e) {
  4117              error = e;
  4118          }
  4119  
  4120          callback(error, unpacked);
  4121      });
  4122  };
  4123  
  4124  /**
  4125   * Should be used to sendTransaction to hyperion function
  4126   *
  4127   * @method sendTransaction
  4128   */
  4129  HyperionFunction.prototype.sendTransaction = function () {
  4130      var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
  4131      var callback = this.extractCallback(args);
  4132      var payload = this.toPayload(args);
  4133  
  4134      if (payload.value > 0 && !this._payable) {
  4135          throw new Error('Cannot send value to non-payable function');
  4136      }
  4137  
  4138      if (!callback) {
  4139          return this._zond.sendTransaction(payload);
  4140      }
  4141  
  4142      this._zond.sendTransaction(payload, callback);
  4143  };
  4144  
  4145  /**
  4146   * Should be used to estimateGas of hyperion function
  4147   *
  4148   * @method estimateGas
  4149   */
  4150  HyperionFunction.prototype.estimateGas = function () {
  4151      var args = Array.prototype.slice.call(arguments);
  4152      var callback = this.extractCallback(args);
  4153      var payload = this.toPayload(args);
  4154  
  4155      if (!callback) {
  4156          return this._zond.estimateGas(payload);
  4157      }
  4158  
  4159      this._zond.estimateGas(payload, callback);
  4160  };
  4161  
  4162  /**
  4163   * Return the encoded data of the call
  4164   *
  4165   * @method getData
  4166   * @return {String} the encoded data
  4167   */
  4168  HyperionFunction.prototype.getData = function () {
  4169      var args = Array.prototype.slice.call(arguments);
  4170      var payload = this.toPayload(args);
  4171  
  4172      return payload.data;
  4173  };
  4174  
  4175  /**
  4176   * Should be used to get function display name
  4177   *
  4178   * @method displayName
  4179   * @return {String} display name of the function
  4180   */
  4181  HyperionFunction.prototype.displayName = function () {
  4182      return utils.extractDisplayName(this._name);
  4183  };
  4184  
  4185  /**
  4186   * Should be used to get function type name
  4187   *
  4188   * @method typeName
  4189   * @return {String} type name of the function
  4190   */
  4191  HyperionFunction.prototype.typeName = function () {
  4192      return utils.extractTypeName(this._name);
  4193  };
  4194  
  4195  /**
  4196   * Should be called to get rpc requests from hyperion function
  4197   *
  4198   * @method request
  4199   * @returns {Object}
  4200   */
  4201  HyperionFunction.prototype.request = function () {
  4202      var args = Array.prototype.slice.call(arguments);
  4203      var callback = this.extractCallback(args);
  4204      var payload = this.toPayload(args);
  4205      var format = this.unpackOutput.bind(this);
  4206  
  4207      return {
  4208          method: this._constant ? 'zond_call' : 'zond_sendTransaction',
  4209          callback: callback,
  4210          params: [payload],
  4211          format: format
  4212      };
  4213  };
  4214  
  4215  /**
  4216   * Should be called to execute function
  4217   *
  4218   * @method execute
  4219   */
  4220  HyperionFunction.prototype.execute = function () {
  4221      var transaction = !this._constant;
  4222  
  4223      // send transaction
  4224      if (transaction) {
  4225          return this.sendTransaction.apply(this, Array.prototype.slice.call(arguments));
  4226      }
  4227  
  4228      // call
  4229      return this.call.apply(this, Array.prototype.slice.call(arguments));
  4230  };
  4231  
  4232  /**
  4233   * Should be called to attach function to contract
  4234   *
  4235   * @method attachToContract
  4236   * @param {Contract}
  4237   */
  4238  HyperionFunction.prototype.attachToContract = function (contract) {
  4239      var execute = this.execute.bind(this);
  4240      execute.request = this.request.bind(this);
  4241      execute.call = this.call.bind(this);
  4242      execute.sendTransaction = this.sendTransaction.bind(this);
  4243      execute.estimateGas = this.estimateGas.bind(this);
  4244      execute.getData = this.getData.bind(this);
  4245      var displayName = this.displayName();
  4246      if (!contract[displayName]) {
  4247          contract[displayName] = execute;
  4248      }
  4249      contract[displayName][this.typeName()] = execute; // circular!!!!
  4250  };
  4251  
  4252  module.exports = HyperionFunction;
  4253  },{"../hyperion/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(require,module,exports){
  4254  /*
  4255      This file is part of web3.js.
  4256  
  4257      web3.js is free software: you can redistribute it and/or modify
  4258      it under the terms of the GNU Lesser General Public License as published by
  4259      the Free Software Foundation, either version 3 of the License, or
  4260      (at your option) any later version.
  4261  
  4262      web3.js is distributed in the hope that it will be useful,
  4263      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4264      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4265      GNU Lesser General Public License for more details.
  4266  
  4267      You should have received a copy of the GNU Lesser General Public License
  4268      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4269  */
  4270  /** @file httpprovider.js
  4271   * @authors:
  4272   *   Marek Kotewicz <marek@ethdev.com>
  4273   *   Marian Oancea <marian@ethdev.com>
  4274   *   Fabian Vogelsteller <fabian@ethdev.com>
  4275   * @date 2015
  4276   */
  4277  
  4278  var errors = require('./errors');
  4279  
  4280  // workaround to use httpprovider in different envs
  4281  
  4282  // browser
  4283  if (typeof window !== 'undefined' && window.XMLHttpRequest) {
  4284    XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line
  4285  // node
  4286  } else {
  4287    XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line
  4288  }
  4289  
  4290  var XHR2 = require('xhr2'); // jshint ignore: line
  4291  
  4292  /**
  4293   * HttpProvider should be used to send rpc calls over http
  4294   */
  4295  var HttpProvider = function (host, timeout, user, password) {
  4296    this.host = host || 'http://localhost:8545';
  4297    this.timeout = timeout || 0;
  4298    this.user = user;
  4299    this.password = password;
  4300  };
  4301  
  4302  /**
  4303   * Should be called to prepare new XMLHttpRequest
  4304   *
  4305   * @method prepareRequest
  4306   * @param {Boolean} true if request should be async
  4307   * @return {XMLHttpRequest} object
  4308   */
  4309  HttpProvider.prototype.prepareRequest = function (async) {
  4310    var request;
  4311  
  4312    if (async) {
  4313      request = new XHR2();
  4314      request.timeout = this.timeout;
  4315    } else {
  4316      request = new XMLHttpRequest();
  4317    }
  4318  
  4319    request.open('POST', this.host, async);
  4320    if (this.user && this.password) {
  4321      var auth = 'Basic ' + new Buffer(this.user + ':' + this.password).toString('base64');
  4322      request.setRequestHeader('Authorization', auth);
  4323    } request.setRequestHeader('Content-Type', 'application/json');
  4324    return request;
  4325  };
  4326  
  4327  /**
  4328   * Should be called to make sync request
  4329   *
  4330   * @method send
  4331   * @param {Object} payload
  4332   * @return {Object} result
  4333   */
  4334  HttpProvider.prototype.send = function (payload) {
  4335    var request = this.prepareRequest(false);
  4336  
  4337    try {
  4338      request.send(JSON.stringify(payload));
  4339    } catch (error) {
  4340      throw errors.InvalidConnection(this.host);
  4341    }
  4342  
  4343    var result = request.responseText;
  4344  
  4345    try {
  4346      result = JSON.parse(result);
  4347    } catch (e) {
  4348      throw errors.InvalidResponse(request.responseText);
  4349    }
  4350  
  4351    return result;
  4352  };
  4353  
  4354  /**
  4355   * Should be used to make async request
  4356   *
  4357   * @method sendAsync
  4358   * @param {Object} payload
  4359   * @param {Function} callback triggered on end with (err, result)
  4360   */
  4361  HttpProvider.prototype.sendAsync = function (payload, callback) {
  4362    var request = this.prepareRequest(true);
  4363  
  4364    request.onreadystatechange = function () {
  4365      if (request.readyState === 4 && request.timeout !== 1) {
  4366        var result = request.responseText;
  4367        var error = null;
  4368  
  4369        try {
  4370          result = JSON.parse(result);
  4371        } catch (e) {
  4372          error = errors.InvalidResponse(request.responseText);
  4373        }
  4374  
  4375        callback(error, result);
  4376      }
  4377    };
  4378  
  4379    request.ontimeout = function () {
  4380      callback(errors.ConnectionTimeout(this.timeout));
  4381    };
  4382  
  4383    try {
  4384      request.send(JSON.stringify(payload));
  4385    } catch (error) {
  4386      callback(errors.InvalidConnection(this.host));
  4387    }
  4388  };
  4389  
  4390  /**
  4391   * Synchronously tries to make Http request
  4392   *
  4393   * @method isConnected
  4394   * @return {Boolean} returns true if request haven't failed. Otherwise false
  4395   */
  4396  HttpProvider.prototype.isConnected = function () {
  4397    try {
  4398      this.send({
  4399        id: 9999999999,
  4400        jsonrpc: '2.0',
  4401        method: 'net_listening',
  4402        params: []
  4403      });
  4404      return true;
  4405    } catch (e) {
  4406      return false;
  4407    }
  4408  };
  4409  
  4410  module.exports = HttpProvider;
  4411  
  4412  },{"./errors":26,"xhr2":86,"xmlhttprequest":17}],33:[function(require,module,exports){
  4413  /*
  4414      This file is part of web3.js.
  4415  
  4416      web3.js is free software: you can redistribute it and/or modify
  4417      it under the terms of the GNU Lesser General Public License as published by
  4418      the Free Software Foundation, either version 3 of the License, or
  4419      (at your option) any later version.
  4420  
  4421      web3.js is distributed in the hope that it will be useful,
  4422      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4423      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4424      GNU Lesser General Public License for more details.
  4425  
  4426      You should have received a copy of the GNU Lesser General Public License
  4427      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4428  */
  4429  /** 
  4430   * @file iban.js
  4431   * @author Marek Kotewicz <marek@ethdev.com>
  4432   * @date 2015
  4433   */
  4434  
  4435  var BigNumber = require('bignumber.js');
  4436  
  4437  var padLeft = function (string, bytes) {
  4438      var result = string;
  4439      while (result.length < bytes * 2) {
  4440          result = '0' + result;
  4441      }
  4442      return result;
  4443  };
  4444  
  4445  /**
  4446   * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to
  4447   * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.
  4448   *
  4449   * @method iso13616Prepare
  4450   * @param {String} iban the IBAN
  4451   * @returns {String} the prepared IBAN
  4452   */
  4453  var iso13616Prepare = function (iban) {
  4454      var A = 'A'.charCodeAt(0);
  4455      var Z = 'Z'.charCodeAt(0);
  4456  
  4457      iban = iban.toUpperCase();
  4458      iban = iban.substr(4) + iban.substr(0,4);
  4459  
  4460      return iban.split('').map(function(n){
  4461          var code = n.charCodeAt(0);
  4462          if (code >= A && code <= Z){
  4463              // A = 10, B = 11, ... Z = 35
  4464              return code - A + 10;
  4465          } else {
  4466              return n;
  4467          }
  4468      }).join('');
  4469  };
  4470  
  4471  /**
  4472   * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.
  4473   *
  4474   * @method mod9710
  4475   * @param {String} iban
  4476   * @returns {Number}
  4477   */
  4478  var mod9710 = function (iban) {
  4479      var remainder = iban,
  4480          block;
  4481  
  4482      while (remainder.length > 2){
  4483          block = remainder.slice(0, 9);
  4484          remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);
  4485      }
  4486  
  4487      return parseInt(remainder, 10) % 97;
  4488  };
  4489  
  4490  /**
  4491   * This prototype should be used to create iban object from iban correct string
  4492   *
  4493   * @param {String} iban
  4494   */
  4495  var Iban = function (iban) {
  4496      this._iban = iban;
  4497  };
  4498  
  4499  /**
  4500   * This method should be used to create iban object from zond address
  4501   *
  4502   * @method fromAddress
  4503   * @param {String} address
  4504   * @return {Iban} the IBAN object
  4505   */
  4506  Iban.fromAddress = function (address) {
  4507      var asBn = new BigNumber(address, 16);
  4508      var base36 = asBn.toString(36);
  4509      var padded = padLeft(base36, 15);
  4510      return Iban.fromBban(padded.toUpperCase());
  4511  };
  4512  
  4513  /**
  4514   * Convert the passed BBAN to an IBAN for this country specification.
  4515   * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
  4516   * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
  4517   *
  4518   * @method fromBban
  4519   * @param {String} bban the BBAN to convert to IBAN
  4520   * @returns {Iban} the IBAN object
  4521   */
  4522  Iban.fromBban = function (bban) {
  4523      var countryCode = 'XE';
  4524  
  4525      var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban));
  4526      var checkDigit = ('0' + (98 - remainder)).slice(-2);
  4527  
  4528      return new Iban(countryCode + checkDigit + bban);
  4529  };
  4530  
  4531  /**
  4532   * Should be used to create IBAN object for given institution and identifier
  4533   *
  4534   * @method createIndirect
  4535   * @param {Object} options, required options are "institution" and "identifier"
  4536   * @return {Iban} the IBAN object
  4537   */
  4538  Iban.createIndirect = function (options) {
  4539      return Iban.fromBban('ETH' + options.institution + options.identifier);
  4540  };
  4541  
  4542  /**
  4543   * Thos method should be used to check if given string is valid iban object
  4544   *
  4545   * @method isValid
  4546   * @param {String} iban string
  4547   * @return {Boolean} true if it is valid IBAN
  4548   */
  4549  Iban.isValid = function (iban) {
  4550      var i = new Iban(iban);
  4551      return i.isValid();
  4552  };
  4553  
  4554  /**
  4555   * Should be called to check if iban is correct
  4556   *
  4557   * @method isValid
  4558   * @returns {Boolean} true if it is, otherwise false
  4559   */
  4560  Iban.prototype.isValid = function () {
  4561      return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) &&
  4562          mod9710(iso13616Prepare(this._iban)) === 1;
  4563  };
  4564  
  4565  /**
  4566   * Should be called to check if iban number is direct
  4567   *
  4568   * @method isDirect
  4569   * @returns {Boolean} true if it is, otherwise false
  4570   */
  4571  Iban.prototype.isDirect = function () {
  4572      return this._iban.length === 34 || this._iban.length === 35;
  4573  };
  4574  
  4575  /**
  4576   * Should be called to check if iban number if indirect
  4577   *
  4578   * @method isIndirect
  4579   * @returns {Boolean} true if it is, otherwise false
  4580   */
  4581  Iban.prototype.isIndirect = function () {
  4582      return this._iban.length === 20;
  4583  };
  4584  
  4585  /**
  4586   * Should be called to get iban checksum
  4587   * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003)
  4588   *
  4589   * @method checksum
  4590   * @returns {String} checksum
  4591   */
  4592  Iban.prototype.checksum = function () {
  4593      return this._iban.substr(2, 2);
  4594  };
  4595  
  4596  /**
  4597   * Should be called to get institution identifier
  4598   * eg. XREG
  4599   *
  4600   * @method institution
  4601   * @returns {String} institution identifier
  4602   */
  4603  Iban.prototype.institution = function () {
  4604      return this.isIndirect() ? this._iban.substr(7, 4) : '';
  4605  };
  4606  
  4607  /**
  4608   * Should be called to get client identifier within institution
  4609   * eg. GAVOFYORK
  4610   *
  4611   * @method client
  4612   * @returns {String} client identifier
  4613   */
  4614  Iban.prototype.client = function () {
  4615      return this.isIndirect() ? this._iban.substr(11) : '';
  4616  };
  4617  
  4618  /**
  4619   * Should be called to get client direct address
  4620   *
  4621   * @method address
  4622   * @returns {String} client direct address
  4623   */
  4624  Iban.prototype.address = function () {
  4625      if (this.isDirect()) {
  4626          var base36 = this._iban.substr(4);
  4627          var asBn = new BigNumber(base36, 36);
  4628          return padLeft(asBn.toString(16), 20);
  4629      } 
  4630  
  4631      return '';
  4632  };
  4633  
  4634  Iban.prototype.toString = function () {
  4635      return this._iban;
  4636  };
  4637  
  4638  module.exports = Iban;
  4639  
  4640  
  4641  },{"bignumber.js":"bignumber.js"}],34:[function(require,module,exports){
  4642  /*
  4643      This file is part of web3.js.
  4644  
  4645      web3.js is free software: you can redistribute it and/or modify
  4646      it under the terms of the GNU Lesser General Public License as published by
  4647      the Free Software Foundation, either version 3 of the License, or
  4648      (at your option) any later version.
  4649  
  4650      web3.js is distributed in the hope that it will be useful,
  4651      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4652      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4653      GNU Lesser General Public License for more details.
  4654  
  4655      You should have received a copy of the GNU Lesser General Public License
  4656      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4657  */
  4658  /** @file ipcprovider.js
  4659   * @authors:
  4660   *   Fabian Vogelsteller <fabian@ethdev.com>
  4661   * @date 2015
  4662   */
  4663  
  4664  "use strict";
  4665  
  4666  var utils = require('../utils/utils');
  4667  var errors = require('./errors');
  4668  
  4669  
  4670  var IpcProvider = function (path, net) {
  4671      var _this = this;
  4672      this.responseCallbacks = {};
  4673      this.path = path;
  4674      
  4675      this.connection = net.connect({path: this.path});
  4676  
  4677      this.connection.on('error', function(e){
  4678          console.error('IPC Connection Error', e);
  4679          _this._timeout();
  4680      });
  4681  
  4682      this.connection.on('end', function(){
  4683          _this._timeout();
  4684      }); 
  4685  
  4686  
  4687      // LISTEN FOR CONNECTION RESPONSES
  4688      this.connection.on('data', function(data) {
  4689          /*jshint maxcomplexity: 6 */
  4690  
  4691          _this._parseResponse(data.toString()).forEach(function(result){
  4692  
  4693              var id = null;
  4694  
  4695              // get the id which matches the returned id
  4696              if(utils.isArray(result)) {
  4697                  result.forEach(function(load){
  4698                      if(_this.responseCallbacks[load.id])
  4699                          id = load.id;
  4700                  });
  4701              } else {
  4702                  id = result.id;
  4703              }
  4704  
  4705              // fire the callback
  4706              if(_this.responseCallbacks[id]) {
  4707                  _this.responseCallbacks[id](null, result);
  4708                  delete _this.responseCallbacks[id];
  4709              }
  4710          });
  4711      });
  4712  };
  4713  
  4714  /**
  4715  Will parse the response and make an array out of it.
  4716  
  4717  @method _parseResponse
  4718  @param {String} data
  4719  */
  4720  IpcProvider.prototype._parseResponse = function(data) {
  4721      var _this = this,
  4722          returnValues = [];
  4723      
  4724      // DE-CHUNKER
  4725      var dechunkedData = data
  4726          .replace(/\}[\n\r]?\{/g,'}|--|{') // }{
  4727          .replace(/\}\][\n\r]?\[\{/g,'}]|--|[{') // }][{
  4728          .replace(/\}[\n\r]?\[\{/g,'}|--|[{') // }[{
  4729          .replace(/\}\][\n\r]?\{/g,'}]|--|{') // }]{
  4730          .split('|--|');
  4731  
  4732      dechunkedData.forEach(function(data){
  4733  
  4734          // prepend the last chunk
  4735          if(_this.lastChunk)
  4736              data = _this.lastChunk + data;
  4737  
  4738          var result = null;
  4739  
  4740          try {
  4741              result = JSON.parse(data);
  4742  
  4743          } catch(e) {
  4744  
  4745              _this.lastChunk = data;
  4746  
  4747              // start timeout to cancel all requests
  4748              clearTimeout(_this.lastChunkTimeout);
  4749              _this.lastChunkTimeout = setTimeout(function(){
  4750                  _this._timeout();
  4751                  throw errors.InvalidResponse(data);
  4752              }, 1000 * 15);
  4753  
  4754              return;
  4755          }
  4756  
  4757          // cancel timeout and set chunk to null
  4758          clearTimeout(_this.lastChunkTimeout);
  4759          _this.lastChunk = null;
  4760  
  4761          if(result)
  4762              returnValues.push(result);
  4763      });
  4764  
  4765      return returnValues;
  4766  };
  4767  
  4768  
  4769  /**
  4770  Get the adds a callback to the responseCallbacks object,
  4771  which will be called if a response matching the response Id will arrive.
  4772  
  4773  @method _addResponseCallback
  4774  */
  4775  IpcProvider.prototype._addResponseCallback = function(payload, callback) {
  4776      var id = payload.id || payload[0].id;
  4777      var method = payload.method || payload[0].method;
  4778  
  4779      this.responseCallbacks[id] = callback;
  4780      this.responseCallbacks[id].method = method;
  4781  };
  4782  
  4783  /**
  4784  Timeout all requests when the end/error event is fired
  4785  
  4786  @method _timeout
  4787  */
  4788  IpcProvider.prototype._timeout = function() {
  4789      for(var key in this.responseCallbacks) {
  4790          if(this.responseCallbacks.hasOwnProperty(key)){
  4791              this.responseCallbacks[key](errors.InvalidConnection('on IPC'));
  4792              delete this.responseCallbacks[key];
  4793          }
  4794      }
  4795  };
  4796  
  4797  
  4798  /**
  4799  Check if the current connection is still valid.
  4800  
  4801  @method isConnected
  4802  */
  4803  IpcProvider.prototype.isConnected = function() {
  4804      var _this = this;
  4805  
  4806      // try reconnect, when connection is gone
  4807      if(!_this.connection.writable)
  4808          _this.connection.connect({path: _this.path});
  4809  
  4810      return !!this.connection.writable;
  4811  };
  4812  
  4813  IpcProvider.prototype.send = function (payload) {
  4814  
  4815      if(this.connection.writeSync) {
  4816          var result;
  4817  
  4818          // try reconnect, when connection is gone
  4819          if(!this.connection.writable)
  4820              this.connection.connect({path: this.path});
  4821  
  4822          var data = this.connection.writeSync(JSON.stringify(payload));
  4823  
  4824          try {
  4825              result = JSON.parse(data);
  4826          } catch(e) {
  4827              throw errors.InvalidResponse(data);                
  4828          }
  4829  
  4830          return result;
  4831  
  4832      } else {
  4833          throw new Error('You tried to send "'+ payload.method +'" synchronously. Synchronous requests are not supported by the IPC provider.');
  4834      }
  4835  };
  4836  
  4837  IpcProvider.prototype.sendAsync = function (payload, callback) {
  4838      // try reconnect, when connection is gone
  4839      if(!this.connection.writable)
  4840          this.connection.connect({path: this.path});
  4841  
  4842  
  4843      this.connection.write(JSON.stringify(payload));
  4844      this._addResponseCallback(payload, callback);
  4845  };
  4846  
  4847  module.exports = IpcProvider;
  4848  
  4849  
  4850  },{"../utils/utils":20,"./errors":26}],35:[function(require,module,exports){
  4851  /*
  4852      This file is part of web3.js.
  4853  
  4854      web3.js is free software: you can redistribute it and/or modify
  4855      it under the terms of the GNU Lesser General Public License as published by
  4856      the Free Software Foundation, either version 3 of the License, or
  4857      (at your option) any later version.
  4858  
  4859      web3.js is distributed in the hope that it will be useful,
  4860      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4861      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4862      GNU Lesser General Public License for more details.
  4863  
  4864      You should have received a copy of the GNU Lesser General Public License
  4865      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4866  */
  4867  /** @file jsonrpc.js
  4868   * @authors:
  4869   *   Marek Kotewicz <marek@ethdev.com>
  4870   *   Aaron Kumavis <aaron@kumavis.me>
  4871   * @date 2015
  4872   */
  4873  
  4874  // Initialize Jsonrpc as a simple object with utility functions.
  4875  var Jsonrpc = {
  4876      messageId: 0
  4877  };
  4878  
  4879  /**
  4880   * Should be called to valid json create payload object
  4881   *
  4882   * @method toPayload
  4883   * @param {Function} method of jsonrpc call, required
  4884   * @param {Array} params, an array of method params, optional
  4885   * @returns {Object} valid jsonrpc payload object
  4886   */
  4887  Jsonrpc.toPayload = function (method, params) {
  4888      if (!method)
  4889          console.error('jsonrpc method should be specified!');
  4890  
  4891      // advance message ID
  4892      Jsonrpc.messageId++;
  4893  
  4894      return {
  4895          jsonrpc: '2.0',
  4896          id: Jsonrpc.messageId,
  4897          method: method,
  4898          params: params || []
  4899      };
  4900  };
  4901  
  4902  /**
  4903   * Should be called to check if jsonrpc response is valid
  4904   *
  4905   * @method isValidResponse
  4906   * @param {Object}
  4907   * @returns {Boolean} true if response is valid, otherwise false
  4908   */
  4909  Jsonrpc.isValidResponse = function (response) {
  4910      return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response);
  4911  
  4912      function validateSingleMessage(message){
  4913        return !!message &&
  4914          !message.error &&
  4915          message.jsonrpc === '2.0' &&
  4916          typeof message.id === 'number' &&
  4917          message.result !== undefined; // only undefined is not valid json object
  4918      }
  4919  };
  4920  
  4921  /**
  4922   * Should be called to create batch payload object
  4923   *
  4924   * @method toBatchPayload
  4925   * @param {Array} messages, an array of objects with method (required) and params (optional) fields
  4926   * @returns {Array} batch payload
  4927   */
  4928  Jsonrpc.toBatchPayload = function (messages) {
  4929      return messages.map(function (message) {
  4930          return Jsonrpc.toPayload(message.method, message.params);
  4931      });
  4932  };
  4933  
  4934  module.exports = Jsonrpc;
  4935  
  4936  
  4937  },{}],36:[function(require,module,exports){
  4938  /*
  4939      This file is part of web3.js.
  4940  
  4941      web3.js is free software: you can redistribute it and/or modify
  4942      it under the terms of the GNU Lesser General Public License as published by
  4943      the Free Software Foundation, either version 3 of the License, or
  4944      (at your option) any later version.
  4945  
  4946      web3.js is distributed in the hope that it will be useful,
  4947      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4948      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4949      GNU Lesser General Public License for more details.
  4950  
  4951      You should have received a copy of the GNU Lesser General Public License
  4952      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4953  */
  4954  /**
  4955   * @file method.js
  4956   * @author Marek Kotewicz <marek@ethdev.com>
  4957   * @date 2015
  4958   */
  4959  
  4960  var utils = require('../utils/utils');
  4961  var errors = require('./errors');
  4962  
  4963  var Method = function (options) {
  4964      this.name = options.name;
  4965      this.call = options.call;
  4966      this.params = options.params || 0;
  4967      this.inputFormatter = options.inputFormatter;
  4968      this.outputFormatter = options.outputFormatter;
  4969      this.requestManager = null;
  4970  };
  4971  
  4972  Method.prototype.setRequestManager = function (rm) {
  4973      this.requestManager = rm;
  4974  };
  4975  
  4976  /**
  4977   * Should be used to determine name of the jsonrpc method based on arguments
  4978   *
  4979   * @method getCall
  4980   * @param {Array} arguments
  4981   * @return {String} name of jsonrpc method
  4982   */
  4983  Method.prototype.getCall = function (args) {
  4984      return utils.isFunction(this.call) ? this.call(args) : this.call;
  4985  };
  4986  
  4987  /**
  4988   * Should be used to extract callback from array of arguments. Modifies input param
  4989   *
  4990   * @method extractCallback
  4991   * @param {Array} arguments
  4992   * @return {Function|Null} callback, if exists
  4993   */
  4994  Method.prototype.extractCallback = function (args) {
  4995      if (utils.isFunction(args[args.length - 1])) {
  4996          return args.pop(); // modify the args array!
  4997      }
  4998  };
  4999  
  5000  /**
  5001   * Should be called to check if the number of arguments is correct
  5002   * 
  5003   * @method validateArgs
  5004   * @param {Array} arguments
  5005   * @throws {Error} if it is not
  5006   */
  5007  Method.prototype.validateArgs = function (args) {
  5008      if (args.length !== this.params) {
  5009          throw errors.InvalidNumberOfRPCParams();
  5010      }
  5011  };
  5012  
  5013  /**
  5014   * Should be called to format input args of method
  5015   * 
  5016   * @method formatInput
  5017   * @param {Array}
  5018   * @return {Array}
  5019   */
  5020  Method.prototype.formatInput = function (args) {
  5021      if (!this.inputFormatter) {
  5022          return args;
  5023      }
  5024  
  5025      return this.inputFormatter.map(function (formatter, index) {
  5026          return formatter ? formatter(args[index]) : args[index];
  5027      });
  5028  };
  5029  
  5030  /**
  5031   * Should be called to format output(result) of method
  5032   *
  5033   * @method formatOutput
  5034   * @param {Object}
  5035   * @return {Object}
  5036   */
  5037  Method.prototype.formatOutput = function (result) {
  5038      return this.outputFormatter && result ? this.outputFormatter(result) : result;
  5039  };
  5040  
  5041  /**
  5042   * Should create payload from given input args
  5043   *
  5044   * @method toPayload
  5045   * @param {Array} args
  5046   * @return {Object}
  5047   */
  5048  Method.prototype.toPayload = function (args) {
  5049      var call = this.getCall(args);
  5050      var callback = this.extractCallback(args);
  5051      var params = this.formatInput(args);
  5052      this.validateArgs(params);
  5053  
  5054      return {
  5055          method: call,
  5056          params: params,
  5057          callback: callback
  5058      };
  5059  };
  5060  
  5061  Method.prototype.attachToObject = function (obj) {
  5062      var func = this.buildCall();
  5063      func.call = this.call; // TODO!!! that's ugly. filter.js uses it
  5064      var name = this.name.split('.');
  5065      if (name.length > 1) {
  5066          obj[name[0]] = obj[name[0]] || {};
  5067          obj[name[0]][name[1]] = func;
  5068      } else {
  5069          obj[name[0]] = func; 
  5070      }
  5071  };
  5072  
  5073  Method.prototype.buildCall = function() {
  5074      var method = this;
  5075      var send = function () {
  5076          var payload = method.toPayload(Array.prototype.slice.call(arguments));
  5077          if (payload.callback) {
  5078              return method.requestManager.sendAsync(payload, function (err, result) {
  5079                  payload.callback(err, method.formatOutput(result));
  5080              });
  5081          }
  5082          return method.formatOutput(method.requestManager.send(payload));
  5083      };
  5084      send.request = this.request.bind(this);
  5085      return send;
  5086  };
  5087  
  5088  /**
  5089   * Should be called to create pure JSONRPC request which can be used in batch request
  5090   *
  5091   * @method request
  5092   * @param {...} params
  5093   * @return {Object} jsonrpc request
  5094   */
  5095  Method.prototype.request = function () {
  5096      var payload = this.toPayload(Array.prototype.slice.call(arguments));
  5097      payload.format = this.formatOutput.bind(this);
  5098      return payload;
  5099  };
  5100  
  5101  module.exports = Method;
  5102  
  5103  },{"../utils/utils":20,"./errors":26}],37:[function(require,module,exports){
  5104  /*
  5105      This file is part of web3.js.
  5106  
  5107      web3.js is free software: you can redistribute it and/or modify
  5108      it under the terms of the GNU Lesser General Public License as published by
  5109      the Free Software Foundation, either version 3 of the License, or
  5110      (at your option) any later version.
  5111  
  5112      web3.js is distributed in the hope that it will be useful,
  5113      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5114      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5115      GNU Lesser General Public License for more details.
  5116  
  5117      You should have received a copy of the GNU Lesser General Public License
  5118      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5119  */
  5120  /** @file db.js
  5121   * @authors:
  5122   *   Marek Kotewicz <marek@ethdev.com>
  5123   * @date 2015
  5124   */
  5125  
  5126  var Method = require('../method');
  5127  
  5128  var DB = function (web3) {
  5129      this._requestManager = web3._requestManager;
  5130  
  5131      var self = this;
  5132      
  5133      methods().forEach(function(method) { 
  5134          method.attachToObject(self);
  5135          method.setRequestManager(web3._requestManager);
  5136      });
  5137  };
  5138  
  5139  var methods = function () {
  5140      var putString = new Method({
  5141          name: 'putString',
  5142          call: 'db_putString',
  5143          params: 3
  5144      });
  5145  
  5146      var getString = new Method({
  5147          name: 'getString',
  5148          call: 'db_getString',
  5149          params: 2
  5150      });
  5151  
  5152      var putHex = new Method({
  5153          name: 'putHex',
  5154          call: 'db_putHex',
  5155          params: 3
  5156      });
  5157  
  5158      var getHex = new Method({
  5159          name: 'getHex',
  5160          call: 'db_getHex',
  5161          params: 2
  5162      });
  5163  
  5164      return [
  5165          putString, getString, putHex, getHex
  5166      ];
  5167  };
  5168  
  5169  module.exports = DB;
  5170  
  5171  },{"../method":36}],38:[function(require,module,exports){
  5172  /*
  5173      This file is part of web3.js.
  5174  
  5175      web3.js is free software: you can redistribute it and/or modify
  5176      it under the terms of the GNU Lesser General Public License as published by
  5177      the Free Software Foundation, either version 3 of the License, or
  5178      (at your option) any later version.
  5179  
  5180      web3.js is distributed in the hope that it will be useful,
  5181      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5182      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5183      GNU Lesser General Public License for more details.
  5184  
  5185      You should have received a copy of the GNU Lesser General Public License
  5186      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5187  */
  5188  /**
  5189   * @file zond.js
  5190   * @author Marek Kotewicz <marek@ethdev.com>
  5191   * @author Fabian Vogelsteller <fabian@ethdev.com>
  5192   * @date 2015
  5193   */
  5194  
  5195  "use strict";
  5196  
  5197  var formatters = require('../formatters');
  5198  var utils = require('../../utils/utils');
  5199  var Method = require('../method');
  5200  var Property = require('../property');
  5201  var c = require('../../utils/config');
  5202  var Contract = require('../contract');
  5203  var watches = require('./watches');
  5204  var Filter = require('../filter');
  5205  var IsSyncing = require('../syncing');
  5206  var namereg = require('../namereg');
  5207  var Iban = require('../iban');
  5208  var transfer = require('../transfer');
  5209  
  5210  var blockCall = function (args) {
  5211      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "zond_getBlockByHash" : "zond_getBlockByNumber";
  5212  };
  5213  
  5214  var transactionFromBlockCall = function (args) {
  5215      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'zond_getTransactionByBlockHashAndIndex' : 'zond_getTransactionByBlockNumberAndIndex';
  5216  };
  5217  
  5218  var getBlockTransactionCountCall = function (args) {
  5219      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'zond_getBlockTransactionCountByHash' : 'zond_getBlockTransactionCountByNumber';
  5220  };
  5221  
  5222  function Zond(web3) {
  5223      this._requestManager = web3._requestManager;
  5224  
  5225      var self = this;
  5226  
  5227      methods().forEach(function(method) {
  5228          method.attachToObject(self);
  5229          method.setRequestManager(self._requestManager);
  5230      });
  5231  
  5232      properties().forEach(function(p) {
  5233          p.attachToObject(self);
  5234          p.setRequestManager(self._requestManager);
  5235      });
  5236  
  5237  
  5238      this.iban = Iban;
  5239      this.sendIBANTransaction = transfer.bind(null, this);
  5240  }
  5241  
  5242  Object.defineProperty(Zond.prototype, 'defaultBlock', {
  5243      get: function () {
  5244          return c.defaultBlock;
  5245      },
  5246      set: function (val) {
  5247          c.defaultBlock = val;
  5248          return val;
  5249      }
  5250  });
  5251  
  5252  Object.defineProperty(Zond.prototype, 'defaultAccount', {
  5253      get: function () {
  5254          return c.defaultAccount;
  5255      },
  5256      set: function (val) {
  5257          c.defaultAccount = val;
  5258          return val;
  5259      }
  5260  });
  5261  
  5262  var methods = function () {
  5263      var getBalance = new Method({
  5264          name: 'getBalance',
  5265          call: 'zond_getBalance',
  5266          params: 2,
  5267          inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
  5268          outputFormatter: formatters.outputBigNumberFormatter
  5269      });
  5270  
  5271      var getStorageAt = new Method({
  5272          name: 'getStorageAt',
  5273          call: 'zond_getStorageAt',
  5274          params: 3,
  5275          inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
  5276      });
  5277  
  5278      var getCode = new Method({
  5279          name: 'getCode',
  5280          call: 'zond_getCode',
  5281          params: 2,
  5282          inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
  5283      });
  5284  
  5285      var getBlock = new Method({
  5286          name: 'getBlock',
  5287          call: blockCall,
  5288          params: 2,
  5289          inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
  5290          outputFormatter: formatters.outputBlockFormatter
  5291      });
  5292  
  5293      var getBlockTransactionCount = new Method({
  5294          name: 'getBlockTransactionCount',
  5295          call: getBlockTransactionCountCall,
  5296          params: 1,
  5297          inputFormatter: [formatters.inputBlockNumberFormatter],
  5298          outputFormatter: utils.toDecimal
  5299      });
  5300  
  5301      var getTransaction = new Method({
  5302          name: 'getTransaction',
  5303          call: 'zond_getTransactionByHash',
  5304          params: 1,
  5305          outputFormatter: formatters.outputTransactionFormatter
  5306      });
  5307  
  5308      var getTransactionFromBlock = new Method({
  5309          name: 'getTransactionFromBlock',
  5310          call: transactionFromBlockCall,
  5311          params: 2,
  5312          inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],
  5313          outputFormatter: formatters.outputTransactionFormatter
  5314      });
  5315  
  5316      var getTransactionReceipt = new Method({
  5317          name: 'getTransactionReceipt',
  5318          call: 'zond_getTransactionReceipt',
  5319          params: 1,
  5320          outputFormatter: formatters.outputTransactionReceiptFormatter
  5321      });
  5322  
  5323      var getTransactionCount = new Method({
  5324          name: 'getTransactionCount',
  5325          call: 'zond_getTransactionCount',
  5326          params: 2,
  5327          inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
  5328          outputFormatter: utils.toDecimal
  5329      });
  5330  
  5331      var sendRawTransaction = new Method({
  5332          name: 'sendRawTransaction',
  5333          call: 'zond_sendRawTransaction',
  5334          params: 1,
  5335          inputFormatter: [null]
  5336      });
  5337  
  5338      var sendTransaction = new Method({
  5339          name: 'sendTransaction',
  5340          call: 'zond_sendTransaction',
  5341          params: 1,
  5342          inputFormatter: [formatters.inputTransactionFormatter]
  5343      });
  5344  
  5345      var signTransaction = new Method({
  5346          name: 'signTransaction',
  5347          call: 'zond_signTransaction',
  5348          params: 1,
  5349          inputFormatter: [formatters.inputTransactionFormatter]
  5350      });
  5351  
  5352      var sign = new Method({
  5353          name: 'sign',
  5354          call: 'zond_sign',
  5355          params: 2,
  5356          inputFormatter: [formatters.inputAddressFormatter, null]
  5357      });
  5358  
  5359      var call = new Method({
  5360          name: 'call',
  5361          call: 'zond_call',
  5362          params: 2,
  5363          inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
  5364      });
  5365  
  5366      var estimateGas = new Method({
  5367          name: 'estimateGas',
  5368          call: 'zond_estimateGas',
  5369          params: 1,
  5370          inputFormatter: [formatters.inputCallFormatter],
  5371          outputFormatter: utils.toDecimal
  5372      });
  5373  
  5374      var compileHyperion = new Method({
  5375          name: 'compile.hyperion',
  5376          call: 'zond_compileHyperion',
  5377          params: 1
  5378      });
  5379  
  5380      return [
  5381          getBalance,
  5382          getStorageAt,
  5383          getCode,
  5384          getBlock,
  5385          getBlockTransactionCount,
  5386          getTransaction,
  5387          getTransactionFromBlock,
  5388          getTransactionReceipt,
  5389          getTransactionCount,
  5390          call,
  5391          estimateGas,
  5392          sendRawTransaction,
  5393          signTransaction,
  5394          sendTransaction,
  5395          sign,
  5396          compileHyperion
  5397      ];
  5398  };
  5399  
  5400  
  5401  var properties = function () {
  5402      return [
  5403          new Property({
  5404              name: 'syncing',
  5405              getter: 'zond_syncing',
  5406              outputFormatter: formatters.outputSyncingFormatter
  5407          }),
  5408          new Property({
  5409              name: 'gasPrice',
  5410              getter: 'zond_gasPrice',
  5411              outputFormatter: formatters.outputBigNumberFormatter
  5412          }),
  5413          new Property({
  5414              name: 'accounts',
  5415              getter: 'zond_accounts'
  5416          }),
  5417          new Property({
  5418              name: 'blockNumber',
  5419              getter: 'zond_blockNumber',
  5420              outputFormatter: utils.toDecimal
  5421          }),
  5422          new Property({
  5423              name: 'protocolVersion',
  5424              getter: 'zond_protocolVersion'
  5425          })
  5426      ];
  5427  };
  5428  
  5429  Zond.prototype.contract = function (abi) {
  5430      var factory = new Contract(this, abi);
  5431      return factory;
  5432  };
  5433  
  5434  Zond.prototype.filter = function (options, callback, filterCreationErrorCallback) {
  5435      return new Filter(options, 'zond', this._requestManager, watches.zond(), formatters.outputLogFormatter, callback, filterCreationErrorCallback);
  5436  };
  5437  
  5438  Zond.prototype.namereg = function () {
  5439      return this.contract(namereg.global.abi).at(namereg.global.address);
  5440  };
  5441  
  5442  Zond.prototype.icapNamereg = function () {
  5443      return this.contract(namereg.icap.abi).at(namereg.icap.address);
  5444  };
  5445  
  5446  Zond.prototype.isSyncing = function (callback) {
  5447      return new IsSyncing(this._requestManager, callback);
  5448  };
  5449  
  5450  module.exports = Zond;
  5451  
  5452  },{"../../utils/config":18,"../../utils/utils":20,"../contract":25,"../filter":29,"../formatters":30,"../iban":33,"../method":36,"../namereg":44,"../property":45,"../syncing":48,"../transfer":49,"./watches":43}],39:[function(require,module,exports){
  5453  /*
  5454      This file is part of web3.js.
  5455  
  5456      web3.js is free software: you can redistribute it and/or modify
  5457      it under the terms of the GNU Lesser General Public License as published by
  5458      the Free Software Foundation, either version 3 of the License, or
  5459      (at your option) any later version.
  5460  
  5461      web3.js is distributed in the hope that it will be useful,
  5462      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5463      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5464      GNU Lesser General Public License for more details.
  5465  
  5466      You should have received a copy of the GNU Lesser General Public License
  5467      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5468  */
  5469  /** @file zond.js
  5470   * @authors:
  5471   *   Marek Kotewicz <marek@ethdev.com>
  5472   * @date 2015
  5473   */
  5474  
  5475  var utils = require('../../utils/utils');
  5476  var Property = require('../property');
  5477  
  5478  var Net = function (web3) {
  5479      this._requestManager = web3._requestManager;
  5480  
  5481      var self = this;
  5482  
  5483      properties().forEach(function(p) { 
  5484          p.attachToObject(self);
  5485          p.setRequestManager(web3._requestManager);
  5486      });
  5487  };
  5488  
  5489  /// @returns an array of objects describing web3.zond api properties
  5490  var properties = function () {
  5491      return [
  5492          new Property({
  5493              name: 'listening',
  5494              getter: 'net_listening'
  5495          }),
  5496          new Property({
  5497              name: 'peerCount',
  5498              getter: 'net_peerCount',
  5499              outputFormatter: utils.toDecimal
  5500          })
  5501      ];
  5502  };
  5503  
  5504  module.exports = Net;
  5505  
  5506  },{"../../utils/utils":20,"../property":45}],40:[function(require,module,exports){},{"../formatters":30,"../method":36,"../property":45}],41:[function(require,module,exports){},{"../filter":29,"../method":36,"./watches":43}],42:[function(require,module,exports){},{"../method":36,"../property":45}],43:[function(require,module,exports){
  5507  /*
  5508      This file is part of web3.js.
  5509  
  5510      web3.js is free software: you can redistribute it and/or modify
  5511      it under the terms of the GNU Lesser General Public License as published by
  5512      the Free Software Foundation, either version 3 of the License, or
  5513      (at your option) any later version.
  5514  
  5515      web3.js is distributed in the hope that it will be useful,
  5516      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5517      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5518      GNU Lesser General Public License for more details.
  5519  
  5520      You should have received a copy of the GNU Lesser General Public License
  5521      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5522  */
  5523  /** @file watches.js
  5524   * @authors:
  5525   *   Marek Kotewicz <marek@ethdev.com>
  5526   * @date 2015
  5527   */
  5528  
  5529  var Method = require('../method');
  5530  
  5531  /// @returns an array of objects describing web3.zond.filter api methods
  5532  var zond = function () {
  5533      var newFilterCall = function (args) {
  5534          var type = args[0];
  5535  
  5536          switch(type) {
  5537              case 'latest':
  5538                  args.shift();
  5539                  this.params = 0;
  5540                  return 'zond_newBlockFilter';
  5541              case 'pending':
  5542                  args.shift();
  5543                  this.params = 0;
  5544                  return 'zond_newPendingTransactionFilter';
  5545              default:
  5546                  return 'zond_newFilter';
  5547          }
  5548      };
  5549  
  5550      var newFilter = new Method({
  5551          name: 'newFilter',
  5552          call: newFilterCall,
  5553          params: 1
  5554      });
  5555  
  5556      var uninstallFilter = new Method({
  5557          name: 'uninstallFilter',
  5558          call: 'zond_uninstallFilter',
  5559          params: 1
  5560      });
  5561  
  5562      var getLogs = new Method({
  5563          name: 'getLogs',
  5564          call: 'zond_getFilterLogs',
  5565          params: 1
  5566      });
  5567  
  5568      var poll = new Method({
  5569          name: 'poll',
  5570          call: 'zond_getFilterChanges',
  5571          params: 1
  5572      });
  5573  
  5574      return [
  5575          newFilter,
  5576          uninstallFilter,
  5577          getLogs,
  5578          poll
  5579      ];
  5580  };
  5581  
  5582  /// @returns an array of objects describing web3.shh.watch api methods
  5583  var shh = function () {
  5584  
  5585      return [
  5586          new Method({
  5587              name: 'newFilter',
  5588              call: 'shh_newMessageFilter',
  5589              params: 1
  5590          }),
  5591          new Method({
  5592              name: 'uninstallFilter',
  5593              call: 'shh_deleteMessageFilter',
  5594              params: 1
  5595          }),
  5596          new Method({
  5597              name: 'getLogs',
  5598              call: 'shh_getFilterMessages',
  5599              params: 1
  5600          }),
  5601          new Method({
  5602              name: 'poll',
  5603              call: 'shh_getFilterMessages',
  5604              params: 1
  5605          })
  5606      ];
  5607  };
  5608  
  5609  module.exports = {
  5610      zond: zond,
  5611      shh: shh
  5612  };
  5613  
  5614  
  5615  },{"../method":36}],44:[function(require,module,exports){
  5616  /*
  5617      This file is part of web3.js.
  5618  
  5619      web3.js is free software: you can redistribute it and/or modify
  5620      it under the terms of the GNU Lesser General Public License as published by
  5621      the Free Software Foundation, either version 3 of the License, or
  5622      (at your option) any later version.
  5623  
  5624      web3.js is distributed in the hope that it will be useful,
  5625      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5626      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5627      GNU Lesser General Public License for more details.
  5628  
  5629      You should have received a copy of the GNU Lesser General Public License
  5630      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5631  */
  5632  /** 
  5633   * @file namereg.js
  5634   * @author Marek Kotewicz <marek@ethdev.com>
  5635   * @date 2015
  5636   */
  5637  
  5638  var globalRegistrarAbi = require('../contracts/GlobalRegistrar.json');
  5639  var icapRegistrarAbi= require('../contracts/ICAPRegistrar.json');
  5640  
  5641  var globalNameregAddress = 'Zc6d9d2cd449a754c494264e1809c50e34d64562b';
  5642  var icapNameregAddress = 'Za1a111bc074c9cfa781f0c38e63bd51c91b8af00';
  5643  
  5644  module.exports = {
  5645      global: {
  5646          abi: globalRegistrarAbi,
  5647          address: globalNameregAddress
  5648      },
  5649      icap: {
  5650          abi: icapRegistrarAbi,
  5651          address: icapNameregAddress
  5652      }
  5653  };
  5654  
  5655  
  5656  },{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2}],45:[function(require,module,exports){
  5657  /*
  5658      This file is part of web3.js.
  5659  
  5660      web3.js is free software: you can redistribute it and/or modify
  5661      it under the terms of the GNU Lesser General Public License as published by
  5662      the Free Software Foundation, either version 3 of the License, or
  5663      (at your option) any later version.
  5664  
  5665      web3.js is distributed in the hope that it will be useful,
  5666      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5667      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5668      GNU Lesser General Public License for more details.
  5669  
  5670      You should have received a copy of the GNU Lesser General Public License
  5671      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5672  */
  5673  /**
  5674   * @file property.js
  5675   * @author Fabian Vogelsteller <fabian@frozeman.de>
  5676   * @author Marek Kotewicz <marek@ethdev.com>
  5677   * @date 2015
  5678   */
  5679  
  5680  var utils = require('../utils/utils');
  5681  
  5682  var Property = function (options) {
  5683      this.name = options.name;
  5684      this.getter = options.getter;
  5685      this.setter = options.setter;
  5686      this.outputFormatter = options.outputFormatter;
  5687      this.inputFormatter = options.inputFormatter;
  5688      this.requestManager = null;
  5689  };
  5690  
  5691  Property.prototype.setRequestManager = function (rm) {
  5692      this.requestManager = rm;
  5693  };
  5694  
  5695  /**
  5696   * Should be called to format input args of method
  5697   *
  5698   * @method formatInput
  5699   * @param {Array}
  5700   * @return {Array}
  5701   */
  5702  Property.prototype.formatInput = function (arg) {
  5703      return this.inputFormatter ? this.inputFormatter(arg) : arg;
  5704  };
  5705  
  5706  /**
  5707   * Should be called to format output(result) of method
  5708   *
  5709   * @method formatOutput
  5710   * @param {Object}
  5711   * @return {Object}
  5712   */
  5713  Property.prototype.formatOutput = function (result) {
  5714      return this.outputFormatter && result !== null && result !== undefined ? this.outputFormatter(result) : result;
  5715  };
  5716  
  5717  /**
  5718   * Should be used to extract callback from array of arguments. Modifies input param
  5719   *
  5720   * @method extractCallback
  5721   * @param {Array} arguments
  5722   * @return {Function|Null} callback, if exists
  5723   */
  5724  Property.prototype.extractCallback = function (args) {
  5725      if (utils.isFunction(args[args.length - 1])) {
  5726          return args.pop(); // modify the args array!
  5727      }
  5728  };
  5729  
  5730  
  5731  /**
  5732   * Should attach function to method
  5733   *
  5734   * @method attachToObject
  5735   * @param {Object}
  5736   * @param {Function}
  5737   */
  5738  Property.prototype.attachToObject = function (obj) {
  5739      var proto = {
  5740          get: this.buildGet(),
  5741          enumerable: true
  5742      };
  5743  
  5744      var names = this.name.split('.');
  5745      var name = names[0];
  5746      if (names.length > 1) {
  5747          obj[names[0]] = obj[names[0]] || {};
  5748          obj = obj[names[0]];
  5749          name = names[1];
  5750      }
  5751  
  5752      Object.defineProperty(obj, name, proto);
  5753      obj[asyncGetterName(name)] = this.buildAsyncGet();
  5754  };
  5755  
  5756  var asyncGetterName = function (name) {
  5757      return 'get' + name.charAt(0).toUpperCase() + name.slice(1);
  5758  };
  5759  
  5760  Property.prototype.buildGet = function () {
  5761      var property = this;
  5762      return function get() {
  5763          return property.formatOutput(property.requestManager.send({
  5764              method: property.getter
  5765          }));
  5766      };
  5767  };
  5768  
  5769  Property.prototype.buildAsyncGet = function () {
  5770      var property = this;
  5771      var get = function (callback) {
  5772          property.requestManager.sendAsync({
  5773              method: property.getter
  5774          }, function (err, result) {
  5775              callback(err, property.formatOutput(result));
  5776          });
  5777      };
  5778      get.request = this.request.bind(this);
  5779      return get;
  5780  };
  5781  
  5782  /**
  5783   * Should be called to create pure JSONRPC request which can be used in batch request
  5784   *
  5785   * @method request
  5786   * @param {...} params
  5787   * @return {Object} jsonrpc request
  5788   */
  5789  Property.prototype.request = function () {
  5790      var payload = {
  5791          method: this.getter,
  5792          params: [],
  5793          callback: this.extractCallback(Array.prototype.slice.call(arguments))
  5794      };
  5795      payload.format = this.formatOutput.bind(this);
  5796      return payload;
  5797  };
  5798  
  5799  module.exports = Property;
  5800  
  5801  
  5802  },{"../utils/utils":20}],46:[function(require,module,exports){
  5803  /*
  5804      This file is part of web3.js.
  5805  
  5806      web3.js is free software: you can redistribute it and/or modify
  5807      it under the terms of the GNU Lesser General Public License as published by
  5808      the Free Software Foundation, either version 3 of the License, or
  5809      (at your option) any later version.
  5810  
  5811      web3.js is distributed in the hope that it will be useful,
  5812      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5813      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5814      GNU Lesser General Public License for more details.
  5815  
  5816      You should have received a copy of the GNU Lesser General Public License
  5817      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5818  */
  5819  /** 
  5820   * @file requestmanager.js
  5821   * @author Jeffrey Wilcke <jeff@ethdev.com>
  5822   * @author Marek Kotewicz <marek@ethdev.com>
  5823   * @author Marian Oancea <marian@ethdev.com>
  5824   * @author Fabian Vogelsteller <fabian@ethdev.com>
  5825   * @author Gav Wood <g@ethdev.com>
  5826   * @date 2014
  5827   */
  5828  
  5829  var Jsonrpc = require('./jsonrpc');
  5830  var utils = require('../utils/utils');
  5831  var c = require('../utils/config');
  5832  var errors = require('./errors');
  5833  
  5834  /**
  5835   * It's responsible for passing messages to providers
  5836   * It's also responsible for polling the zond node for incoming messages
  5837   * Default poll timeout is 1 second
  5838   * Singleton
  5839   */
  5840  var RequestManager = function (provider) {
  5841      this.provider = provider;
  5842      this.polls = {};
  5843      this.timeout = null;
  5844  };
  5845  
  5846  /**
  5847   * Should be used to synchronously send request
  5848   *
  5849   * @method send
  5850   * @param {Object} data
  5851   * @return {Object}
  5852   */
  5853  RequestManager.prototype.send = function (data) {
  5854      if (!this.provider) {
  5855          console.error(errors.InvalidProvider());
  5856          return null;
  5857      }
  5858  
  5859      var payload = Jsonrpc.toPayload(data.method, data.params);
  5860      var result = this.provider.send(payload);
  5861  
  5862      if (!Jsonrpc.isValidResponse(result)) {
  5863          throw errors.InvalidResponse(result);
  5864      }
  5865  
  5866      return result.result;
  5867  };
  5868  
  5869  /**
  5870   * Should be used to asynchronously send request
  5871   *
  5872   * @method sendAsync
  5873   * @param {Object} data
  5874   * @param {Function} callback
  5875   */
  5876  RequestManager.prototype.sendAsync = function (data, callback) {
  5877      if (!this.provider) {
  5878          return callback(errors.InvalidProvider());
  5879      }
  5880  
  5881      var payload = Jsonrpc.toPayload(data.method, data.params);
  5882      this.provider.sendAsync(payload, function (err, result) {
  5883          if (err) {
  5884              return callback(err);
  5885          }
  5886          
  5887          if (!Jsonrpc.isValidResponse(result)) {
  5888              return callback(errors.InvalidResponse(result));
  5889          }
  5890  
  5891          callback(null, result.result);
  5892      });
  5893  };
  5894  
  5895  /**
  5896   * Should be called to asynchronously send batch request
  5897   *
  5898   * @method sendBatch
  5899   * @param {Array} batch data
  5900   * @param {Function} callback
  5901   */
  5902  RequestManager.prototype.sendBatch = function (data, callback) {
  5903      if (!this.provider) {
  5904          return callback(errors.InvalidProvider());
  5905      }
  5906  
  5907      var payload = Jsonrpc.toBatchPayload(data);
  5908  
  5909      this.provider.sendAsync(payload, function (err, results) {
  5910          if (err) {
  5911              return callback(err);
  5912          }
  5913  
  5914          if (!utils.isArray(results)) {
  5915              return callback(errors.InvalidResponse(results));
  5916          }
  5917  
  5918          callback(err, results);
  5919      }); 
  5920  };
  5921  
  5922  /**
  5923   * Should be used to set provider of request manager
  5924   *
  5925   * @method setProvider
  5926   * @param {Object}
  5927   */
  5928  RequestManager.prototype.setProvider = function (p) {
  5929      this.provider = p;
  5930  };
  5931  
  5932  /**
  5933   * Should be used to start polling
  5934   *
  5935   * @method startPolling
  5936   * @param {Object} data
  5937   * @param {Number} pollId
  5938   * @param {Function} callback
  5939   * @param {Function} uninstall
  5940   *
  5941   * @todo cleanup number of params
  5942   */
  5943  RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) {
  5944      this.polls[pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall};
  5945  
  5946  
  5947      // start polling
  5948      if (!this.timeout) {
  5949          this.poll();
  5950      }
  5951  };
  5952  
  5953  /**
  5954   * Should be used to stop polling for filter with given id
  5955   *
  5956   * @method stopPolling
  5957   * @param {Number} pollId
  5958   */
  5959  RequestManager.prototype.stopPolling = function (pollId) {
  5960      delete this.polls[pollId];
  5961  
  5962      // stop polling
  5963      if(Object.keys(this.polls).length === 0 && this.timeout) {
  5964          clearTimeout(this.timeout);
  5965          this.timeout = null;
  5966      }
  5967  };
  5968  
  5969  /**
  5970   * Should be called to reset the polling mechanism of the request manager
  5971   *
  5972   * @method reset
  5973   */
  5974  RequestManager.prototype.reset = function (keepIsSyncing) {
  5975      /*jshint maxcomplexity:5 */
  5976  
  5977      for (var key in this.polls) {
  5978          // remove all polls, except sync polls,
  5979          // they need to be removed manually by calling syncing.stopWatching()
  5980          if(!keepIsSyncing || key.indexOf('syncPoll_') === -1) {
  5981              this.polls[key].uninstall();
  5982              delete this.polls[key];
  5983          }
  5984      }
  5985  
  5986      // stop polling
  5987      if(Object.keys(this.polls).length === 0 && this.timeout) {
  5988          clearTimeout(this.timeout);
  5989          this.timeout = null;
  5990      }
  5991  };
  5992  
  5993  /**
  5994   * Should be called to poll for changes on filter with given id
  5995   *
  5996   * @method poll
  5997   */
  5998  RequestManager.prototype.poll = function () {
  5999      /*jshint maxcomplexity: 6 */
  6000      this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);
  6001  
  6002      if (Object.keys(this.polls).length === 0) {
  6003          return;
  6004      }
  6005  
  6006      if (!this.provider) {
  6007          console.error(errors.InvalidProvider());
  6008          return;
  6009      }
  6010  
  6011      var pollsData = [];
  6012      var pollsIds = [];
  6013      for (var key in this.polls) {
  6014          pollsData.push(this.polls[key].data);
  6015          pollsIds.push(key);
  6016      }
  6017  
  6018      if (pollsData.length === 0) {
  6019          return;
  6020      }
  6021  
  6022      var payload = Jsonrpc.toBatchPayload(pollsData);
  6023      
  6024      // map the request id to they poll id
  6025      var pollsIdMap = {};
  6026      payload.forEach(function(load, index){
  6027          pollsIdMap[load.id] = pollsIds[index];
  6028      });
  6029  
  6030  
  6031      var self = this;
  6032      this.provider.sendAsync(payload, function (error, results) {
  6033  
  6034  
  6035          // TODO: console log?
  6036          if (error) {
  6037              return;
  6038          }
  6039  
  6040          if (!utils.isArray(results)) {
  6041              throw errors.InvalidResponse(results);
  6042          }
  6043          results.map(function (result) {
  6044              var id = pollsIdMap[result.id];
  6045  
  6046              // make sure the filter is still installed after arrival of the request
  6047              if (self.polls[id]) {
  6048                  result.callback = self.polls[id].callback;
  6049                  return result;
  6050              } else
  6051                  return false;
  6052          }).filter(function (result) {
  6053              return !!result; 
  6054          }).filter(function (result) {
  6055              var valid = Jsonrpc.isValidResponse(result);
  6056              if (!valid) {
  6057                  result.callback(errors.InvalidResponse(result));
  6058              }
  6059              return valid;
  6060          }).forEach(function (result) {
  6061              result.callback(null, result.result);
  6062          });
  6063      });
  6064  };
  6065  
  6066  module.exports = RequestManager;
  6067  
  6068  
  6069  },{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":35}],47:[function(require,module,exports){
  6070  
  6071  
  6072  var Settings = function () {
  6073      this.defaultBlock = 'latest';
  6074      this.defaultAccount = undefined;
  6075  };
  6076  
  6077  module.exports = Settings;
  6078  
  6079  
  6080  },{}],48:[function(require,module,exports){
  6081  /*
  6082      This file is part of web3.js.
  6083  
  6084      web3.js is free software: you can redistribute it and/or modify
  6085      it under the terms of the GNU Lesser General Public License as published by
  6086      the Free Software Foundation, either version 3 of the License, or
  6087      (at your option) any later version.
  6088  
  6089      web3.js is distributed in the hope that it will be useful,
  6090      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6091      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6092      GNU Lesser General Public License for more details.
  6093  
  6094      You should have received a copy of the GNU Lesser General Public License
  6095      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6096  */
  6097  /** @file syncing.js
  6098   * @authors:
  6099   *   Fabian Vogelsteller <fabian@ethdev.com>
  6100   * @date 2015
  6101   */
  6102  
  6103  var formatters = require('./formatters');
  6104  var utils = require('../utils/utils');
  6105  
  6106  var count = 1;
  6107  
  6108  /**
  6109  Adds the callback and sets up the methods, to iterate over the results.
  6110  
  6111  @method pollSyncing
  6112  @param {Object} self
  6113  */
  6114  var pollSyncing = function(self) {
  6115  
  6116      var onMessage = function (error, sync) {
  6117          if (error) {
  6118              return self.callbacks.forEach(function (callback) {
  6119                  callback(error);
  6120              });
  6121          }
  6122  
  6123          if(utils.isObject(sync) && sync.startingBlock)
  6124              sync = formatters.outputSyncingFormatter(sync);
  6125  
  6126          self.callbacks.forEach(function (callback) {
  6127              if (self.lastSyncState !== sync) {
  6128                  
  6129                  // call the callback with true first so the app can stop anything, before receiving the sync data
  6130                  if(!self.lastSyncState && utils.isObject(sync))
  6131                      callback(null, true);
  6132                  
  6133                  // call on the next CPU cycle, so the actions of the sync stop can be processes first
  6134                  setTimeout(function() {
  6135                      callback(null, sync);
  6136                  }, 0);
  6137                  
  6138                  self.lastSyncState = sync;
  6139              }
  6140          });
  6141      };
  6142  
  6143      self.requestManager.startPolling({
  6144          method: 'zond_syncing',
  6145          params: [],
  6146      }, self.pollId, onMessage, self.stopWatching.bind(self));
  6147  
  6148  };
  6149  
  6150  var IsSyncing = function (requestManager, callback) {
  6151      this.requestManager = requestManager;
  6152      this.pollId = 'syncPoll_'+ count++;
  6153      this.callbacks = [];
  6154      this.addCallback(callback);
  6155      this.lastSyncState = false;
  6156      pollSyncing(this);
  6157  
  6158      return this;
  6159  };
  6160  
  6161  IsSyncing.prototype.addCallback = function (callback) {
  6162      if(callback)
  6163          this.callbacks.push(callback);
  6164      return this;
  6165  };
  6166  
  6167  IsSyncing.prototype.stopWatching = function () {
  6168      this.requestManager.stopPolling(this.pollId);
  6169      this.callbacks = [];
  6170  };
  6171  
  6172  module.exports = IsSyncing;
  6173  
  6174  
  6175  },{"../utils/utils":20,"./formatters":30}],49:[function(require,module,exports){
  6176  /*
  6177      This file is part of web3.js.
  6178  
  6179      web3.js is free software: you can redistribute it and/or modify
  6180      it under the terms of the GNU Lesser General Public License as published by
  6181      the Free Software Foundation, either version 3 of the License, or
  6182      (at your option) any later version.
  6183  
  6184      web3.js is distributed in the hope that it will be useful,
  6185      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6186      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6187      GNU Lesser General Public License for more details.
  6188  
  6189      You should have received a copy of the GNU Lesser General Public License
  6190      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6191  */
  6192  /** 
  6193   * @file transfer.js
  6194   * @author Marek Kotewicz <marek@ethdev.com>
  6195   * @date 2015
  6196   */
  6197  
  6198  var Iban = require('./iban');
  6199  var exchangeAbi = require('../contracts/SmartExchange.json');
  6200  
  6201  /**
  6202   * Should be used to make Iban transfer
  6203   *
  6204   * @method transfer
  6205   * @param {String} from
  6206   * @param {String} to iban
  6207   * @param {Value} value to be tranfered
  6208   * @param {Function} callback, callback
  6209   */
  6210  var transfer = function (zond, from, to, value, callback) {
  6211      var iban = new Iban(to); 
  6212      if (!iban.isValid()) {
  6213          throw new Error('invalid iban address');
  6214      }
  6215  
  6216      if (iban.isDirect()) {
  6217          return transferToAddress(zond, from, iban.address(), value, callback);
  6218      }
  6219  
  6220      if (!callback) {
  6221          var address = zond.icapNamereg().addr(iban.institution());
  6222          return deposit(zond, from, address, value, iban.client());
  6223      }
  6224  
  6225      zond.icapNamereg().addr(iban.institution(), function (err, address) {
  6226          return deposit(zond, from, address, value, iban.client(), callback);
  6227      });
  6228      
  6229  };
  6230  
  6231  /**
  6232   * Should be used to transfer funds to certain address
  6233   *
  6234   * @method transferToAddress
  6235   * @param {String} from
  6236   * @param {String} to
  6237   * @param {Value} value to be tranfered
  6238   * @param {Function} callback, callback
  6239   */
  6240  var transferToAddress = function (zond, from, to, value, callback) {
  6241      return zond.sendTransaction({
  6242          address: to,
  6243          from: from,
  6244          value: value
  6245      }, callback);
  6246  };
  6247  
  6248  /**
  6249   * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!)
  6250   *
  6251   * @method deposit
  6252   * @param {String} from
  6253   * @param {String} to
  6254   * @param {Value} value to be transferred
  6255   * @param {String} client unique identifier
  6256   * @param {Function} callback, callback
  6257   */
  6258  var deposit = function (zond, from, to, value, client, callback) {
  6259      var abi = exchangeAbi;
  6260      return zond.contract(abi).at(to).deposit(client, {
  6261          from: from,
  6262          value: value
  6263      }, callback);
  6264  };
  6265  
  6266  module.exports = transfer;
  6267  
  6268  
  6269  },{"../contracts/SmartExchange.json":3,"./iban":33}],50:[function(require,module,exports){
  6270  
  6271  },{}],51:[function(require,module,exports){
  6272  ;(function (root, factory, undef) {
  6273  	if (typeof exports === "object") {
  6274  		// CommonJS
  6275  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  6276  	}
  6277  	else if (typeof define === "function" && define.amd) {
  6278  		// AMD
  6279  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  6280  	}
  6281  	else {
  6282  		// Global (browser)
  6283  		factory(root.CryptoJS);
  6284  	}
  6285  }(this, function (CryptoJS) {
  6286  
  6287  	(function () {
  6288  	    // Shortcuts
  6289  	    var C = CryptoJS;
  6290  	    var C_lib = C.lib;
  6291  	    var BlockCipher = C_lib.BlockCipher;
  6292  	    var C_algo = C.algo;
  6293  
  6294  	    // Lookup tables
  6295  	    var SBOX = [];
  6296  	    var INV_SBOX = [];
  6297  	    var SUB_MIX_0 = [];
  6298  	    var SUB_MIX_1 = [];
  6299  	    var SUB_MIX_2 = [];
  6300  	    var SUB_MIX_3 = [];
  6301  	    var INV_SUB_MIX_0 = [];
  6302  	    var INV_SUB_MIX_1 = [];
  6303  	    var INV_SUB_MIX_2 = [];
  6304  	    var INV_SUB_MIX_3 = [];
  6305  
  6306  	    // Compute lookup tables
  6307  	    (function () {
  6308  	        // Compute double table
  6309  	        var d = [];
  6310  	        for (var i = 0; i < 256; i++) {
  6311  	            if (i < 128) {
  6312  	                d[i] = i << 1;
  6313  	            } else {
  6314  	                d[i] = (i << 1) ^ 0x11b;
  6315  	            }
  6316  	        }
  6317  
  6318  	        // Walk GF(2^8)
  6319  	        var x = 0;
  6320  	        var xi = 0;
  6321  	        for (var i = 0; i < 256; i++) {
  6322  	            // Compute sbox
  6323  	            var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  6324  	            sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  6325  	            SBOX[x] = sx;
  6326  	            INV_SBOX[sx] = x;
  6327  
  6328  	            // Compute multiplication
  6329  	            var x2 = d[x];
  6330  	            var x4 = d[x2];
  6331  	            var x8 = d[x4];
  6332  
  6333  	            // Compute sub bytes, mix columns tables
  6334  	            var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  6335  	            SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  6336  	            SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  6337  	            SUB_MIX_2[x] = (t << 8)  | (t >>> 24);
  6338  	            SUB_MIX_3[x] = t;
  6339  
  6340  	            // Compute inv sub bytes, inv mix columns tables
  6341  	            var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  6342  	            INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  6343  	            INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  6344  	            INV_SUB_MIX_2[sx] = (t << 8)  | (t >>> 24);
  6345  	            INV_SUB_MIX_3[sx] = t;
  6346  
  6347  	            // Compute next counter
  6348  	            if (!x) {
  6349  	                x = xi = 1;
  6350  	            } else {
  6351  	                x = x2 ^ d[d[d[x8 ^ x2]]];
  6352  	                xi ^= d[d[xi]];
  6353  	            }
  6354  	        }
  6355  	    }());
  6356  
  6357  	    // Precomputed Rcon lookup
  6358  	    var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  6359  
  6360  	    /**
  6361  	     * AES block cipher algorithm.
  6362  	     */
  6363  	    var AES = C_algo.AES = BlockCipher.extend({
  6364  	        _doReset: function () {
  6365  	            // Skip reset of nRounds has been set before and key did not change
  6366  	            if (this._nRounds && this._keyPriorReset === this._key) {
  6367  	                return;
  6368  	            }
  6369  
  6370  	            // Shortcuts
  6371  	            var key = this._keyPriorReset = this._key;
  6372  	            var keyWords = key.words;
  6373  	            var keySize = key.sigBytes / 4;
  6374  
  6375  	            // Compute number of rounds
  6376  	            var nRounds = this._nRounds = keySize + 6;
  6377  
  6378  	            // Compute number of key schedule rows
  6379  	            var ksRows = (nRounds + 1) * 4;
  6380  
  6381  	            // Compute key schedule
  6382  	            var keySchedule = this._keySchedule = [];
  6383  	            for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  6384  	                if (ksRow < keySize) {
  6385  	                    keySchedule[ksRow] = keyWords[ksRow];
  6386  	                } else {
  6387  	                    var t = keySchedule[ksRow - 1];
  6388  
  6389  	                    if (!(ksRow % keySize)) {
  6390  	                        // Rot word
  6391  	                        t = (t << 8) | (t >>> 24);
  6392  
  6393  	                        // Sub word
  6394  	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  6395  
  6396  	                        // Mix Rcon
  6397  	                        t ^= RCON[(ksRow / keySize) | 0] << 24;
  6398  	                    } else if (keySize > 6 && ksRow % keySize == 4) {
  6399  	                        // Sub word
  6400  	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  6401  	                    }
  6402  
  6403  	                    keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  6404  	                }
  6405  	            }
  6406  
  6407  	            // Compute inv key schedule
  6408  	            var invKeySchedule = this._invKeySchedule = [];
  6409  	            for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  6410  	                var ksRow = ksRows - invKsRow;
  6411  
  6412  	                if (invKsRow % 4) {
  6413  	                    var t = keySchedule[ksRow];
  6414  	                } else {
  6415  	                    var t = keySchedule[ksRow - 4];
  6416  	                }
  6417  
  6418  	                if (invKsRow < 4 || ksRow <= 4) {
  6419  	                    invKeySchedule[invKsRow] = t;
  6420  	                } else {
  6421  	                    invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  6422  	                                               INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  6423  	                }
  6424  	            }
  6425  	        },
  6426  
  6427  	        encryptBlock: function (M, offset) {
  6428  	            this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  6429  	        },
  6430  
  6431  	        decryptBlock: function (M, offset) {
  6432  	            // Swap 2nd and 4th rows
  6433  	            var t = M[offset + 1];
  6434  	            M[offset + 1] = M[offset + 3];
  6435  	            M[offset + 3] = t;
  6436  
  6437  	            this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  6438  
  6439  	            // Inv swap 2nd and 4th rows
  6440  	            var t = M[offset + 1];
  6441  	            M[offset + 1] = M[offset + 3];
  6442  	            M[offset + 3] = t;
  6443  	        },
  6444  
  6445  	        _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  6446  	            // Shortcut
  6447  	            var nRounds = this._nRounds;
  6448  
  6449  	            // Get input, add round key
  6450  	            var s0 = M[offset]     ^ keySchedule[0];
  6451  	            var s1 = M[offset + 1] ^ keySchedule[1];
  6452  	            var s2 = M[offset + 2] ^ keySchedule[2];
  6453  	            var s3 = M[offset + 3] ^ keySchedule[3];
  6454  
  6455  	            // Key schedule row counter
  6456  	            var ksRow = 4;
  6457  
  6458  	            // Rounds
  6459  	            for (var round = 1; round < nRounds; round++) {
  6460  	                // Shift rows, sub bytes, mix columns, add round key
  6461  	                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++];
  6462  	                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++];
  6463  	                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++];
  6464  	                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++];
  6465  
  6466  	                // Update state
  6467  	                s0 = t0;
  6468  	                s1 = t1;
  6469  	                s2 = t2;
  6470  	                s3 = t3;
  6471  	            }
  6472  
  6473  	            // Shift rows, sub bytes, add round key
  6474  	            var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  6475  	            var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  6476  	            var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  6477  	            var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  6478  
  6479  	            // Set output
  6480  	            M[offset]     = t0;
  6481  	            M[offset + 1] = t1;
  6482  	            M[offset + 2] = t2;
  6483  	            M[offset + 3] = t3;
  6484  	        },
  6485  
  6486  	        keySize: 256/32
  6487  	    });
  6488  
  6489  	    /**
  6490  	     * Shortcut functions to the cipher's object interface.
  6491  	     *
  6492  	     * @example
  6493  	     *
  6494  	     *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  6495  	     *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  6496  	     */
  6497  	    C.AES = BlockCipher._createHelper(AES);
  6498  	}());
  6499  
  6500  
  6501  	return CryptoJS.AES;
  6502  
  6503  }));
  6504  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],52:[function(require,module,exports){
  6505  ;(function (root, factory) {
  6506  	if (typeof exports === "object") {
  6507  		// CommonJS
  6508  		module.exports = exports = factory(require("./core"));
  6509  	}
  6510  	else if (typeof define === "function" && define.amd) {
  6511  		// AMD
  6512  		define(["./core"], factory);
  6513  	}
  6514  	else {
  6515  		// Global (browser)
  6516  		factory(root.CryptoJS);
  6517  	}
  6518  }(this, function (CryptoJS) {
  6519  
  6520  	/**
  6521  	 * Cipher core components.
  6522  	 */
  6523  	CryptoJS.lib.Cipher || (function (undefined) {
  6524  	    // Shortcuts
  6525  	    var C = CryptoJS;
  6526  	    var C_lib = C.lib;
  6527  	    var Base = C_lib.Base;
  6528  	    var WordArray = C_lib.WordArray;
  6529  	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  6530  	    var C_enc = C.enc;
  6531  	    var Utf8 = C_enc.Utf8;
  6532  	    var Base64 = C_enc.Base64;
  6533  	    var C_algo = C.algo;
  6534  	    var EvpKDF = C_algo.EvpKDF;
  6535  
  6536  	    /**
  6537  	     * Abstract base cipher template.
  6538  	     *
  6539  	     * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  6540  	     * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  6541  	     * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  6542  	     * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  6543  	     */
  6544  	    var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  6545  	        /**
  6546  	         * Configuration options.
  6547  	         *
  6548  	         * @property {WordArray} iv The IV to use for this operation.
  6549  	         */
  6550  	        cfg: Base.extend(),
  6551  
  6552  	        /**
  6553  	         * Creates this cipher in encryption mode.
  6554  	         *
  6555  	         * @param {WordArray} key The key.
  6556  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  6557  	         *
  6558  	         * @return {Cipher} A cipher instance.
  6559  	         *
  6560  	         * @static
  6561  	         *
  6562  	         * @example
  6563  	         *
  6564  	         *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  6565  	         */
  6566  	        createEncryptor: function (key, cfg) {
  6567  	            return this.create(this._ENC_XFORM_MODE, key, cfg);
  6568  	        },
  6569  
  6570  	        /**
  6571  	         * Creates this cipher in decryption mode.
  6572  	         *
  6573  	         * @param {WordArray} key The key.
  6574  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  6575  	         *
  6576  	         * @return {Cipher} A cipher instance.
  6577  	         *
  6578  	         * @static
  6579  	         *
  6580  	         * @example
  6581  	         *
  6582  	         *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  6583  	         */
  6584  	        createDecryptor: function (key, cfg) {
  6585  	            return this.create(this._DEC_XFORM_MODE, key, cfg);
  6586  	        },
  6587  
  6588  	        /**
  6589  	         * Initializes a newly created cipher.
  6590  	         *
  6591  	         * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  6592  	         * @param {WordArray} key The key.
  6593  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  6594  	         *
  6595  	         * @example
  6596  	         *
  6597  	         *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  6598  	         */
  6599  	        init: function (xformMode, key, cfg) {
  6600  	            // Apply config defaults
  6601  	            this.cfg = this.cfg.extend(cfg);
  6602  
  6603  	            // Store transform mode and key
  6604  	            this._xformMode = xformMode;
  6605  	            this._key = key;
  6606  
  6607  	            // Set initial values
  6608  	            this.reset();
  6609  	        },
  6610  
  6611  	        /**
  6612  	         * Resets this cipher to its initial state.
  6613  	         *
  6614  	         * @example
  6615  	         *
  6616  	         *     cipher.reset();
  6617  	         */
  6618  	        reset: function () {
  6619  	            // Reset data buffer
  6620  	            BufferedBlockAlgorithm.reset.call(this);
  6621  
  6622  	            // Perform concrete-cipher logic
  6623  	            this._doReset();
  6624  	        },
  6625  
  6626  	        /**
  6627  	         * Adds data to be encrypted or decrypted.
  6628  	         *
  6629  	         * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  6630  	         *
  6631  	         * @return {WordArray} The data after processing.
  6632  	         *
  6633  	         * @example
  6634  	         *
  6635  	         *     var encrypted = cipher.process('data');
  6636  	         *     var encrypted = cipher.process(wordArray);
  6637  	         */
  6638  	        process: function (dataUpdate) {
  6639  	            // Append
  6640  	            this._append(dataUpdate);
  6641  
  6642  	            // Process available blocks
  6643  	            return this._process();
  6644  	        },
  6645  
  6646  	        /**
  6647  	         * Finalizes the encryption or decryption process.
  6648  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  6649  	         *
  6650  	         * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  6651  	         *
  6652  	         * @return {WordArray} The data after final processing.
  6653  	         *
  6654  	         * @example
  6655  	         *
  6656  	         *     var encrypted = cipher.finalize();
  6657  	         *     var encrypted = cipher.finalize('data');
  6658  	         *     var encrypted = cipher.finalize(wordArray);
  6659  	         */
  6660  	        finalize: function (dataUpdate) {
  6661  	            // Final data update
  6662  	            if (dataUpdate) {
  6663  	                this._append(dataUpdate);
  6664  	            }
  6665  
  6666  	            // Perform concrete-cipher logic
  6667  	            var finalProcessedData = this._doFinalize();
  6668  
  6669  	            return finalProcessedData;
  6670  	        },
  6671  
  6672  	        keySize: 128/32,
  6673  
  6674  	        ivSize: 128/32,
  6675  
  6676  	        _ENC_XFORM_MODE: 1,
  6677  
  6678  	        _DEC_XFORM_MODE: 2,
  6679  
  6680  	        /**
  6681  	         * Creates shortcut functions to a cipher's object interface.
  6682  	         *
  6683  	         * @param {Cipher} cipher The cipher to create a helper for.
  6684  	         *
  6685  	         * @return {Object} An object with encrypt and decrypt shortcut functions.
  6686  	         *
  6687  	         * @static
  6688  	         *
  6689  	         * @example
  6690  	         *
  6691  	         *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  6692  	         */
  6693  	        _createHelper: (function () {
  6694  	            function selectCipherStrategy(key) {
  6695  	                if (typeof key == 'string') {
  6696  	                    return PasswordBasedCipher;
  6697  	                } else {
  6698  	                    return SerializableCipher;
  6699  	                }
  6700  	            }
  6701  
  6702  	            return function (cipher) {
  6703  	                return {
  6704  	                    encrypt: function (message, key, cfg) {
  6705  	                        return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  6706  	                    },
  6707  
  6708  	                    decrypt: function (ciphertext, key, cfg) {
  6709  	                        return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  6710  	                    }
  6711  	                };
  6712  	            };
  6713  	        }())
  6714  	    });
  6715  
  6716  	    /**
  6717  	     * Abstract base stream cipher template.
  6718  	     *
  6719  	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  6720  	     */
  6721  	    var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  6722  	        _doFinalize: function () {
  6723  	            // Process partial blocks
  6724  	            var finalProcessedBlocks = this._process(!!'flush');
  6725  
  6726  	            return finalProcessedBlocks;
  6727  	        },
  6728  
  6729  	        blockSize: 1
  6730  	    });
  6731  
  6732  	    /**
  6733  	     * Mode namespace.
  6734  	     */
  6735  	    var C_mode = C.mode = {};
  6736  
  6737  	    /**
  6738  	     * Abstract base block cipher mode template.
  6739  	     */
  6740  	    var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  6741  	        /**
  6742  	         * Creates this mode for encryption.
  6743  	         *
  6744  	         * @param {Cipher} cipher A block cipher instance.
  6745  	         * @param {Array} iv The IV words.
  6746  	         *
  6747  	         * @static
  6748  	         *
  6749  	         * @example
  6750  	         *
  6751  	         *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  6752  	         */
  6753  	        createEncryptor: function (cipher, iv) {
  6754  	            return this.Encryptor.create(cipher, iv);
  6755  	        },
  6756  
  6757  	        /**
  6758  	         * Creates this mode for decryption.
  6759  	         *
  6760  	         * @param {Cipher} cipher A block cipher instance.
  6761  	         * @param {Array} iv The IV words.
  6762  	         *
  6763  	         * @static
  6764  	         *
  6765  	         * @example
  6766  	         *
  6767  	         *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  6768  	         */
  6769  	        createDecryptor: function (cipher, iv) {
  6770  	            return this.Decryptor.create(cipher, iv);
  6771  	        },
  6772  
  6773  	        /**
  6774  	         * Initializes a newly created mode.
  6775  	         *
  6776  	         * @param {Cipher} cipher A block cipher instance.
  6777  	         * @param {Array} iv The IV words.
  6778  	         *
  6779  	         * @example
  6780  	         *
  6781  	         *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  6782  	         */
  6783  	        init: function (cipher, iv) {
  6784  	            this._cipher = cipher;
  6785  	            this._iv = iv;
  6786  	        }
  6787  	    });
  6788  
  6789  	    /**
  6790  	     * Cipher Block Chaining mode.
  6791  	     */
  6792  	    var CBC = C_mode.CBC = (function () {
  6793  	        /**
  6794  	         * Abstract base CBC mode.
  6795  	         */
  6796  	        var CBC = BlockCipherMode.extend();
  6797  
  6798  	        /**
  6799  	         * CBC encryptor.
  6800  	         */
  6801  	        CBC.Encryptor = CBC.extend({
  6802  	            /**
  6803  	             * Processes the data block at offset.
  6804  	             *
  6805  	             * @param {Array} words The data words to operate on.
  6806  	             * @param {number} offset The offset where the block starts.
  6807  	             *
  6808  	             * @example
  6809  	             *
  6810  	             *     mode.processBlock(data.words, offset);
  6811  	             */
  6812  	            processBlock: function (words, offset) {
  6813  	                // Shortcuts
  6814  	                var cipher = this._cipher;
  6815  	                var blockSize = cipher.blockSize;
  6816  
  6817  	                // XOR and encrypt
  6818  	                xorBlock.call(this, words, offset, blockSize);
  6819  	                cipher.encryptBlock(words, offset);
  6820  
  6821  	                // Remember this block to use with next block
  6822  	                this._prevBlock = words.slice(offset, offset + blockSize);
  6823  	            }
  6824  	        });
  6825  
  6826  	        /**
  6827  	         * CBC decryptor.
  6828  	         */
  6829  	        CBC.Decryptor = CBC.extend({
  6830  	            /**
  6831  	             * Processes the data block at offset.
  6832  	             *
  6833  	             * @param {Array} words The data words to operate on.
  6834  	             * @param {number} offset The offset where the block starts.
  6835  	             *
  6836  	             * @example
  6837  	             *
  6838  	             *     mode.processBlock(data.words, offset);
  6839  	             */
  6840  	            processBlock: function (words, offset) {
  6841  	                // Shortcuts
  6842  	                var cipher = this._cipher;
  6843  	                var blockSize = cipher.blockSize;
  6844  
  6845  	                // Remember this block to use with next block
  6846  	                var thisBlock = words.slice(offset, offset + blockSize);
  6847  
  6848  	                // Decrypt and XOR
  6849  	                cipher.decryptBlock(words, offset);
  6850  	                xorBlock.call(this, words, offset, blockSize);
  6851  
  6852  	                // This block becomes the previous block
  6853  	                this._prevBlock = thisBlock;
  6854  	            }
  6855  	        });
  6856  
  6857  	        function xorBlock(words, offset, blockSize) {
  6858  	            // Shortcut
  6859  	            var iv = this._iv;
  6860  
  6861  	            // Choose mixing block
  6862  	            if (iv) {
  6863  	                var block = iv;
  6864  
  6865  	                // Remove IV for subsequent blocks
  6866  	                this._iv = undefined;
  6867  	            } else {
  6868  	                var block = this._prevBlock;
  6869  	            }
  6870  
  6871  	            // XOR blocks
  6872  	            for (var i = 0; i < blockSize; i++) {
  6873  	                words[offset + i] ^= block[i];
  6874  	            }
  6875  	        }
  6876  
  6877  	        return CBC;
  6878  	    }());
  6879  
  6880  	    /**
  6881  	     * Padding namespace.
  6882  	     */
  6883  	    var C_pad = C.pad = {};
  6884  
  6885  	    /**
  6886  	     * PKCS #5/7 padding strategy.
  6887  	     */
  6888  	    var Pkcs7 = C_pad.Pkcs7 = {
  6889  	        /**
  6890  	         * Pads data using the algorithm defined in PKCS #5/7.
  6891  	         *
  6892  	         * @param {WordArray} data The data to pad.
  6893  	         * @param {number} blockSize The multiple that the data should be padded to.
  6894  	         *
  6895  	         * @static
  6896  	         *
  6897  	         * @example
  6898  	         *
  6899  	         *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  6900  	         */
  6901  	        pad: function (data, blockSize) {
  6902  	            // Shortcut
  6903  	            var blockSizeBytes = blockSize * 4;
  6904  
  6905  	            // Count padding bytes
  6906  	            var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  6907  
  6908  	            // Create padding word
  6909  	            var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
  6910  
  6911  	            // Create padding
  6912  	            var paddingWords = [];
  6913  	            for (var i = 0; i < nPaddingBytes; i += 4) {
  6914  	                paddingWords.push(paddingWord);
  6915  	            }
  6916  	            var padding = WordArray.create(paddingWords, nPaddingBytes);
  6917  
  6918  	            // Add padding
  6919  	            data.concat(padding);
  6920  	        },
  6921  
  6922  	        /**
  6923  	         * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  6924  	         *
  6925  	         * @param {WordArray} data The data to unpad.
  6926  	         *
  6927  	         * @static
  6928  	         *
  6929  	         * @example
  6930  	         *
  6931  	         *     CryptoJS.pad.Pkcs7.unpad(wordArray);
  6932  	         */
  6933  	        unpad: function (data) {
  6934  	            // Get number of padding bytes from last byte
  6935  	            var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  6936  
  6937  	            // Remove padding
  6938  	            data.sigBytes -= nPaddingBytes;
  6939  	        }
  6940  	    };
  6941  
  6942  	    /**
  6943  	     * Abstract base block cipher template.
  6944  	     *
  6945  	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  6946  	     */
  6947  	    var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  6948  	        /**
  6949  	         * Configuration options.
  6950  	         *
  6951  	         * @property {Mode} mode The block mode to use. Default: CBC
  6952  	         * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  6953  	         */
  6954  	        cfg: Cipher.cfg.extend({
  6955  	            mode: CBC,
  6956  	            padding: Pkcs7
  6957  	        }),
  6958  
  6959  	        reset: function () {
  6960  	            // Reset cipher
  6961  	            Cipher.reset.call(this);
  6962  
  6963  	            // Shortcuts
  6964  	            var cfg = this.cfg;
  6965  	            var iv = cfg.iv;
  6966  	            var mode = cfg.mode;
  6967  
  6968  	            // Reset block mode
  6969  	            if (this._xformMode == this._ENC_XFORM_MODE) {
  6970  	                var modeCreator = mode.createEncryptor;
  6971  	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  6972  	                var modeCreator = mode.createDecryptor;
  6973  
  6974  	                // Keep at least one block in the buffer for unpadding
  6975  	                this._minBufferSize = 1;
  6976  	            }
  6977  	            this._mode = modeCreator.call(mode, this, iv && iv.words);
  6978  	        },
  6979  
  6980  	        _doProcessBlock: function (words, offset) {
  6981  	            this._mode.processBlock(words, offset);
  6982  	        },
  6983  
  6984  	        _doFinalize: function () {
  6985  	            // Shortcut
  6986  	            var padding = this.cfg.padding;
  6987  
  6988  	            // Finalize
  6989  	            if (this._xformMode == this._ENC_XFORM_MODE) {
  6990  	                // Pad data
  6991  	                padding.pad(this._data, this.blockSize);
  6992  
  6993  	                // Process final blocks
  6994  	                var finalProcessedBlocks = this._process(!!'flush');
  6995  	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  6996  	                // Process final blocks
  6997  	                var finalProcessedBlocks = this._process(!!'flush');
  6998  
  6999  	                // Unpad data
  7000  	                padding.unpad(finalProcessedBlocks);
  7001  	            }
  7002  
  7003  	            return finalProcessedBlocks;
  7004  	        },
  7005  
  7006  	        blockSize: 128/32
  7007  	    });
  7008  
  7009  	    /**
  7010  	     * A collection of cipher parameters.
  7011  	     *
  7012  	     * @property {WordArray} ciphertext The raw ciphertext.
  7013  	     * @property {WordArray} key The key to this ciphertext.
  7014  	     * @property {WordArray} iv The IV used in the ciphering operation.
  7015  	     * @property {WordArray} salt The salt used with a key derivation function.
  7016  	     * @property {Cipher} algorithm The cipher algorithm.
  7017  	     * @property {Mode} mode The block mode used in the ciphering operation.
  7018  	     * @property {Padding} padding The padding scheme used in the ciphering operation.
  7019  	     * @property {number} blockSize The block size of the cipher.
  7020  	     * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  7021  	     */
  7022  	    var CipherParams = C_lib.CipherParams = Base.extend({
  7023  	        /**
  7024  	         * Initializes a newly created cipher params object.
  7025  	         *
  7026  	         * @param {Object} cipherParams An object with any of the possible cipher parameters.
  7027  	         *
  7028  	         * @example
  7029  	         *
  7030  	         *     var cipherParams = CryptoJS.lib.CipherParams.create({
  7031  	         *         ciphertext: ciphertextWordArray,
  7032  	         *         key: keyWordArray,
  7033  	         *         iv: ivWordArray,
  7034  	         *         salt: saltWordArray,
  7035  	         *         algorithm: CryptoJS.algo.AES,
  7036  	         *         mode: CryptoJS.mode.CBC,
  7037  	         *         padding: CryptoJS.pad.PKCS7,
  7038  	         *         blockSize: 4,
  7039  	         *         formatter: CryptoJS.format.OpenSSL
  7040  	         *     });
  7041  	         */
  7042  	        init: function (cipherParams) {
  7043  	            this.mixIn(cipherParams);
  7044  	        },
  7045  
  7046  	        /**
  7047  	         * Converts this cipher params object to a string.
  7048  	         *
  7049  	         * @param {Format} formatter (Optional) The formatting strategy to use.
  7050  	         *
  7051  	         * @return {string} The stringified cipher params.
  7052  	         *
  7053  	         * @throws Error If neither the formatter nor the default formatter is set.
  7054  	         *
  7055  	         * @example
  7056  	         *
  7057  	         *     var string = cipherParams + '';
  7058  	         *     var string = cipherParams.toString();
  7059  	         *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  7060  	         */
  7061  	        toString: function (formatter) {
  7062  	            return (formatter || this.formatter).stringify(this);
  7063  	        }
  7064  	    });
  7065  
  7066  	    /**
  7067  	     * Format namespace.
  7068  	     */
  7069  	    var C_format = C.format = {};
  7070  
  7071  	    /**
  7072  	     * OpenSSL formatting strategy.
  7073  	     */
  7074  	    var OpenSSLFormatter = C_format.OpenSSL = {
  7075  	        /**
  7076  	         * Converts a cipher params object to an OpenSSL-compatible string.
  7077  	         *
  7078  	         * @param {CipherParams} cipherParams The cipher params object.
  7079  	         *
  7080  	         * @return {string} The OpenSSL-compatible string.
  7081  	         *
  7082  	         * @static
  7083  	         *
  7084  	         * @example
  7085  	         *
  7086  	         *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  7087  	         */
  7088  	        stringify: function (cipherParams) {
  7089  	            // Shortcuts
  7090  	            var ciphertext = cipherParams.ciphertext;
  7091  	            var salt = cipherParams.salt;
  7092  
  7093  	            // Format
  7094  	            if (salt) {
  7095  	                var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  7096  	            } else {
  7097  	                var wordArray = ciphertext;
  7098  	            }
  7099  
  7100  	            return wordArray.toString(Base64);
  7101  	        },
  7102  
  7103  	        /**
  7104  	         * Converts an OpenSSL-compatible string to a cipher params object.
  7105  	         *
  7106  	         * @param {string} openSSLStr The OpenSSL-compatible string.
  7107  	         *
  7108  	         * @return {CipherParams} The cipher params object.
  7109  	         *
  7110  	         * @static
  7111  	         *
  7112  	         * @example
  7113  	         *
  7114  	         *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  7115  	         */
  7116  	        parse: function (openSSLStr) {
  7117  	            // Parse base64
  7118  	            var ciphertext = Base64.parse(openSSLStr);
  7119  
  7120  	            // Shortcut
  7121  	            var ciphertextWords = ciphertext.words;
  7122  
  7123  	            // Test for salt
  7124  	            if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  7125  	                // Extract salt
  7126  	                var salt = WordArray.create(ciphertextWords.slice(2, 4));
  7127  
  7128  	                // Remove salt from ciphertext
  7129  	                ciphertextWords.splice(0, 4);
  7130  	                ciphertext.sigBytes -= 16;
  7131  	            }
  7132  
  7133  	            return CipherParams.create({ ciphertext: ciphertext, salt: salt });
  7134  	        }
  7135  	    };
  7136  
  7137  	    /**
  7138  	     * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  7139  	     */
  7140  	    var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  7141  	        /**
  7142  	         * Configuration options.
  7143  	         *
  7144  	         * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  7145  	         */
  7146  	        cfg: Base.extend({
  7147  	            format: OpenSSLFormatter
  7148  	        }),
  7149  
  7150  	        /**
  7151  	         * Encrypts a message.
  7152  	         *
  7153  	         * @param {Cipher} cipher The cipher algorithm to use.
  7154  	         * @param {WordArray|string} message The message to encrypt.
  7155  	         * @param {WordArray} key The key.
  7156  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7157  	         *
  7158  	         * @return {CipherParams} A cipher params object.
  7159  	         *
  7160  	         * @static
  7161  	         *
  7162  	         * @example
  7163  	         *
  7164  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  7165  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  7166  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7167  	         */
  7168  	        encrypt: function (cipher, message, key, cfg) {
  7169  	            // Apply config defaults
  7170  	            cfg = this.cfg.extend(cfg);
  7171  
  7172  	            // Encrypt
  7173  	            var encryptor = cipher.createEncryptor(key, cfg);
  7174  	            var ciphertext = encryptor.finalize(message);
  7175  
  7176  	            // Shortcut
  7177  	            var cipherCfg = encryptor.cfg;
  7178  
  7179  	            // Create and return serializable cipher params
  7180  	            return CipherParams.create({
  7181  	                ciphertext: ciphertext,
  7182  	                key: key,
  7183  	                iv: cipherCfg.iv,
  7184  	                algorithm: cipher,
  7185  	                mode: cipherCfg.mode,
  7186  	                padding: cipherCfg.padding,
  7187  	                blockSize: cipher.blockSize,
  7188  	                formatter: cfg.format
  7189  	            });
  7190  	        },
  7191  
  7192  	        /**
  7193  	         * Decrypts serialized ciphertext.
  7194  	         *
  7195  	         * @param {Cipher} cipher The cipher algorithm to use.
  7196  	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  7197  	         * @param {WordArray} key The key.
  7198  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7199  	         *
  7200  	         * @return {WordArray} The plaintext.
  7201  	         *
  7202  	         * @static
  7203  	         *
  7204  	         * @example
  7205  	         *
  7206  	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7207  	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7208  	         */
  7209  	        decrypt: function (cipher, ciphertext, key, cfg) {
  7210  	            // Apply config defaults
  7211  	            cfg = this.cfg.extend(cfg);
  7212  
  7213  	            // Convert string to CipherParams
  7214  	            ciphertext = this._parse(ciphertext, cfg.format);
  7215  
  7216  	            // Decrypt
  7217  	            var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  7218  
  7219  	            return plaintext;
  7220  	        },
  7221  
  7222  	        /**
  7223  	         * Converts serialized ciphertext to CipherParams,
  7224  	         * else assumed CipherParams already and returns ciphertext unchanged.
  7225  	         *
  7226  	         * @param {CipherParams|string} ciphertext The ciphertext.
  7227  	         * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  7228  	         *
  7229  	         * @return {CipherParams} The unserialized ciphertext.
  7230  	         *
  7231  	         * @static
  7232  	         *
  7233  	         * @example
  7234  	         *
  7235  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  7236  	         */
  7237  	        _parse: function (ciphertext, format) {
  7238  	            if (typeof ciphertext == 'string') {
  7239  	                return format.parse(ciphertext, this);
  7240  	            } else {
  7241  	                return ciphertext;
  7242  	            }
  7243  	        }
  7244  	    });
  7245  
  7246  	    /**
  7247  	     * Key derivation function namespace.
  7248  	     */
  7249  	    var C_kdf = C.kdf = {};
  7250  
  7251  	    /**
  7252  	     * OpenSSL key derivation function.
  7253  	     */
  7254  	    var OpenSSLKdf = C_kdf.OpenSSL = {
  7255  	        /**
  7256  	         * Derives a key and IV from a password.
  7257  	         *
  7258  	         * @param {string} password The password to derive from.
  7259  	         * @param {number} keySize The size in words of the key to generate.
  7260  	         * @param {number} ivSize The size in words of the IV to generate.
  7261  	         * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  7262  	         *
  7263  	         * @return {CipherParams} A cipher params object with the key, IV, and salt.
  7264  	         *
  7265  	         * @static
  7266  	         *
  7267  	         * @example
  7268  	         *
  7269  	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  7270  	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  7271  	         */
  7272  	        execute: function (password, keySize, ivSize, salt) {
  7273  	            // Generate random salt
  7274  	            if (!salt) {
  7275  	                salt = WordArray.random(64/8);
  7276  	            }
  7277  
  7278  	            // Derive key and IV
  7279  	            var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
  7280  
  7281  	            // Separate key and IV
  7282  	            var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  7283  	            key.sigBytes = keySize * 4;
  7284  
  7285  	            // Return params
  7286  	            return CipherParams.create({ key: key, iv: iv, salt: salt });
  7287  	        }
  7288  	    };
  7289  
  7290  	    /**
  7291  	     * A serializable cipher wrapper that derives the key from a password,
  7292  	     * and returns ciphertext as a serializable cipher params object.
  7293  	     */
  7294  	    var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  7295  	        /**
  7296  	         * Configuration options.
  7297  	         *
  7298  	         * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  7299  	         */
  7300  	        cfg: SerializableCipher.cfg.extend({
  7301  	            kdf: OpenSSLKdf
  7302  	        }),
  7303  
  7304  	        /**
  7305  	         * Encrypts a message using a password.
  7306  	         *
  7307  	         * @param {Cipher} cipher The cipher algorithm to use.
  7308  	         * @param {WordArray|string} message The message to encrypt.
  7309  	         * @param {string} password The password.
  7310  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7311  	         *
  7312  	         * @return {CipherParams} A cipher params object.
  7313  	         *
  7314  	         * @static
  7315  	         *
  7316  	         * @example
  7317  	         *
  7318  	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  7319  	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  7320  	         */
  7321  	        encrypt: function (cipher, message, password, cfg) {
  7322  	            // Apply config defaults
  7323  	            cfg = this.cfg.extend(cfg);
  7324  
  7325  	            // Derive key and other params
  7326  	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
  7327  
  7328  	            // Add IV to config
  7329  	            cfg.iv = derivedParams.iv;
  7330  
  7331  	            // Encrypt
  7332  	            var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  7333  
  7334  	            // Mix in derived params
  7335  	            ciphertext.mixIn(derivedParams);
  7336  
  7337  	            return ciphertext;
  7338  	        },
  7339  
  7340  	        /**
  7341  	         * Decrypts serialized ciphertext using a password.
  7342  	         *
  7343  	         * @param {Cipher} cipher The cipher algorithm to use.
  7344  	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  7345  	         * @param {string} password The password.
  7346  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7347  	         *
  7348  	         * @return {WordArray} The plaintext.
  7349  	         *
  7350  	         * @static
  7351  	         *
  7352  	         * @example
  7353  	         *
  7354  	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  7355  	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  7356  	         */
  7357  	        decrypt: function (cipher, ciphertext, password, cfg) {
  7358  	            // Apply config defaults
  7359  	            cfg = this.cfg.extend(cfg);
  7360  
  7361  	            // Convert string to CipherParams
  7362  	            ciphertext = this._parse(ciphertext, cfg.format);
  7363  
  7364  	            // Derive key and other params
  7365  	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
  7366  
  7367  	            // Add IV to config
  7368  	            cfg.iv = derivedParams.iv;
  7369  
  7370  	            // Decrypt
  7371  	            var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  7372  
  7373  	            return plaintext;
  7374  	        }
  7375  	    });
  7376  	}());
  7377  
  7378  
  7379  }));
  7380  },{"./core":53}],53:[function(require,module,exports){
  7381  ;(function (root, factory) {
  7382  	if (typeof exports === "object") {
  7383  		// CommonJS
  7384  		module.exports = exports = factory();
  7385  	}
  7386  	else if (typeof define === "function" && define.amd) {
  7387  		// AMD
  7388  		define([], factory);
  7389  	}
  7390  	else {
  7391  		// Global (browser)
  7392  		root.CryptoJS = factory();
  7393  	}
  7394  }(this, function () {
  7395  
  7396  	/**
  7397  	 * CryptoJS core components.
  7398  	 */
  7399  	var CryptoJS = CryptoJS || (function (Math, undefined) {
  7400  	    /*
  7401  	     * Local polyfil of Object.create
  7402  	     */
  7403  	    var create = Object.create || (function () {
  7404  	        function F() {};
  7405  
  7406  	        return function (obj) {
  7407  	            var subtype;
  7408  
  7409  	            F.prototype = obj;
  7410  
  7411  	            subtype = new F();
  7412  
  7413  	            F.prototype = null;
  7414  
  7415  	            return subtype;
  7416  	        };
  7417  	    }())
  7418  
  7419  	    /**
  7420  	     * CryptoJS namespace.
  7421  	     */
  7422  	    var C = {};
  7423  
  7424  	    /**
  7425  	     * Library namespace.
  7426  	     */
  7427  	    var C_lib = C.lib = {};
  7428  
  7429  	    /**
  7430  	     * Base object for prototypal inheritance.
  7431  	     */
  7432  	    var Base = C_lib.Base = (function () {
  7433  
  7434  
  7435  	        return {
  7436  	            /**
  7437  	             * Creates a new object that inherits from this object.
  7438  	             *
  7439  	             * @param {Object} overrides Properties to copy into the new object.
  7440  	             *
  7441  	             * @return {Object} The new object.
  7442  	             *
  7443  	             * @static
  7444  	             *
  7445  	             * @example
  7446  	             *
  7447  	             *     var MyType = CryptoJS.lib.Base.extend({
  7448  	             *         field: 'value',
  7449  	             *
  7450  	             *         method: function () {
  7451  	             *         }
  7452  	             *     });
  7453  	             */
  7454  	            extend: function (overrides) {
  7455  	                // Spawn
  7456  	                var subtype = create(this);
  7457  
  7458  	                // Augment
  7459  	                if (overrides) {
  7460  	                    subtype.mixIn(overrides);
  7461  	                }
  7462  
  7463  	                // Create default initializer
  7464  	                if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  7465  	                    subtype.init = function () {
  7466  	                        subtype.$super.init.apply(this, arguments);
  7467  	                    };
  7468  	                }
  7469  
  7470  	                // Initializer's prototype is the subtype object
  7471  	                subtype.init.prototype = subtype;
  7472  
  7473  	                // Reference supertype
  7474  	                subtype.$super = this;
  7475  
  7476  	                return subtype;
  7477  	            },
  7478  
  7479  	            /**
  7480  	             * Extends this object and runs the init method.
  7481  	             * Arguments to create() will be passed to init().
  7482  	             *
  7483  	             * @return {Object} The new object.
  7484  	             *
  7485  	             * @static
  7486  	             *
  7487  	             * @example
  7488  	             *
  7489  	             *     var instance = MyType.create();
  7490  	             */
  7491  	            create: function () {
  7492  	                var instance = this.extend();
  7493  	                instance.init.apply(instance, arguments);
  7494  
  7495  	                return instance;
  7496  	            },
  7497  
  7498  	            /**
  7499  	             * Initializes a newly created object.
  7500  	             * Override this method to add some logic when your objects are created.
  7501  	             *
  7502  	             * @example
  7503  	             *
  7504  	             *     var MyType = CryptoJS.lib.Base.extend({
  7505  	             *         init: function () {
  7506  	             *             // ...
  7507  	             *         }
  7508  	             *     });
  7509  	             */
  7510  	            init: function () {
  7511  	            },
  7512  
  7513  	            /**
  7514  	             * Copies properties into this object.
  7515  	             *
  7516  	             * @param {Object} properties The properties to mix in.
  7517  	             *
  7518  	             * @example
  7519  	             *
  7520  	             *     MyType.mixIn({
  7521  	             *         field: 'value'
  7522  	             *     });
  7523  	             */
  7524  	            mixIn: function (properties) {
  7525  	                for (var propertyName in properties) {
  7526  	                    if (properties.hasOwnProperty(propertyName)) {
  7527  	                        this[propertyName] = properties[propertyName];
  7528  	                    }
  7529  	                }
  7530  
  7531  	                // IE won't copy toString using the loop above
  7532  	                if (properties.hasOwnProperty('toString')) {
  7533  	                    this.toString = properties.toString;
  7534  	                }
  7535  	            },
  7536  
  7537  	            /**
  7538  	             * Creates a copy of this object.
  7539  	             *
  7540  	             * @return {Object} The clone.
  7541  	             *
  7542  	             * @example
  7543  	             *
  7544  	             *     var clone = instance.clone();
  7545  	             */
  7546  	            clone: function () {
  7547  	                return this.init.prototype.extend(this);
  7548  	            }
  7549  	        };
  7550  	    }());
  7551  
  7552  	    /**
  7553  	     * An array of 32-bit words.
  7554  	     *
  7555  	     * @property {Array} words The array of 32-bit words.
  7556  	     * @property {number} sigBytes The number of significant bytes in this word array.
  7557  	     */
  7558  	    var WordArray = C_lib.WordArray = Base.extend({
  7559  	        /**
  7560  	         * Initializes a newly created word array.
  7561  	         *
  7562  	         * @param {Array} words (Optional) An array of 32-bit words.
  7563  	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  7564  	         *
  7565  	         * @example
  7566  	         *
  7567  	         *     var wordArray = CryptoJS.lib.WordArray.create();
  7568  	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  7569  	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  7570  	         */
  7571  	        init: function (words, sigBytes) {
  7572  	            words = this.words = words || [];
  7573  
  7574  	            if (sigBytes != undefined) {
  7575  	                this.sigBytes = sigBytes;
  7576  	            } else {
  7577  	                this.sigBytes = words.length * 4;
  7578  	            }
  7579  	        },
  7580  
  7581  	        /**
  7582  	         * Converts this word array to a string.
  7583  	         *
  7584  	         * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  7585  	         *
  7586  	         * @return {string} The stringified word array.
  7587  	         *
  7588  	         * @example
  7589  	         *
  7590  	         *     var string = wordArray + '';
  7591  	         *     var string = wordArray.toString();
  7592  	         *     var string = wordArray.toString(CryptoJS.enc.Utf8);
  7593  	         */
  7594  	        toString: function (encoder) {
  7595  	            return (encoder || Hex).stringify(this);
  7596  	        },
  7597  
  7598  	        /**
  7599  	         * Concatenates a word array to this word array.
  7600  	         *
  7601  	         * @param {WordArray} wordArray The word array to append.
  7602  	         *
  7603  	         * @return {WordArray} This word array.
  7604  	         *
  7605  	         * @example
  7606  	         *
  7607  	         *     wordArray1.concat(wordArray2);
  7608  	         */
  7609  	        concat: function (wordArray) {
  7610  	            // Shortcuts
  7611  	            var thisWords = this.words;
  7612  	            var thatWords = wordArray.words;
  7613  	            var thisSigBytes = this.sigBytes;
  7614  	            var thatSigBytes = wordArray.sigBytes;
  7615  
  7616  	            // Clamp excess bits
  7617  	            this.clamp();
  7618  
  7619  	            // Concat
  7620  	            if (thisSigBytes % 4) {
  7621  	                // Copy one byte at a time
  7622  	                for (var i = 0; i < thatSigBytes; i++) {
  7623  	                    var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  7624  	                    thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  7625  	                }
  7626  	            } else {
  7627  	                // Copy one word at a time
  7628  	                for (var i = 0; i < thatSigBytes; i += 4) {
  7629  	                    thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
  7630  	                }
  7631  	            }
  7632  	            this.sigBytes += thatSigBytes;
  7633  
  7634  	            // Chainable
  7635  	            return this;
  7636  	        },
  7637  
  7638  	        /**
  7639  	         * Removes insignificant bits.
  7640  	         *
  7641  	         * @example
  7642  	         *
  7643  	         *     wordArray.clamp();
  7644  	         */
  7645  	        clamp: function () {
  7646  	            // Shortcuts
  7647  	            var words = this.words;
  7648  	            var sigBytes = this.sigBytes;
  7649  
  7650  	            // Clamp
  7651  	            words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
  7652  	            words.length = Math.ceil(sigBytes / 4);
  7653  	        },
  7654  
  7655  	        /**
  7656  	         * Creates a copy of this word array.
  7657  	         *
  7658  	         * @return {WordArray} The clone.
  7659  	         *
  7660  	         * @example
  7661  	         *
  7662  	         *     var clone = wordArray.clone();
  7663  	         */
  7664  	        clone: function () {
  7665  	            var clone = Base.clone.call(this);
  7666  	            clone.words = this.words.slice(0);
  7667  
  7668  	            return clone;
  7669  	        },
  7670  
  7671  	        /**
  7672  	         * Creates a word array filled with random bytes.
  7673  	         *
  7674  	         * @param {number} nBytes The number of random bytes to generate.
  7675  	         *
  7676  	         * @return {WordArray} The random word array.
  7677  	         *
  7678  	         * @static
  7679  	         *
  7680  	         * @example
  7681  	         *
  7682  	         *     var wordArray = CryptoJS.lib.WordArray.random(16);
  7683  	         */
  7684  	        random: function (nBytes) {
  7685  	            var words = [];
  7686  
  7687  	            var r = (function (m_w) {
  7688  	                var m_w = m_w;
  7689  	                var m_z = 0x3ade68b1;
  7690  	                var mask = 0xffffffff;
  7691  
  7692  	                return function () {
  7693  	                    m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
  7694  	                    m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
  7695  	                    var result = ((m_z << 0x10) + m_w) & mask;
  7696  	                    result /= 0x100000000;
  7697  	                    result += 0.5;
  7698  	                    return result * (Math.random() > .5 ? 1 : -1);
  7699  	                }
  7700  	            });
  7701  
  7702  	            for (var i = 0, rcache; i < nBytes; i += 4) {
  7703  	                var _r = r((rcache || Math.random()) * 0x100000000);
  7704  
  7705  	                rcache = _r() * 0x3ade67b7;
  7706  	                words.push((_r() * 0x100000000) | 0);
  7707  	            }
  7708  
  7709  	            return new WordArray.init(words, nBytes);
  7710  	        }
  7711  	    });
  7712  
  7713  	    /**
  7714  	     * Encoder namespace.
  7715  	     */
  7716  	    var C_enc = C.enc = {};
  7717  
  7718  	    /**
  7719  	     * Hex encoding strategy.
  7720  	     */
  7721  	    var Hex = C_enc.Hex = {
  7722  	        /**
  7723  	         * Converts a word array to a hex string.
  7724  	         *
  7725  	         * @param {WordArray} wordArray The word array.
  7726  	         *
  7727  	         * @return {string} The hex string.
  7728  	         *
  7729  	         * @static
  7730  	         *
  7731  	         * @example
  7732  	         *
  7733  	         *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  7734  	         */
  7735  	        stringify: function (wordArray) {
  7736  	            // Shortcuts
  7737  	            var words = wordArray.words;
  7738  	            var sigBytes = wordArray.sigBytes;
  7739  
  7740  	            // Convert
  7741  	            var hexChars = [];
  7742  	            for (var i = 0; i < sigBytes; i++) {
  7743  	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  7744  	                hexChars.push((bite >>> 4).toString(16));
  7745  	                hexChars.push((bite & 0x0f).toString(16));
  7746  	            }
  7747  
  7748  	            return hexChars.join('');
  7749  	        },
  7750  
  7751  	        /**
  7752  	         * Converts a hex string to a word array.
  7753  	         *
  7754  	         * @param {string} hexStr The hex string.
  7755  	         *
  7756  	         * @return {WordArray} The word array.
  7757  	         *
  7758  	         * @static
  7759  	         *
  7760  	         * @example
  7761  	         *
  7762  	         *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
  7763  	         */
  7764  	        parse: function (hexStr) {
  7765  	            // Shortcut
  7766  	            var hexStrLength = hexStr.length;
  7767  
  7768  	            // Convert
  7769  	            var words = [];
  7770  	            for (var i = 0; i < hexStrLength; i += 2) {
  7771  	                words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  7772  	            }
  7773  
  7774  	            return new WordArray.init(words, hexStrLength / 2);
  7775  	        }
  7776  	    };
  7777  
  7778  	    /**
  7779  	     * Latin1 encoding strategy.
  7780  	     */
  7781  	    var Latin1 = C_enc.Latin1 = {
  7782  	        /**
  7783  	         * Converts a word array to a Latin1 string.
  7784  	         *
  7785  	         * @param {WordArray} wordArray The word array.
  7786  	         *
  7787  	         * @return {string} The Latin1 string.
  7788  	         *
  7789  	         * @static
  7790  	         *
  7791  	         * @example
  7792  	         *
  7793  	         *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  7794  	         */
  7795  	        stringify: function (wordArray) {
  7796  	            // Shortcuts
  7797  	            var words = wordArray.words;
  7798  	            var sigBytes = wordArray.sigBytes;
  7799  
  7800  	            // Convert
  7801  	            var latin1Chars = [];
  7802  	            for (var i = 0; i < sigBytes; i++) {
  7803  	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  7804  	                latin1Chars.push(String.fromCharCode(bite));
  7805  	            }
  7806  
  7807  	            return latin1Chars.join('');
  7808  	        },
  7809  
  7810  	        /**
  7811  	         * Converts a Latin1 string to a word array.
  7812  	         *
  7813  	         * @param {string} latin1Str The Latin1 string.
  7814  	         *
  7815  	         * @return {WordArray} The word array.
  7816  	         *
  7817  	         * @static
  7818  	         *
  7819  	         * @example
  7820  	         *
  7821  	         *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  7822  	         */
  7823  	        parse: function (latin1Str) {
  7824  	            // Shortcut
  7825  	            var latin1StrLength = latin1Str.length;
  7826  
  7827  	            // Convert
  7828  	            var words = [];
  7829  	            for (var i = 0; i < latin1StrLength; i++) {
  7830  	                words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  7831  	            }
  7832  
  7833  	            return new WordArray.init(words, latin1StrLength);
  7834  	        }
  7835  	    };
  7836  
  7837  	    /**
  7838  	     * UTF-8 encoding strategy.
  7839  	     */
  7840  	    var Utf8 = C_enc.Utf8 = {
  7841  	        /**
  7842  	         * Converts a word array to a UTF-8 string.
  7843  	         *
  7844  	         * @param {WordArray} wordArray The word array.
  7845  	         *
  7846  	         * @return {string} The UTF-8 string.
  7847  	         *
  7848  	         * @static
  7849  	         *
  7850  	         * @example
  7851  	         *
  7852  	         *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  7853  	         */
  7854  	        stringify: function (wordArray) {
  7855  	            try {
  7856  	                return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  7857  	            } catch (e) {
  7858  	                throw new Error('Malformed UTF-8 data');
  7859  	            }
  7860  	        },
  7861  
  7862  	        /**
  7863  	         * Converts a UTF-8 string to a word array.
  7864  	         *
  7865  	         * @param {string} utf8Str The UTF-8 string.
  7866  	         *
  7867  	         * @return {WordArray} The word array.
  7868  	         *
  7869  	         * @static
  7870  	         *
  7871  	         * @example
  7872  	         *
  7873  	         *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  7874  	         */
  7875  	        parse: function (utf8Str) {
  7876  	            return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  7877  	        }
  7878  	    };
  7879  
  7880  	    /**
  7881  	     * Abstract buffered block algorithm template.
  7882  	     *
  7883  	     * The property blockSize must be implemented in a concrete subtype.
  7884  	     *
  7885  	     * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  7886  	     */
  7887  	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  7888  	        /**
  7889  	         * Resets this block algorithm's data buffer to its initial state.
  7890  	         *
  7891  	         * @example
  7892  	         *
  7893  	         *     bufferedBlockAlgorithm.reset();
  7894  	         */
  7895  	        reset: function () {
  7896  	            // Initial values
  7897  	            this._data = new WordArray.init();
  7898  	            this._nDataBytes = 0;
  7899  	        },
  7900  
  7901  	        /**
  7902  	         * Adds new data to this block algorithm's buffer.
  7903  	         *
  7904  	         * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  7905  	         *
  7906  	         * @example
  7907  	         *
  7908  	         *     bufferedBlockAlgorithm._append('data');
  7909  	         *     bufferedBlockAlgorithm._append(wordArray);
  7910  	         */
  7911  	        _append: function (data) {
  7912  	            // Convert string to WordArray, else assume WordArray already
  7913  	            if (typeof data == 'string') {
  7914  	                data = Utf8.parse(data);
  7915  	            }
  7916  
  7917  	            // Append
  7918  	            this._data.concat(data);
  7919  	            this._nDataBytes += data.sigBytes;
  7920  	        },
  7921  
  7922  	        /**
  7923  	         * Processes available data blocks.
  7924  	         *
  7925  	         * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  7926  	         *
  7927  	         * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  7928  	         *
  7929  	         * @return {WordArray} The processed data.
  7930  	         *
  7931  	         * @example
  7932  	         *
  7933  	         *     var processedData = bufferedBlockAlgorithm._process();
  7934  	         *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
  7935  	         */
  7936  	        _process: function (doFlush) {
  7937  	            // Shortcuts
  7938  	            var data = this._data;
  7939  	            var dataWords = data.words;
  7940  	            var dataSigBytes = data.sigBytes;
  7941  	            var blockSize = this.blockSize;
  7942  	            var blockSizeBytes = blockSize * 4;
  7943  
  7944  	            // Count blocks ready
  7945  	            var nBlocksReady = dataSigBytes / blockSizeBytes;
  7946  	            if (doFlush) {
  7947  	                // Round up to include partial blocks
  7948  	                nBlocksReady = Math.ceil(nBlocksReady);
  7949  	            } else {
  7950  	                // Round down to include only full blocks,
  7951  	                // less the number of blocks that must remain in the buffer
  7952  	                nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  7953  	            }
  7954  
  7955  	            // Count words ready
  7956  	            var nWordsReady = nBlocksReady * blockSize;
  7957  
  7958  	            // Count bytes ready
  7959  	            var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  7960  
  7961  	            // Process blocks
  7962  	            if (nWordsReady) {
  7963  	                for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  7964  	                    // Perform concrete-algorithm logic
  7965  	                    this._doProcessBlock(dataWords, offset);
  7966  	                }
  7967  
  7968  	                // Remove processed words
  7969  	                var processedWords = dataWords.splice(0, nWordsReady);
  7970  	                data.sigBytes -= nBytesReady;
  7971  	            }
  7972  
  7973  	            // Return processed words
  7974  	            return new WordArray.init(processedWords, nBytesReady);
  7975  	        },
  7976  
  7977  	        /**
  7978  	         * Creates a copy of this object.
  7979  	         *
  7980  	         * @return {Object} The clone.
  7981  	         *
  7982  	         * @example
  7983  	         *
  7984  	         *     var clone = bufferedBlockAlgorithm.clone();
  7985  	         */
  7986  	        clone: function () {
  7987  	            var clone = Base.clone.call(this);
  7988  	            clone._data = this._data.clone();
  7989  
  7990  	            return clone;
  7991  	        },
  7992  
  7993  	        _minBufferSize: 0
  7994  	    });
  7995  
  7996  	    /**
  7997  	     * Abstract hasher template.
  7998  	     *
  7999  	     * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  8000  	     */
  8001  	    var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  8002  	        /**
  8003  	         * Configuration options.
  8004  	         */
  8005  	        cfg: Base.extend(),
  8006  
  8007  	        /**
  8008  	         * Initializes a newly created hasher.
  8009  	         *
  8010  	         * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  8011  	         *
  8012  	         * @example
  8013  	         *
  8014  	         *     var hasher = CryptoJS.algo.SHA256.create();
  8015  	         */
  8016  	        init: function (cfg) {
  8017  	            // Apply config defaults
  8018  	            this.cfg = this.cfg.extend(cfg);
  8019  
  8020  	            // Set initial values
  8021  	            this.reset();
  8022  	        },
  8023  
  8024  	        /**
  8025  	         * Resets this hasher to its initial state.
  8026  	         *
  8027  	         * @example
  8028  	         *
  8029  	         *     hasher.reset();
  8030  	         */
  8031  	        reset: function () {
  8032  	            // Reset data buffer
  8033  	            BufferedBlockAlgorithm.reset.call(this);
  8034  
  8035  	            // Perform concrete-hasher logic
  8036  	            this._doReset();
  8037  	        },
  8038  
  8039  	        /**
  8040  	         * Updates this hasher with a message.
  8041  	         *
  8042  	         * @param {WordArray|string} messageUpdate The message to append.
  8043  	         *
  8044  	         * @return {Hasher} This hasher.
  8045  	         *
  8046  	         * @example
  8047  	         *
  8048  	         *     hasher.update('message');
  8049  	         *     hasher.update(wordArray);
  8050  	         */
  8051  	        update: function (messageUpdate) {
  8052  	            // Append
  8053  	            this._append(messageUpdate);
  8054  
  8055  	            // Update the hash
  8056  	            this._process();
  8057  
  8058  	            // Chainable
  8059  	            return this;
  8060  	        },
  8061  
  8062  	        /**
  8063  	         * Finalizes the hash computation.
  8064  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  8065  	         *
  8066  	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
  8067  	         *
  8068  	         * @return {WordArray} The hash.
  8069  	         *
  8070  	         * @example
  8071  	         *
  8072  	         *     var hash = hasher.finalize();
  8073  	         *     var hash = hasher.finalize('message');
  8074  	         *     var hash = hasher.finalize(wordArray);
  8075  	         */
  8076  	        finalize: function (messageUpdate) {
  8077  	            // Final message update
  8078  	            if (messageUpdate) {
  8079  	                this._append(messageUpdate);
  8080  	            }
  8081  
  8082  	            // Perform concrete-hasher logic
  8083  	            var hash = this._doFinalize();
  8084  
  8085  	            return hash;
  8086  	        },
  8087  
  8088  	        blockSize: 512/32,
  8089  
  8090  	        /**
  8091  	         * Creates a shortcut function to a hasher's object interface.
  8092  	         *
  8093  	         * @param {Hasher} hasher The hasher to create a helper for.
  8094  	         *
  8095  	         * @return {Function} The shortcut function.
  8096  	         *
  8097  	         * @static
  8098  	         *
  8099  	         * @example
  8100  	         *
  8101  	         *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  8102  	         */
  8103  	        _createHelper: function (hasher) {
  8104  	            return function (message, cfg) {
  8105  	                return new hasher.init(cfg).finalize(message);
  8106  	            };
  8107  	        },
  8108  
  8109  	        /**
  8110  	         * Creates a shortcut function to the HMAC's object interface.
  8111  	         *
  8112  	         * @param {Hasher} hasher The hasher to use in this HMAC helper.
  8113  	         *
  8114  	         * @return {Function} The shortcut function.
  8115  	         *
  8116  	         * @static
  8117  	         *
  8118  	         * @example
  8119  	         *
  8120  	         *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  8121  	         */
  8122  	        _createHmacHelper: function (hasher) {
  8123  	            return function (message, key) {
  8124  	                return new C_algo.HMAC.init(hasher, key).finalize(message);
  8125  	            };
  8126  	        }
  8127  	    });
  8128  
  8129  	    /**
  8130  	     * Algorithm namespace.
  8131  	     */
  8132  	    var C_algo = C.algo = {};
  8133  
  8134  	    return C;
  8135  	}(Math));
  8136  
  8137  
  8138  	return CryptoJS;
  8139  
  8140  }));
  8141  },{}],54:[function(require,module,exports){
  8142  ;(function (root, factory) {
  8143  	if (typeof exports === "object") {
  8144  		// CommonJS
  8145  		module.exports = exports = factory(require("./core"));
  8146  	}
  8147  	else if (typeof define === "function" && define.amd) {
  8148  		// AMD
  8149  		define(["./core"], factory);
  8150  	}
  8151  	else {
  8152  		// Global (browser)
  8153  		factory(root.CryptoJS);
  8154  	}
  8155  }(this, function (CryptoJS) {
  8156  
  8157  	(function () {
  8158  	    // Shortcuts
  8159  	    var C = CryptoJS;
  8160  	    var C_lib = C.lib;
  8161  	    var WordArray = C_lib.WordArray;
  8162  	    var C_enc = C.enc;
  8163  
  8164  	    /**
  8165  	     * Base64 encoding strategy.
  8166  	     */
  8167  	    var Base64 = C_enc.Base64 = {
  8168  	        /**
  8169  	         * Converts a word array to a Base64 string.
  8170  	         *
  8171  	         * @param {WordArray} wordArray The word array.
  8172  	         *
  8173  	         * @return {string} The Base64 string.
  8174  	         *
  8175  	         * @static
  8176  	         *
  8177  	         * @example
  8178  	         *
  8179  	         *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  8180  	         */
  8181  	        stringify: function (wordArray) {
  8182  	            // Shortcuts
  8183  	            var words = wordArray.words;
  8184  	            var sigBytes = wordArray.sigBytes;
  8185  	            var map = this._map;
  8186  
  8187  	            // Clamp excess bits
  8188  	            wordArray.clamp();
  8189  
  8190  	            // Convert
  8191  	            var base64Chars = [];
  8192  	            for (var i = 0; i < sigBytes; i += 3) {
  8193  	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
  8194  	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  8195  	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  8196  
  8197  	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  8198  
  8199  	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  8200  	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  8201  	                }
  8202  	            }
  8203  
  8204  	            // Add padding
  8205  	            var paddingChar = map.charAt(64);
  8206  	            if (paddingChar) {
  8207  	                while (base64Chars.length % 4) {
  8208  	                    base64Chars.push(paddingChar);
  8209  	                }
  8210  	            }
  8211  
  8212  	            return base64Chars.join('');
  8213  	        },
  8214  
  8215  	        /**
  8216  	         * Converts a Base64 string to a word array.
  8217  	         *
  8218  	         * @param {string} base64Str The Base64 string.
  8219  	         *
  8220  	         * @return {WordArray} The word array.
  8221  	         *
  8222  	         * @static
  8223  	         *
  8224  	         * @example
  8225  	         *
  8226  	         *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
  8227  	         */
  8228  	        parse: function (base64Str) {
  8229  	            // Shortcuts
  8230  	            var base64StrLength = base64Str.length;
  8231  	            var map = this._map;
  8232  	            var reverseMap = this._reverseMap;
  8233  
  8234  	            if (!reverseMap) {
  8235  	                    reverseMap = this._reverseMap = [];
  8236  	                    for (var j = 0; j < map.length; j++) {
  8237  	                        reverseMap[map.charCodeAt(j)] = j;
  8238  	                    }
  8239  	            }
  8240  
  8241  	            // Ignore padding
  8242  	            var paddingChar = map.charAt(64);
  8243  	            if (paddingChar) {
  8244  	                var paddingIndex = base64Str.indexOf(paddingChar);
  8245  	                if (paddingIndex !== -1) {
  8246  	                    base64StrLength = paddingIndex;
  8247  	                }
  8248  	            }
  8249  
  8250  	            // Convert
  8251  	            return parseLoop(base64Str, base64StrLength, reverseMap);
  8252  
  8253  	        },
  8254  
  8255  	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  8256  	    };
  8257  
  8258  	    function parseLoop(base64Str, base64StrLength, reverseMap) {
  8259  	      var words = [];
  8260  	      var nBytes = 0;
  8261  	      for (var i = 0; i < base64StrLength; i++) {
  8262  	          if (i % 4) {
  8263  	              var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  8264  	              var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  8265  	              words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
  8266  	              nBytes++;
  8267  	          }
  8268  	      }
  8269  	      return WordArray.create(words, nBytes);
  8270  	    }
  8271  	}());
  8272  
  8273  
  8274  	return CryptoJS.enc.Base64;
  8275  
  8276  }));
  8277  },{"./core":53}],55:[function(require,module,exports){
  8278  ;(function (root, factory) {
  8279  	if (typeof exports === "object") {
  8280  		// CommonJS
  8281  		module.exports = exports = factory(require("./core"));
  8282  	}
  8283  	else if (typeof define === "function" && define.amd) {
  8284  		// AMD
  8285  		define(["./core"], factory);
  8286  	}
  8287  	else {
  8288  		// Global (browser)
  8289  		factory(root.CryptoJS);
  8290  	}
  8291  }(this, function (CryptoJS) {
  8292  
  8293  	(function () {
  8294  	    // Shortcuts
  8295  	    var C = CryptoJS;
  8296  	    var C_lib = C.lib;
  8297  	    var WordArray = C_lib.WordArray;
  8298  	    var C_enc = C.enc;
  8299  
  8300  	    /**
  8301  	     * UTF-16 BE encoding strategy.
  8302  	     */
  8303  	    var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
  8304  	        /**
  8305  	         * Converts a word array to a UTF-16 BE string.
  8306  	         *
  8307  	         * @param {WordArray} wordArray The word array.
  8308  	         *
  8309  	         * @return {string} The UTF-16 BE string.
  8310  	         *
  8311  	         * @static
  8312  	         *
  8313  	         * @example
  8314  	         *
  8315  	         *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  8316  	         */
  8317  	        stringify: function (wordArray) {
  8318  	            // Shortcuts
  8319  	            var words = wordArray.words;
  8320  	            var sigBytes = wordArray.sigBytes;
  8321  
  8322  	            // Convert
  8323  	            var utf16Chars = [];
  8324  	            for (var i = 0; i < sigBytes; i += 2) {
  8325  	                var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
  8326  	                utf16Chars.push(String.fromCharCode(codePoint));
  8327  	            }
  8328  
  8329  	            return utf16Chars.join('');
  8330  	        },
  8331  
  8332  	        /**
  8333  	         * Converts a UTF-16 BE string to a word array.
  8334  	         *
  8335  	         * @param {string} utf16Str The UTF-16 BE string.
  8336  	         *
  8337  	         * @return {WordArray} The word array.
  8338  	         *
  8339  	         * @static
  8340  	         *
  8341  	         * @example
  8342  	         *
  8343  	         *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  8344  	         */
  8345  	        parse: function (utf16Str) {
  8346  	            // Shortcut
  8347  	            var utf16StrLength = utf16Str.length;
  8348  
  8349  	            // Convert
  8350  	            var words = [];
  8351  	            for (var i = 0; i < utf16StrLength; i++) {
  8352  	                words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
  8353  	            }
  8354  
  8355  	            return WordArray.create(words, utf16StrLength * 2);
  8356  	        }
  8357  	    };
  8358  
  8359  	    /**
  8360  	     * UTF-16 LE encoding strategy.
  8361  	     */
  8362  	    C_enc.Utf16LE = {
  8363  	        /**
  8364  	         * Converts a word array to a UTF-16 LE string.
  8365  	         *
  8366  	         * @param {WordArray} wordArray The word array.
  8367  	         *
  8368  	         * @return {string} The UTF-16 LE string.
  8369  	         *
  8370  	         * @static
  8371  	         *
  8372  	         * @example
  8373  	         *
  8374  	         *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  8375  	         */
  8376  	        stringify: function (wordArray) {
  8377  	            // Shortcuts
  8378  	            var words = wordArray.words;
  8379  	            var sigBytes = wordArray.sigBytes;
  8380  
  8381  	            // Convert
  8382  	            var utf16Chars = [];
  8383  	            for (var i = 0; i < sigBytes; i += 2) {
  8384  	                var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
  8385  	                utf16Chars.push(String.fromCharCode(codePoint));
  8386  	            }
  8387  
  8388  	            return utf16Chars.join('');
  8389  	        },
  8390  
  8391  	        /**
  8392  	         * Converts a UTF-16 LE string to a word array.
  8393  	         *
  8394  	         * @param {string} utf16Str The UTF-16 LE string.
  8395  	         *
  8396  	         * @return {WordArray} The word array.
  8397  	         *
  8398  	         * @static
  8399  	         *
  8400  	         * @example
  8401  	         *
  8402  	         *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  8403  	         */
  8404  	        parse: function (utf16Str) {
  8405  	            // Shortcut
  8406  	            var utf16StrLength = utf16Str.length;
  8407  
  8408  	            // Convert
  8409  	            var words = [];
  8410  	            for (var i = 0; i < utf16StrLength; i++) {
  8411  	                words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
  8412  	            }
  8413  
  8414  	            return WordArray.create(words, utf16StrLength * 2);
  8415  	        }
  8416  	    };
  8417  
  8418  	    function swapEndian(word) {
  8419  	        return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
  8420  	    }
  8421  	}());
  8422  
  8423  
  8424  	return CryptoJS.enc.Utf16;
  8425  
  8426  }));
  8427  },{"./core":53}],56:[function(require,module,exports){
  8428  ;(function (root, factory, undef) {
  8429  	if (typeof exports === "object") {
  8430  		// CommonJS
  8431  		module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  8432  	}
  8433  	else if (typeof define === "function" && define.amd) {
  8434  		// AMD
  8435  		define(["./core", "./sha1", "./hmac"], factory);
  8436  	}
  8437  	else {
  8438  		// Global (browser)
  8439  		factory(root.CryptoJS);
  8440  	}
  8441  }(this, function (CryptoJS) {
  8442  
  8443  	(function () {
  8444  	    // Shortcuts
  8445  	    var C = CryptoJS;
  8446  	    var C_lib = C.lib;
  8447  	    var Base = C_lib.Base;
  8448  	    var WordArray = C_lib.WordArray;
  8449  	    var C_algo = C.algo;
  8450  	    var MD5 = C_algo.MD5;
  8451  
  8452  	    /**
  8453  	     * This key derivation function is meant to conform with EVP_BytesToKey.
  8454  	     * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  8455  	     */
  8456  	    var EvpKDF = C_algo.EvpKDF = Base.extend({
  8457  	        /**
  8458  	         * Configuration options.
  8459  	         *
  8460  	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  8461  	         * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  8462  	         * @property {number} iterations The number of iterations to perform. Default: 1
  8463  	         */
  8464  	        cfg: Base.extend({
  8465  	            keySize: 128/32,
  8466  	            hasher: MD5,
  8467  	            iterations: 1
  8468  	        }),
  8469  
  8470  	        /**
  8471  	         * Initializes a newly created key derivation function.
  8472  	         *
  8473  	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  8474  	         *
  8475  	         * @example
  8476  	         *
  8477  	         *     var kdf = CryptoJS.algo.EvpKDF.create();
  8478  	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  8479  	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  8480  	         */
  8481  	        init: function (cfg) {
  8482  	            this.cfg = this.cfg.extend(cfg);
  8483  	        },
  8484  
  8485  	        /**
  8486  	         * Derives a key from a password.
  8487  	         *
  8488  	         * @param {WordArray|string} password The password.
  8489  	         * @param {WordArray|string} salt A salt.
  8490  	         *
  8491  	         * @return {WordArray} The derived key.
  8492  	         *
  8493  	         * @example
  8494  	         *
  8495  	         *     var key = kdf.compute(password, salt);
  8496  	         */
  8497  	        compute: function (password, salt) {
  8498  	            // Shortcut
  8499  	            var cfg = this.cfg;
  8500  
  8501  	            // Init hasher
  8502  	            var hasher = cfg.hasher.create();
  8503  
  8504  	            // Initial values
  8505  	            var derivedKey = WordArray.create();
  8506  
  8507  	            // Shortcuts
  8508  	            var derivedKeyWords = derivedKey.words;
  8509  	            var keySize = cfg.keySize;
  8510  	            var iterations = cfg.iterations;
  8511  
  8512  	            // Generate key
  8513  	            while (derivedKeyWords.length < keySize) {
  8514  	                if (block) {
  8515  	                    hasher.update(block);
  8516  	                }
  8517  	                var block = hasher.update(password).finalize(salt);
  8518  	                hasher.reset();
  8519  
  8520  	                // Iterations
  8521  	                for (var i = 1; i < iterations; i++) {
  8522  	                    block = hasher.finalize(block);
  8523  	                    hasher.reset();
  8524  	                }
  8525  
  8526  	                derivedKey.concat(block);
  8527  	            }
  8528  	            derivedKey.sigBytes = keySize * 4;
  8529  
  8530  	            return derivedKey;
  8531  	        }
  8532  	    });
  8533  
  8534  	    /**
  8535  	     * Derives a key from a password.
  8536  	     *
  8537  	     * @param {WordArray|string} password The password.
  8538  	     * @param {WordArray|string} salt A salt.
  8539  	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
  8540  	     *
  8541  	     * @return {WordArray} The derived key.
  8542  	     *
  8543  	     * @static
  8544  	     *
  8545  	     * @example
  8546  	     *
  8547  	     *     var key = CryptoJS.EvpKDF(password, salt);
  8548  	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  8549  	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  8550  	     */
  8551  	    C.EvpKDF = function (password, salt, cfg) {
  8552  	        return EvpKDF.create(cfg).compute(password, salt);
  8553  	    };
  8554  	}());
  8555  
  8556  
  8557  	return CryptoJS.EvpKDF;
  8558  
  8559  }));
  8560  },{"./core":53,"./hmac":58,"./sha1":77}],57:[function(require,module,exports){
  8561  ;(function (root, factory, undef) {
  8562  	if (typeof exports === "object") {
  8563  		// CommonJS
  8564  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  8565  	}
  8566  	else if (typeof define === "function" && define.amd) {
  8567  		// AMD
  8568  		define(["./core", "./cipher-core"], factory);
  8569  	}
  8570  	else {
  8571  		// Global (browser)
  8572  		factory(root.CryptoJS);
  8573  	}
  8574  }(this, function (CryptoJS) {
  8575  
  8576  	(function (undefined) {
  8577  	    // Shortcuts
  8578  	    var C = CryptoJS;
  8579  	    var C_lib = C.lib;
  8580  	    var CipherParams = C_lib.CipherParams;
  8581  	    var C_enc = C.enc;
  8582  	    var Hex = C_enc.Hex;
  8583  	    var C_format = C.format;
  8584  
  8585  	    var HexFormatter = C_format.Hex = {
  8586  	        /**
  8587  	         * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  8588  	         *
  8589  	         * @param {CipherParams} cipherParams The cipher params object.
  8590  	         *
  8591  	         * @return {string} The hexadecimally encoded string.
  8592  	         *
  8593  	         * @static
  8594  	         *
  8595  	         * @example
  8596  	         *
  8597  	         *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  8598  	         */
  8599  	        stringify: function (cipherParams) {
  8600  	            return cipherParams.ciphertext.toString(Hex);
  8601  	        },
  8602  
  8603  	        /**
  8604  	         * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  8605  	         *
  8606  	         * @param {string} input The hexadecimally encoded string.
  8607  	         *
  8608  	         * @return {CipherParams} The cipher params object.
  8609  	         *
  8610  	         * @static
  8611  	         *
  8612  	         * @example
  8613  	         *
  8614  	         *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
  8615  	         */
  8616  	        parse: function (input) {
  8617  	            var ciphertext = Hex.parse(input);
  8618  	            return CipherParams.create({ ciphertext: ciphertext });
  8619  	        }
  8620  	    };
  8621  	}());
  8622  
  8623  
  8624  	return CryptoJS.format.Hex;
  8625  
  8626  }));
  8627  },{"./cipher-core":52,"./core":53}],58:[function(require,module,exports){
  8628  ;(function (root, factory) {
  8629  	if (typeof exports === "object") {
  8630  		// CommonJS
  8631  		module.exports = exports = factory(require("./core"));
  8632  	}
  8633  	else if (typeof define === "function" && define.amd) {
  8634  		// AMD
  8635  		define(["./core"], factory);
  8636  	}
  8637  	else {
  8638  		// Global (browser)
  8639  		factory(root.CryptoJS);
  8640  	}
  8641  }(this, function (CryptoJS) {
  8642  
  8643  	(function () {
  8644  	    // Shortcuts
  8645  	    var C = CryptoJS;
  8646  	    var C_lib = C.lib;
  8647  	    var Base = C_lib.Base;
  8648  	    var C_enc = C.enc;
  8649  	    var Utf8 = C_enc.Utf8;
  8650  	    var C_algo = C.algo;
  8651  
  8652  	    /**
  8653  	     * HMAC algorithm.
  8654  	     */
  8655  	    var HMAC = C_algo.HMAC = Base.extend({
  8656  	        /**
  8657  	         * Initializes a newly created HMAC.
  8658  	         *
  8659  	         * @param {Hasher} hasher The hash algorithm to use.
  8660  	         * @param {WordArray|string} key The secret key.
  8661  	         *
  8662  	         * @example
  8663  	         *
  8664  	         *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  8665  	         */
  8666  	        init: function (hasher, key) {
  8667  	            // Init hasher
  8668  	            hasher = this._hasher = new hasher.init();
  8669  
  8670  	            // Convert string to WordArray, else assume WordArray already
  8671  	            if (typeof key == 'string') {
  8672  	                key = Utf8.parse(key);
  8673  	            }
  8674  
  8675  	            // Shortcuts
  8676  	            var hasherBlockSize = hasher.blockSize;
  8677  	            var hasherBlockSizeBytes = hasherBlockSize * 4;
  8678  
  8679  	            // Allow arbitrary length keys
  8680  	            if (key.sigBytes > hasherBlockSizeBytes) {
  8681  	                key = hasher.finalize(key);
  8682  	            }
  8683  
  8684  	            // Clamp excess bits
  8685  	            key.clamp();
  8686  
  8687  	            // Clone key for inner and outer pads
  8688  	            var oKey = this._oKey = key.clone();
  8689  	            var iKey = this._iKey = key.clone();
  8690  
  8691  	            // Shortcuts
  8692  	            var oKeyWords = oKey.words;
  8693  	            var iKeyWords = iKey.words;
  8694  
  8695  	            // XOR keys with pad constants
  8696  	            for (var i = 0; i < hasherBlockSize; i++) {
  8697  	                oKeyWords[i] ^= 0x5c5c5c5c;
  8698  	                iKeyWords[i] ^= 0x36363636;
  8699  	            }
  8700  	            oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  8701  
  8702  	            // Set initial values
  8703  	            this.reset();
  8704  	        },
  8705  
  8706  	        /**
  8707  	         * Resets this HMAC to its initial state.
  8708  	         *
  8709  	         * @example
  8710  	         *
  8711  	         *     hmacHasher.reset();
  8712  	         */
  8713  	        reset: function () {
  8714  	            // Shortcut
  8715  	            var hasher = this._hasher;
  8716  
  8717  	            // Reset
  8718  	            hasher.reset();
  8719  	            hasher.update(this._iKey);
  8720  	        },
  8721  
  8722  	        /**
  8723  	         * Updates this HMAC with a message.
  8724  	         *
  8725  	         * @param {WordArray|string} messageUpdate The message to append.
  8726  	         *
  8727  	         * @return {HMAC} This HMAC instance.
  8728  	         *
  8729  	         * @example
  8730  	         *
  8731  	         *     hmacHasher.update('message');
  8732  	         *     hmacHasher.update(wordArray);
  8733  	         */
  8734  	        update: function (messageUpdate) {
  8735  	            this._hasher.update(messageUpdate);
  8736  
  8737  	            // Chainable
  8738  	            return this;
  8739  	        },
  8740  
  8741  	        /**
  8742  	         * Finalizes the HMAC computation.
  8743  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  8744  	         *
  8745  	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
  8746  	         *
  8747  	         * @return {WordArray} The HMAC.
  8748  	         *
  8749  	         * @example
  8750  	         *
  8751  	         *     var hmac = hmacHasher.finalize();
  8752  	         *     var hmac = hmacHasher.finalize('message');
  8753  	         *     var hmac = hmacHasher.finalize(wordArray);
  8754  	         */
  8755  	        finalize: function (messageUpdate) {
  8756  	            // Shortcut
  8757  	            var hasher = this._hasher;
  8758  
  8759  	            // Compute HMAC
  8760  	            var innerHash = hasher.finalize(messageUpdate);
  8761  	            hasher.reset();
  8762  	            var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  8763  
  8764  	            return hmac;
  8765  	        }
  8766  	    });
  8767  	}());
  8768  
  8769  
  8770  }));
  8771  },{"./core":53}],59:[function(require,module,exports){
  8772  ;(function (root, factory, undef) {
  8773  	if (typeof exports === "object") {
  8774  		// CommonJS
  8775  		module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy"));
  8776  	}
  8777  	else if (typeof define === "function" && define.amd) {
  8778  		// AMD
  8779  		define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory);
  8780  	}
  8781  	else {
  8782  		// Global (browser)
  8783  		root.CryptoJS = factory(root.CryptoJS);
  8784  	}
  8785  }(this, function (CryptoJS) {
  8786  
  8787  	return CryptoJS;
  8788  
  8789  }));
  8790  },{"./aes":51,"./cipher-core":52,"./core":53,"./enc-base64":54,"./enc-utf16":55,"./evpkdf":56,"./format-hex":57,"./hmac":58,"./lib-typedarrays":60,"./md5":61,"./mode-cfb":62,"./mode-ctr":64,"./mode-ctr-gladman":63,"./mode-ecb":65,"./mode-ofb":66,"./pad-ansix923":67,"./pad-iso10126":68,"./pad-iso97971":69,"./pad-nopadding":70,"./pad-zeropadding":71,"./pbkdf2":72,"./rabbit":74,"./rabbit-legacy":73,"./rc4":75,"./ripemd160":76,"./sha1":77,"./sha224":78,"./sha256":79,"./sha3":80,"./sha384":81,"./sha512":82,"./tripledes":83,"./x64-core":84}],60:[function(require,module,exports){
  8791  ;(function (root, factory) {
  8792  	if (typeof exports === "object") {
  8793  		// CommonJS
  8794  		module.exports = exports = factory(require("./core"));
  8795  	}
  8796  	else if (typeof define === "function" && define.amd) {
  8797  		// AMD
  8798  		define(["./core"], factory);
  8799  	}
  8800  	else {
  8801  		// Global (browser)
  8802  		factory(root.CryptoJS);
  8803  	}
  8804  }(this, function (CryptoJS) {
  8805  
  8806  	(function () {
  8807  	    // Check if typed arrays are supported
  8808  	    if (typeof ArrayBuffer != 'function') {
  8809  	        return;
  8810  	    }
  8811  
  8812  	    // Shortcuts
  8813  	    var C = CryptoJS;
  8814  	    var C_lib = C.lib;
  8815  	    var WordArray = C_lib.WordArray;
  8816  
  8817  	    // Reference original init
  8818  	    var superInit = WordArray.init;
  8819  
  8820  	    // Augment WordArray.init to handle typed arrays
  8821  	    var subInit = WordArray.init = function (typedArray) {
  8822  	        // Convert buffers to uint8
  8823  	        if (typedArray instanceof ArrayBuffer) {
  8824  	            typedArray = new Uint8Array(typedArray);
  8825  	        }
  8826  
  8827  	        // Convert other array views to uint8
  8828  	        if (
  8829  	            typedArray instanceof Int8Array ||
  8830  	            (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
  8831  	            typedArray instanceof Int16Array ||
  8832  	            typedArray instanceof Uint16Array ||
  8833  	            typedArray instanceof Int32Array ||
  8834  	            typedArray instanceof Uint32Array ||
  8835  	            typedArray instanceof Float32Array ||
  8836  	            typedArray instanceof Float64Array
  8837  	        ) {
  8838  	            typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
  8839  	        }
  8840  
  8841  	        // Handle Uint8Array
  8842  	        if (typedArray instanceof Uint8Array) {
  8843  	            // Shortcut
  8844  	            var typedArrayByteLength = typedArray.byteLength;
  8845  
  8846  	            // Extract bytes
  8847  	            var words = [];
  8848  	            for (var i = 0; i < typedArrayByteLength; i++) {
  8849  	                words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
  8850  	            }
  8851  
  8852  	            // Initialize this word array
  8853  	            superInit.call(this, words, typedArrayByteLength);
  8854  	        } else {
  8855  	            // Else call normal init
  8856  	            superInit.apply(this, arguments);
  8857  	        }
  8858  	    };
  8859  
  8860  	    subInit.prototype = WordArray;
  8861  	}());
  8862  
  8863  
  8864  	return CryptoJS.lib.WordArray;
  8865  
  8866  }));
  8867  },{"./core":53}],61:[function(require,module,exports){
  8868  ;(function (root, factory) {
  8869  	if (typeof exports === "object") {
  8870  		// CommonJS
  8871  		module.exports = exports = factory(require("./core"));
  8872  	}
  8873  	else if (typeof define === "function" && define.amd) {
  8874  		// AMD
  8875  		define(["./core"], factory);
  8876  	}
  8877  	else {
  8878  		// Global (browser)
  8879  		factory(root.CryptoJS);
  8880  	}
  8881  }(this, function (CryptoJS) {
  8882  
  8883  	(function (Math) {
  8884  	    // Shortcuts
  8885  	    var C = CryptoJS;
  8886  	    var C_lib = C.lib;
  8887  	    var WordArray = C_lib.WordArray;
  8888  	    var Hasher = C_lib.Hasher;
  8889  	    var C_algo = C.algo;
  8890  
  8891  	    // Constants table
  8892  	    var T = [];
  8893  
  8894  	    // Compute constants
  8895  	    (function () {
  8896  	        for (var i = 0; i < 64; i++) {
  8897  	            T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
  8898  	        }
  8899  	    }());
  8900  
  8901  	    /**
  8902  	     * MD5 hash algorithm.
  8903  	     */
  8904  	    var MD5 = C_algo.MD5 = Hasher.extend({
  8905  	        _doReset: function () {
  8906  	            this._hash = new WordArray.init([
  8907  	                0x67452301, 0xefcdab89,
  8908  	                0x98badcfe, 0x10325476
  8909  	            ]);
  8910  	        },
  8911  
  8912  	        _doProcessBlock: function (M, offset) {
  8913  	            // Swap endian
  8914  	            for (var i = 0; i < 16; i++) {
  8915  	                // Shortcuts
  8916  	                var offset_i = offset + i;
  8917  	                var M_offset_i = M[offset_i];
  8918  
  8919  	                M[offset_i] = (
  8920  	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
  8921  	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
  8922  	                );
  8923  	            }
  8924  
  8925  	            // Shortcuts
  8926  	            var H = this._hash.words;
  8927  
  8928  	            var M_offset_0  = M[offset + 0];
  8929  	            var M_offset_1  = M[offset + 1];
  8930  	            var M_offset_2  = M[offset + 2];
  8931  	            var M_offset_3  = M[offset + 3];
  8932  	            var M_offset_4  = M[offset + 4];
  8933  	            var M_offset_5  = M[offset + 5];
  8934  	            var M_offset_6  = M[offset + 6];
  8935  	            var M_offset_7  = M[offset + 7];
  8936  	            var M_offset_8  = M[offset + 8];
  8937  	            var M_offset_9  = M[offset + 9];
  8938  	            var M_offset_10 = M[offset + 10];
  8939  	            var M_offset_11 = M[offset + 11];
  8940  	            var M_offset_12 = M[offset + 12];
  8941  	            var M_offset_13 = M[offset + 13];
  8942  	            var M_offset_14 = M[offset + 14];
  8943  	            var M_offset_15 = M[offset + 15];
  8944  
  8945  	            // Working varialbes
  8946  	            var a = H[0];
  8947  	            var b = H[1];
  8948  	            var c = H[2];
  8949  	            var d = H[3];
  8950  
  8951  	            // Computation
  8952  	            a = FF(a, b, c, d, M_offset_0,  7,  T[0]);
  8953  	            d = FF(d, a, b, c, M_offset_1,  12, T[1]);
  8954  	            c = FF(c, d, a, b, M_offset_2,  17, T[2]);
  8955  	            b = FF(b, c, d, a, M_offset_3,  22, T[3]);
  8956  	            a = FF(a, b, c, d, M_offset_4,  7,  T[4]);
  8957  	            d = FF(d, a, b, c, M_offset_5,  12, T[5]);
  8958  	            c = FF(c, d, a, b, M_offset_6,  17, T[6]);
  8959  	            b = FF(b, c, d, a, M_offset_7,  22, T[7]);
  8960  	            a = FF(a, b, c, d, M_offset_8,  7,  T[8]);
  8961  	            d = FF(d, a, b, c, M_offset_9,  12, T[9]);
  8962  	            c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  8963  	            b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  8964  	            a = FF(a, b, c, d, M_offset_12, 7,  T[12]);
  8965  	            d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  8966  	            c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  8967  	            b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  8968  
  8969  	            a = GG(a, b, c, d, M_offset_1,  5,  T[16]);
  8970  	            d = GG(d, a, b, c, M_offset_6,  9,  T[17]);
  8971  	            c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  8972  	            b = GG(b, c, d, a, M_offset_0,  20, T[19]);
  8973  	            a = GG(a, b, c, d, M_offset_5,  5,  T[20]);
  8974  	            d = GG(d, a, b, c, M_offset_10, 9,  T[21]);
  8975  	            c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  8976  	            b = GG(b, c, d, a, M_offset_4,  20, T[23]);
  8977  	            a = GG(a, b, c, d, M_offset_9,  5,  T[24]);
  8978  	            d = GG(d, a, b, c, M_offset_14, 9,  T[25]);
  8979  	            c = GG(c, d, a, b, M_offset_3,  14, T[26]);
  8980  	            b = GG(b, c, d, a, M_offset_8,  20, T[27]);
  8981  	            a = GG(a, b, c, d, M_offset_13, 5,  T[28]);
  8982  	            d = GG(d, a, b, c, M_offset_2,  9,  T[29]);
  8983  	            c = GG(c, d, a, b, M_offset_7,  14, T[30]);
  8984  	            b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  8985  
  8986  	            a = HH(a, b, c, d, M_offset_5,  4,  T[32]);
  8987  	            d = HH(d, a, b, c, M_offset_8,  11, T[33]);
  8988  	            c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  8989  	            b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  8990  	            a = HH(a, b, c, d, M_offset_1,  4,  T[36]);
  8991  	            d = HH(d, a, b, c, M_offset_4,  11, T[37]);
  8992  	            c = HH(c, d, a, b, M_offset_7,  16, T[38]);
  8993  	            b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  8994  	            a = HH(a, b, c, d, M_offset_13, 4,  T[40]);
  8995  	            d = HH(d, a, b, c, M_offset_0,  11, T[41]);
  8996  	            c = HH(c, d, a, b, M_offset_3,  16, T[42]);
  8997  	            b = HH(b, c, d, a, M_offset_6,  23, T[43]);
  8998  	            a = HH(a, b, c, d, M_offset_9,  4,  T[44]);
  8999  	            d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  9000  	            c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  9001  	            b = HH(b, c, d, a, M_offset_2,  23, T[47]);
  9002  
  9003  	            a = II(a, b, c, d, M_offset_0,  6,  T[48]);
  9004  	            d = II(d, a, b, c, M_offset_7,  10, T[49]);
  9005  	            c = II(c, d, a, b, M_offset_14, 15, T[50]);
  9006  	            b = II(b, c, d, a, M_offset_5,  21, T[51]);
  9007  	            a = II(a, b, c, d, M_offset_12, 6,  T[52]);
  9008  	            d = II(d, a, b, c, M_offset_3,  10, T[53]);
  9009  	            c = II(c, d, a, b, M_offset_10, 15, T[54]);
  9010  	            b = II(b, c, d, a, M_offset_1,  21, T[55]);
  9011  	            a = II(a, b, c, d, M_offset_8,  6,  T[56]);
  9012  	            d = II(d, a, b, c, M_offset_15, 10, T[57]);
  9013  	            c = II(c, d, a, b, M_offset_6,  15, T[58]);
  9014  	            b = II(b, c, d, a, M_offset_13, 21, T[59]);
  9015  	            a = II(a, b, c, d, M_offset_4,  6,  T[60]);
  9016  	            d = II(d, a, b, c, M_offset_11, 10, T[61]);
  9017  	            c = II(c, d, a, b, M_offset_2,  15, T[62]);
  9018  	            b = II(b, c, d, a, M_offset_9,  21, T[63]);
  9019  
  9020  	            // Intermediate hash value
  9021  	            H[0] = (H[0] + a) | 0;
  9022  	            H[1] = (H[1] + b) | 0;
  9023  	            H[2] = (H[2] + c) | 0;
  9024  	            H[3] = (H[3] + d) | 0;
  9025  	        },
  9026  
  9027  	        _doFinalize: function () {
  9028  	            // Shortcuts
  9029  	            var data = this._data;
  9030  	            var dataWords = data.words;
  9031  
  9032  	            var nBitsTotal = this._nDataBytes * 8;
  9033  	            var nBitsLeft = data.sigBytes * 8;
  9034  
  9035  	            // Add padding
  9036  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  9037  
  9038  	            var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  9039  	            var nBitsTotalL = nBitsTotal;
  9040  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
  9041  	                (((nBitsTotalH << 8)  | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
  9042  	                (((nBitsTotalH << 24) | (nBitsTotalH >>> 8))  & 0xff00ff00)
  9043  	            );
  9044  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  9045  	                (((nBitsTotalL << 8)  | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
  9046  	                (((nBitsTotalL << 24) | (nBitsTotalL >>> 8))  & 0xff00ff00)
  9047  	            );
  9048  
  9049  	            data.sigBytes = (dataWords.length + 1) * 4;
  9050  
  9051  	            // Hash final blocks
  9052  	            this._process();
  9053  
  9054  	            // Shortcuts
  9055  	            var hash = this._hash;
  9056  	            var H = hash.words;
  9057  
  9058  	            // Swap endian
  9059  	            for (var i = 0; i < 4; i++) {
  9060  	                // Shortcut
  9061  	                var H_i = H[i];
  9062  
  9063  	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
  9064  	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
  9065  	            }
  9066  
  9067  	            // Return final computed hash
  9068  	            return hash;
  9069  	        },
  9070  
  9071  	        clone: function () {
  9072  	            var clone = Hasher.clone.call(this);
  9073  	            clone._hash = this._hash.clone();
  9074  
  9075  	            return clone;
  9076  	        }
  9077  	    });
  9078  
  9079  	    function FF(a, b, c, d, x, s, t) {
  9080  	        var n = a + ((b & c) | (~b & d)) + x + t;
  9081  	        return ((n << s) | (n >>> (32 - s))) + b;
  9082  	    }
  9083  
  9084  	    function GG(a, b, c, d, x, s, t) {
  9085  	        var n = a + ((b & d) | (c & ~d)) + x + t;
  9086  	        return ((n << s) | (n >>> (32 - s))) + b;
  9087  	    }
  9088  
  9089  	    function HH(a, b, c, d, x, s, t) {
  9090  	        var n = a + (b ^ c ^ d) + x + t;
  9091  	        return ((n << s) | (n >>> (32 - s))) + b;
  9092  	    }
  9093  
  9094  	    function II(a, b, c, d, x, s, t) {
  9095  	        var n = a + (c ^ (b | ~d)) + x + t;
  9096  	        return ((n << s) | (n >>> (32 - s))) + b;
  9097  	    }
  9098  
  9099  	    /**
  9100  	     * Shortcut function to the hasher's object interface.
  9101  	     *
  9102  	     * @param {WordArray|string} message The message to hash.
  9103  	     *
  9104  	     * @return {WordArray} The hash.
  9105  	     *
  9106  	     * @static
  9107  	     *
  9108  	     * @example
  9109  	     *
  9110  	     *     var hash = CryptoJS.MD5('message');
  9111  	     *     var hash = CryptoJS.MD5(wordArray);
  9112  	     */
  9113  	    C.MD5 = Hasher._createHelper(MD5);
  9114  
  9115  	    /**
  9116  	     * Shortcut function to the HMAC's object interface.
  9117  	     *
  9118  	     * @param {WordArray|string} message The message to hash.
  9119  	     * @param {WordArray|string} key The secret key.
  9120  	     *
  9121  	     * @return {WordArray} The HMAC.
  9122  	     *
  9123  	     * @static
  9124  	     *
  9125  	     * @example
  9126  	     *
  9127  	     *     var hmac = CryptoJS.HmacMD5(message, key);
  9128  	     */
  9129  	    C.HmacMD5 = Hasher._createHmacHelper(MD5);
  9130  	}(Math));
  9131  
  9132  
  9133  	return CryptoJS.MD5;
  9134  
  9135  }));
  9136  },{"./core":53}],62:[function(require,module,exports){
  9137  ;(function (root, factory, undef) {
  9138  	if (typeof exports === "object") {
  9139  		// CommonJS
  9140  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9141  	}
  9142  	else if (typeof define === "function" && define.amd) {
  9143  		// AMD
  9144  		define(["./core", "./cipher-core"], factory);
  9145  	}
  9146  	else {
  9147  		// Global (browser)
  9148  		factory(root.CryptoJS);
  9149  	}
  9150  }(this, function (CryptoJS) {
  9151  
  9152  	/**
  9153  	 * Cipher Feedback block mode.
  9154  	 */
  9155  	CryptoJS.mode.CFB = (function () {
  9156  	    var CFB = CryptoJS.lib.BlockCipherMode.extend();
  9157  
  9158  	    CFB.Encryptor = CFB.extend({
  9159  	        processBlock: function (words, offset) {
  9160  	            // Shortcuts
  9161  	            var cipher = this._cipher;
  9162  	            var blockSize = cipher.blockSize;
  9163  
  9164  	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  9165  
  9166  	            // Remember this block to use with next block
  9167  	            this._prevBlock = words.slice(offset, offset + blockSize);
  9168  	        }
  9169  	    });
  9170  
  9171  	    CFB.Decryptor = CFB.extend({
  9172  	        processBlock: function (words, offset) {
  9173  	            // Shortcuts
  9174  	            var cipher = this._cipher;
  9175  	            var blockSize = cipher.blockSize;
  9176  
  9177  	            // Remember this block to use with next block
  9178  	            var thisBlock = words.slice(offset, offset + blockSize);
  9179  
  9180  	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  9181  
  9182  	            // This block becomes the previous block
  9183  	            this._prevBlock = thisBlock;
  9184  	        }
  9185  	    });
  9186  
  9187  	    function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
  9188  	        // Shortcut
  9189  	        var iv = this._iv;
  9190  
  9191  	        // Generate keystream
  9192  	        if (iv) {
  9193  	            var keystream = iv.slice(0);
  9194  
  9195  	            // Remove IV for subsequent blocks
  9196  	            this._iv = undefined;
  9197  	        } else {
  9198  	            var keystream = this._prevBlock;
  9199  	        }
  9200  	        cipher.encryptBlock(keystream, 0);
  9201  
  9202  	        // Encrypt
  9203  	        for (var i = 0; i < blockSize; i++) {
  9204  	            words[offset + i] ^= keystream[i];
  9205  	        }
  9206  	    }
  9207  
  9208  	    return CFB;
  9209  	}());
  9210  
  9211  
  9212  	return CryptoJS.mode.CFB;
  9213  
  9214  }));
  9215  },{"./cipher-core":52,"./core":53}],63:[function(require,module,exports){
  9216  ;(function (root, factory, undef) {
  9217  	if (typeof exports === "object") {
  9218  		// CommonJS
  9219  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9220  	}
  9221  	else if (typeof define === "function" && define.amd) {
  9222  		// AMD
  9223  		define(["./core", "./cipher-core"], factory);
  9224  	}
  9225  	else {
  9226  		// Global (browser)
  9227  		factory(root.CryptoJS);
  9228  	}
  9229  }(this, function (CryptoJS) {
  9230  
  9231  	/** @preserve
  9232  	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
  9233  	 * derived from CryptoJS.mode.CTR
  9234  	 * Jan Hruby jhruby.web@gmail.com
  9235  	 */
  9236  	CryptoJS.mode.CTRGladman = (function () {
  9237  	    var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
  9238  
  9239  		function incWord(word)
  9240  		{
  9241  			if (((word >> 24) & 0xff) === 0xff) { //overflow
  9242  			var b1 = (word >> 16)&0xff;
  9243  			var b2 = (word >> 8)&0xff;
  9244  			var b3 = word & 0xff;
  9245  
  9246  			if (b1 === 0xff) // overflow b1
  9247  			{
  9248  			b1 = 0;
  9249  			if (b2 === 0xff)
  9250  			{
  9251  				b2 = 0;
  9252  				if (b3 === 0xff)
  9253  				{
  9254  					b3 = 0;
  9255  				}
  9256  				else
  9257  				{
  9258  					++b3;
  9259  				}
  9260  			}
  9261  			else
  9262  			{
  9263  				++b2;
  9264  			}
  9265  			}
  9266  			else
  9267  			{
  9268  			++b1;
  9269  			}
  9270  
  9271  			word = 0;
  9272  			word += (b1 << 16);
  9273  			word += (b2 << 8);
  9274  			word += b3;
  9275  			}
  9276  			else
  9277  			{
  9278  			word += (0x01 << 24);
  9279  			}
  9280  			return word;
  9281  		}
  9282  
  9283  		function incCounter(counter)
  9284  		{
  9285  			if ((counter[0] = incWord(counter[0])) === 0)
  9286  			{
  9287  				// encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
  9288  				counter[1] = incWord(counter[1]);
  9289  			}
  9290  			return counter;
  9291  		}
  9292  
  9293  	    var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
  9294  	        processBlock: function (words, offset) {
  9295  	            // Shortcuts
  9296  	            var cipher = this._cipher
  9297  	            var blockSize = cipher.blockSize;
  9298  	            var iv = this._iv;
  9299  	            var counter = this._counter;
  9300  
  9301  	            // Generate keystream
  9302  	            if (iv) {
  9303  	                counter = this._counter = iv.slice(0);
  9304  
  9305  	                // Remove IV for subsequent blocks
  9306  	                this._iv = undefined;
  9307  	            }
  9308  
  9309  				incCounter(counter);
  9310  
  9311  				var keystream = counter.slice(0);
  9312  	            cipher.encryptBlock(keystream, 0);
  9313  
  9314  	            // Encrypt
  9315  	            for (var i = 0; i < blockSize; i++) {
  9316  	                words[offset + i] ^= keystream[i];
  9317  	            }
  9318  	        }
  9319  	    });
  9320  
  9321  	    CTRGladman.Decryptor = Encryptor;
  9322  
  9323  	    return CTRGladman;
  9324  	}());
  9325  
  9326  
  9327  
  9328  
  9329  	return CryptoJS.mode.CTRGladman;
  9330  
  9331  }));
  9332  },{"./cipher-core":52,"./core":53}],64:[function(require,module,exports){
  9333  ;(function (root, factory, undef) {
  9334  	if (typeof exports === "object") {
  9335  		// CommonJS
  9336  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9337  	}
  9338  	else if (typeof define === "function" && define.amd) {
  9339  		// AMD
  9340  		define(["./core", "./cipher-core"], factory);
  9341  	}
  9342  	else {
  9343  		// Global (browser)
  9344  		factory(root.CryptoJS);
  9345  	}
  9346  }(this, function (CryptoJS) {
  9347  
  9348  	/**
  9349  	 * Counter block mode.
  9350  	 */
  9351  	CryptoJS.mode.CTR = (function () {
  9352  	    var CTR = CryptoJS.lib.BlockCipherMode.extend();
  9353  
  9354  	    var Encryptor = CTR.Encryptor = CTR.extend({
  9355  	        processBlock: function (words, offset) {
  9356  	            // Shortcuts
  9357  	            var cipher = this._cipher
  9358  	            var blockSize = cipher.blockSize;
  9359  	            var iv = this._iv;
  9360  	            var counter = this._counter;
  9361  
  9362  	            // Generate keystream
  9363  	            if (iv) {
  9364  	                counter = this._counter = iv.slice(0);
  9365  
  9366  	                // Remove IV for subsequent blocks
  9367  	                this._iv = undefined;
  9368  	            }
  9369  	            var keystream = counter.slice(0);
  9370  	            cipher.encryptBlock(keystream, 0);
  9371  
  9372  	            // Increment counter
  9373  	            counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
  9374  
  9375  	            // Encrypt
  9376  	            for (var i = 0; i < blockSize; i++) {
  9377  	                words[offset + i] ^= keystream[i];
  9378  	            }
  9379  	        }
  9380  	    });
  9381  
  9382  	    CTR.Decryptor = Encryptor;
  9383  
  9384  	    return CTR;
  9385  	}());
  9386  
  9387  
  9388  	return CryptoJS.mode.CTR;
  9389  
  9390  }));
  9391  },{"./cipher-core":52,"./core":53}],65:[function(require,module,exports){
  9392  ;(function (root, factory, undef) {
  9393  	if (typeof exports === "object") {
  9394  		// CommonJS
  9395  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9396  	}
  9397  	else if (typeof define === "function" && define.amd) {
  9398  		// AMD
  9399  		define(["./core", "./cipher-core"], factory);
  9400  	}
  9401  	else {
  9402  		// Global (browser)
  9403  		factory(root.CryptoJS);
  9404  	}
  9405  }(this, function (CryptoJS) {
  9406  
  9407  	/**
  9408  	 * Electronic Codebook block mode.
  9409  	 */
  9410  	CryptoJS.mode.ECB = (function () {
  9411  	    var ECB = CryptoJS.lib.BlockCipherMode.extend();
  9412  
  9413  	    ECB.Encryptor = ECB.extend({
  9414  	        processBlock: function (words, offset) {
  9415  	            this._cipher.encryptBlock(words, offset);
  9416  	        }
  9417  	    });
  9418  
  9419  	    ECB.Decryptor = ECB.extend({
  9420  	        processBlock: function (words, offset) {
  9421  	            this._cipher.decryptBlock(words, offset);
  9422  	        }
  9423  	    });
  9424  
  9425  	    return ECB;
  9426  	}());
  9427  
  9428  
  9429  	return CryptoJS.mode.ECB;
  9430  
  9431  }));
  9432  },{"./cipher-core":52,"./core":53}],66:[function(require,module,exports){
  9433  ;(function (root, factory, undef) {
  9434  	if (typeof exports === "object") {
  9435  		// CommonJS
  9436  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9437  	}
  9438  	else if (typeof define === "function" && define.amd) {
  9439  		// AMD
  9440  		define(["./core", "./cipher-core"], factory);
  9441  	}
  9442  	else {
  9443  		// Global (browser)
  9444  		factory(root.CryptoJS);
  9445  	}
  9446  }(this, function (CryptoJS) {
  9447  
  9448  	/**
  9449  	 * Output Feedback block mode.
  9450  	 */
  9451  	CryptoJS.mode.OFB = (function () {
  9452  	    var OFB = CryptoJS.lib.BlockCipherMode.extend();
  9453  
  9454  	    var Encryptor = OFB.Encryptor = OFB.extend({
  9455  	        processBlock: function (words, offset) {
  9456  	            // Shortcuts
  9457  	            var cipher = this._cipher
  9458  	            var blockSize = cipher.blockSize;
  9459  	            var iv = this._iv;
  9460  	            var keystream = this._keystream;
  9461  
  9462  	            // Generate keystream
  9463  	            if (iv) {
  9464  	                keystream = this._keystream = iv.slice(0);
  9465  
  9466  	                // Remove IV for subsequent blocks
  9467  	                this._iv = undefined;
  9468  	            }
  9469  	            cipher.encryptBlock(keystream, 0);
  9470  
  9471  	            // Encrypt
  9472  	            for (var i = 0; i < blockSize; i++) {
  9473  	                words[offset + i] ^= keystream[i];
  9474  	            }
  9475  	        }
  9476  	    });
  9477  
  9478  	    OFB.Decryptor = Encryptor;
  9479  
  9480  	    return OFB;
  9481  	}());
  9482  
  9483  
  9484  	return CryptoJS.mode.OFB;
  9485  
  9486  }));
  9487  },{"./cipher-core":52,"./core":53}],67:[function(require,module,exports){
  9488  ;(function (root, factory, undef) {
  9489  	if (typeof exports === "object") {
  9490  		// CommonJS
  9491  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9492  	}
  9493  	else if (typeof define === "function" && define.amd) {
  9494  		// AMD
  9495  		define(["./core", "./cipher-core"], factory);
  9496  	}
  9497  	else {
  9498  		// Global (browser)
  9499  		factory(root.CryptoJS);
  9500  	}
  9501  }(this, function (CryptoJS) {
  9502  
  9503  	/**
  9504  	 * ANSI X.923 padding strategy.
  9505  	 */
  9506  	CryptoJS.pad.AnsiX923 = {
  9507  	    pad: function (data, blockSize) {
  9508  	        // Shortcuts
  9509  	        var dataSigBytes = data.sigBytes;
  9510  	        var blockSizeBytes = blockSize * 4;
  9511  
  9512  	        // Count padding bytes
  9513  	        var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
  9514  
  9515  	        // Compute last byte position
  9516  	        var lastBytePos = dataSigBytes + nPaddingBytes - 1;
  9517  
  9518  	        // Pad
  9519  	        data.clamp();
  9520  	        data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
  9521  	        data.sigBytes += nPaddingBytes;
  9522  	    },
  9523  
  9524  	    unpad: function (data) {
  9525  	        // Get number of padding bytes from last byte
  9526  	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  9527  
  9528  	        // Remove padding
  9529  	        data.sigBytes -= nPaddingBytes;
  9530  	    }
  9531  	};
  9532  
  9533  
  9534  	return CryptoJS.pad.Ansix923;
  9535  
  9536  }));
  9537  },{"./cipher-core":52,"./core":53}],68:[function(require,module,exports){
  9538  ;(function (root, factory, undef) {
  9539  	if (typeof exports === "object") {
  9540  		// CommonJS
  9541  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9542  	}
  9543  	else if (typeof define === "function" && define.amd) {
  9544  		// AMD
  9545  		define(["./core", "./cipher-core"], factory);
  9546  	}
  9547  	else {
  9548  		// Global (browser)
  9549  		factory(root.CryptoJS);
  9550  	}
  9551  }(this, function (CryptoJS) {
  9552  
  9553  	/**
  9554  	 * ISO 10126 padding strategy.
  9555  	 */
  9556  	CryptoJS.pad.Iso10126 = {
  9557  	    pad: function (data, blockSize) {
  9558  	        // Shortcut
  9559  	        var blockSizeBytes = blockSize * 4;
  9560  
  9561  	        // Count padding bytes
  9562  	        var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  9563  
  9564  	        // Pad
  9565  	        data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
  9566  	             concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
  9567  	    },
  9568  
  9569  	    unpad: function (data) {
  9570  	        // Get number of padding bytes from last byte
  9571  	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  9572  
  9573  	        // Remove padding
  9574  	        data.sigBytes -= nPaddingBytes;
  9575  	    }
  9576  	};
  9577  
  9578  
  9579  	return CryptoJS.pad.Iso10126;
  9580  
  9581  }));
  9582  },{"./cipher-core":52,"./core":53}],69:[function(require,module,exports){
  9583  ;(function (root, factory, undef) {
  9584  	if (typeof exports === "object") {
  9585  		// CommonJS
  9586  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9587  	}
  9588  	else if (typeof define === "function" && define.amd) {
  9589  		// AMD
  9590  		define(["./core", "./cipher-core"], factory);
  9591  	}
  9592  	else {
  9593  		// Global (browser)
  9594  		factory(root.CryptoJS);
  9595  	}
  9596  }(this, function (CryptoJS) {
  9597  
  9598  	/**
  9599  	 * ISO/IEC 9797-1 Padding Method 2.
  9600  	 */
  9601  	CryptoJS.pad.Iso97971 = {
  9602  	    pad: function (data, blockSize) {
  9603  	        // Add 0x80 byte
  9604  	        data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
  9605  
  9606  	        // Zero pad the rest
  9607  	        CryptoJS.pad.ZeroPadding.pad(data, blockSize);
  9608  	    },
  9609  
  9610  	    unpad: function (data) {
  9611  	        // Remove zero padding
  9612  	        CryptoJS.pad.ZeroPadding.unpad(data);
  9613  
  9614  	        // Remove one more byte -- the 0x80 byte
  9615  	        data.sigBytes--;
  9616  	    }
  9617  	};
  9618  
  9619  
  9620  	return CryptoJS.pad.Iso97971;
  9621  
  9622  }));
  9623  },{"./cipher-core":52,"./core":53}],70:[function(require,module,exports){
  9624  ;(function (root, factory, undef) {
  9625  	if (typeof exports === "object") {
  9626  		// CommonJS
  9627  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9628  	}
  9629  	else if (typeof define === "function" && define.amd) {
  9630  		// AMD
  9631  		define(["./core", "./cipher-core"], factory);
  9632  	}
  9633  	else {
  9634  		// Global (browser)
  9635  		factory(root.CryptoJS);
  9636  	}
  9637  }(this, function (CryptoJS) {
  9638  
  9639  	/**
  9640  	 * A noop padding strategy.
  9641  	 */
  9642  	CryptoJS.pad.NoPadding = {
  9643  	    pad: function () {
  9644  	    },
  9645  
  9646  	    unpad: function () {
  9647  	    }
  9648  	};
  9649  
  9650  
  9651  	return CryptoJS.pad.NoPadding;
  9652  
  9653  }));
  9654  },{"./cipher-core":52,"./core":53}],71:[function(require,module,exports){
  9655  ;(function (root, factory, undef) {
  9656  	if (typeof exports === "object") {
  9657  		// CommonJS
  9658  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9659  	}
  9660  	else if (typeof define === "function" && define.amd) {
  9661  		// AMD
  9662  		define(["./core", "./cipher-core"], factory);
  9663  	}
  9664  	else {
  9665  		// Global (browser)
  9666  		factory(root.CryptoJS);
  9667  	}
  9668  }(this, function (CryptoJS) {
  9669  
  9670  	/**
  9671  	 * Zero padding strategy.
  9672  	 */
  9673  	CryptoJS.pad.ZeroPadding = {
  9674  	    pad: function (data, blockSize) {
  9675  	        // Shortcut
  9676  	        var blockSizeBytes = blockSize * 4;
  9677  
  9678  	        // Pad
  9679  	        data.clamp();
  9680  	        data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
  9681  	    },
  9682  
  9683  	    unpad: function (data) {
  9684  	        // Shortcut
  9685  	        var dataWords = data.words;
  9686  
  9687  	        // Unpad
  9688  	        var i = data.sigBytes - 1;
  9689  	        while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
  9690  	            i--;
  9691  	        }
  9692  	        data.sigBytes = i + 1;
  9693  	    }
  9694  	};
  9695  
  9696  
  9697  	return CryptoJS.pad.ZeroPadding;
  9698  
  9699  }));
  9700  },{"./cipher-core":52,"./core":53}],72:[function(require,module,exports){
  9701  ;(function (root, factory, undef) {
  9702  	if (typeof exports === "object") {
  9703  		// CommonJS
  9704  		module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  9705  	}
  9706  	else if (typeof define === "function" && define.amd) {
  9707  		// AMD
  9708  		define(["./core", "./sha1", "./hmac"], factory);
  9709  	}
  9710  	else {
  9711  		// Global (browser)
  9712  		factory(root.CryptoJS);
  9713  	}
  9714  }(this, function (CryptoJS) {
  9715  
  9716  	(function () {
  9717  	    // Shortcuts
  9718  	    var C = CryptoJS;
  9719  	    var C_lib = C.lib;
  9720  	    var Base = C_lib.Base;
  9721  	    var WordArray = C_lib.WordArray;
  9722  	    var C_algo = C.algo;
  9723  	    var SHA1 = C_algo.SHA1;
  9724  	    var HMAC = C_algo.HMAC;
  9725  
  9726  	    /**
  9727  	     * Password-Based Key Derivation Function 2 algorithm.
  9728  	     */
  9729  	    var PBKDF2 = C_algo.PBKDF2 = Base.extend({
  9730  	        /**
  9731  	         * Configuration options.
  9732  	         *
  9733  	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  9734  	         * @property {Hasher} hasher The hasher to use. Default: SHA1
  9735  	         * @property {number} iterations The number of iterations to perform. Default: 1
  9736  	         */
  9737  	        cfg: Base.extend({
  9738  	            keySize: 128/32,
  9739  	            hasher: SHA1,
  9740  	            iterations: 1
  9741  	        }),
  9742  
  9743  	        /**
  9744  	         * Initializes a newly created key derivation function.
  9745  	         *
  9746  	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  9747  	         *
  9748  	         * @example
  9749  	         *
  9750  	         *     var kdf = CryptoJS.algo.PBKDF2.create();
  9751  	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
  9752  	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
  9753  	         */
  9754  	        init: function (cfg) {
  9755  	            this.cfg = this.cfg.extend(cfg);
  9756  	        },
  9757  
  9758  	        /**
  9759  	         * Computes the Password-Based Key Derivation Function 2.
  9760  	         *
  9761  	         * @param {WordArray|string} password The password.
  9762  	         * @param {WordArray|string} salt A salt.
  9763  	         *
  9764  	         * @return {WordArray} The derived key.
  9765  	         *
  9766  	         * @example
  9767  	         *
  9768  	         *     var key = kdf.compute(password, salt);
  9769  	         */
  9770  	        compute: function (password, salt) {
  9771  	            // Shortcut
  9772  	            var cfg = this.cfg;
  9773  
  9774  	            // Init HMAC
  9775  	            var hmac = HMAC.create(cfg.hasher, password);
  9776  
  9777  	            // Initial values
  9778  	            var derivedKey = WordArray.create();
  9779  	            var blockIndex = WordArray.create([0x00000001]);
  9780  
  9781  	            // Shortcuts
  9782  	            var derivedKeyWords = derivedKey.words;
  9783  	            var blockIndexWords = blockIndex.words;
  9784  	            var keySize = cfg.keySize;
  9785  	            var iterations = cfg.iterations;
  9786  
  9787  	            // Generate key
  9788  	            while (derivedKeyWords.length < keySize) {
  9789  	                var block = hmac.update(salt).finalize(blockIndex);
  9790  	                hmac.reset();
  9791  
  9792  	                // Shortcuts
  9793  	                var blockWords = block.words;
  9794  	                var blockWordsLength = blockWords.length;
  9795  
  9796  	                // Iterations
  9797  	                var intermediate = block;
  9798  	                for (var i = 1; i < iterations; i++) {
  9799  	                    intermediate = hmac.finalize(intermediate);
  9800  	                    hmac.reset();
  9801  
  9802  	                    // Shortcut
  9803  	                    var intermediateWords = intermediate.words;
  9804  
  9805  	                    // XOR intermediate with block
  9806  	                    for (var j = 0; j < blockWordsLength; j++) {
  9807  	                        blockWords[j] ^= intermediateWords[j];
  9808  	                    }
  9809  	                }
  9810  
  9811  	                derivedKey.concat(block);
  9812  	                blockIndexWords[0]++;
  9813  	            }
  9814  	            derivedKey.sigBytes = keySize * 4;
  9815  
  9816  	            return derivedKey;
  9817  	        }
  9818  	    });
  9819  
  9820  	    /**
  9821  	     * Computes the Password-Based Key Derivation Function 2.
  9822  	     *
  9823  	     * @param {WordArray|string} password The password.
  9824  	     * @param {WordArray|string} salt A salt.
  9825  	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
  9826  	     *
  9827  	     * @return {WordArray} The derived key.
  9828  	     *
  9829  	     * @static
  9830  	     *
  9831  	     * @example
  9832  	     *
  9833  	     *     var key = CryptoJS.PBKDF2(password, salt);
  9834  	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
  9835  	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
  9836  	     */
  9837  	    C.PBKDF2 = function (password, salt, cfg) {
  9838  	        return PBKDF2.create(cfg).compute(password, salt);
  9839  	    };
  9840  	}());
  9841  
  9842  
  9843  	return CryptoJS.PBKDF2;
  9844  
  9845  }));
  9846  },{"./core":53,"./hmac":58,"./sha1":77}],73:[function(require,module,exports){
  9847  ;(function (root, factory, undef) {
  9848  	if (typeof exports === "object") {
  9849  		// CommonJS
  9850  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  9851  	}
  9852  	else if (typeof define === "function" && define.amd) {
  9853  		// AMD
  9854  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  9855  	}
  9856  	else {
  9857  		// Global (browser)
  9858  		factory(root.CryptoJS);
  9859  	}
  9860  }(this, function (CryptoJS) {
  9861  
  9862  	(function () {
  9863  	    // Shortcuts
  9864  	    var C = CryptoJS;
  9865  	    var C_lib = C.lib;
  9866  	    var StreamCipher = C_lib.StreamCipher;
  9867  	    var C_algo = C.algo;
  9868  
  9869  	    // Reusable objects
  9870  	    var S  = [];
  9871  	    var C_ = [];
  9872  	    var G  = [];
  9873  
  9874  	    /**
  9875  	     * Rabbit stream cipher algorithm.
  9876  	     *
  9877  	     * This is a legacy version that neglected to convert the key to little-endian.
  9878  	     * This error doesn't affect the cipher's security,
  9879  	     * but it does affect its compatibility with other implementations.
  9880  	     */
  9881  	    var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
  9882  	        _doReset: function () {
  9883  	            // Shortcuts
  9884  	            var K = this._key.words;
  9885  	            var iv = this.cfg.iv;
  9886  
  9887  	            // Generate initial state values
  9888  	            var X = this._X = [
  9889  	                K[0], (K[3] << 16) | (K[2] >>> 16),
  9890  	                K[1], (K[0] << 16) | (K[3] >>> 16),
  9891  	                K[2], (K[1] << 16) | (K[0] >>> 16),
  9892  	                K[3], (K[2] << 16) | (K[1] >>> 16)
  9893  	            ];
  9894  
  9895  	            // Generate initial counter values
  9896  	            var C = this._C = [
  9897  	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
  9898  	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
  9899  	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
  9900  	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
  9901  	            ];
  9902  
  9903  	            // Carry bit
  9904  	            this._b = 0;
  9905  
  9906  	            // Iterate the system four times
  9907  	            for (var i = 0; i < 4; i++) {
  9908  	                nextState.call(this);
  9909  	            }
  9910  
  9911  	            // Modify the counters
  9912  	            for (var i = 0; i < 8; i++) {
  9913  	                C[i] ^= X[(i + 4) & 7];
  9914  	            }
  9915  
  9916  	            // IV setup
  9917  	            if (iv) {
  9918  	                // Shortcuts
  9919  	                var IV = iv.words;
  9920  	                var IV_0 = IV[0];
  9921  	                var IV_1 = IV[1];
  9922  
  9923  	                // Generate four subvectors
  9924  	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
  9925  	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
  9926  	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
  9927  	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
  9928  
  9929  	                // Modify counter values
  9930  	                C[0] ^= i0;
  9931  	                C[1] ^= i1;
  9932  	                C[2] ^= i2;
  9933  	                C[3] ^= i3;
  9934  	                C[4] ^= i0;
  9935  	                C[5] ^= i1;
  9936  	                C[6] ^= i2;
  9937  	                C[7] ^= i3;
  9938  
  9939  	                // Iterate the system four times
  9940  	                for (var i = 0; i < 4; i++) {
  9941  	                    nextState.call(this);
  9942  	                }
  9943  	            }
  9944  	        },
  9945  
  9946  	        _doProcessBlock: function (M, offset) {
  9947  	            // Shortcut
  9948  	            var X = this._X;
  9949  
  9950  	            // Iterate the system
  9951  	            nextState.call(this);
  9952  
  9953  	            // Generate four keystream words
  9954  	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
  9955  	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
  9956  	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
  9957  	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
  9958  
  9959  	            for (var i = 0; i < 4; i++) {
  9960  	                // Swap endian
  9961  	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
  9962  	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
  9963  
  9964  	                // Encrypt
  9965  	                M[offset + i] ^= S[i];
  9966  	            }
  9967  	        },
  9968  
  9969  	        blockSize: 128/32,
  9970  
  9971  	        ivSize: 64/32
  9972  	    });
  9973  
  9974  	    function nextState() {
  9975  	        // Shortcuts
  9976  	        var X = this._X;
  9977  	        var C = this._C;
  9978  
  9979  	        // Save old counter values
  9980  	        for (var i = 0; i < 8; i++) {
  9981  	            C_[i] = C[i];
  9982  	        }
  9983  
  9984  	        // Calculate new counter values
  9985  	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
  9986  	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
  9987  	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
  9988  	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
  9989  	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
  9990  	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
  9991  	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
  9992  	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
  9993  	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
  9994  
  9995  	        // Calculate the g-values
  9996  	        for (var i = 0; i < 8; i++) {
  9997  	            var gx = X[i] + C[i];
  9998  
  9999  	            // Construct high and low argument for squaring
 10000  	            var ga = gx & 0xffff;
 10001  	            var gb = gx >>> 16;
 10002  
 10003  	            // Calculate high and low result of squaring
 10004  	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 10005  	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
 10006  
 10007  	            // High XOR low
 10008  	            G[i] = gh ^ gl;
 10009  	        }
 10010  
 10011  	        // Calculate new state values
 10012  	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
 10013  	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
 10014  	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
 10015  	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
 10016  	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
 10017  	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
 10018  	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
 10019  	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
 10020  	    }
 10021  
 10022  	    /**
 10023  	     * Shortcut functions to the cipher's object interface.
 10024  	     *
 10025  	     * @example
 10026  	     *
 10027  	     *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
 10028  	     *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
 10029  	     */
 10030  	    C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
 10031  	}());
 10032  
 10033  
 10034  	return CryptoJS.RabbitLegacy;
 10035  
 10036  }));
 10037  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],74:[function(require,module,exports){
 10038  ;(function (root, factory, undef) {
 10039  	if (typeof exports === "object") {
 10040  		// CommonJS
 10041  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 10042  	}
 10043  	else if (typeof define === "function" && define.amd) {
 10044  		// AMD
 10045  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 10046  	}
 10047  	else {
 10048  		// Global (browser)
 10049  		factory(root.CryptoJS);
 10050  	}
 10051  }(this, function (CryptoJS) {
 10052  
 10053  	(function () {
 10054  	    // Shortcuts
 10055  	    var C = CryptoJS;
 10056  	    var C_lib = C.lib;
 10057  	    var StreamCipher = C_lib.StreamCipher;
 10058  	    var C_algo = C.algo;
 10059  
 10060  	    // Reusable objects
 10061  	    var S  = [];
 10062  	    var C_ = [];
 10063  	    var G  = [];
 10064  
 10065  	    /**
 10066  	     * Rabbit stream cipher algorithm
 10067  	     */
 10068  	    var Rabbit = C_algo.Rabbit = StreamCipher.extend({
 10069  	        _doReset: function () {
 10070  	            // Shortcuts
 10071  	            var K = this._key.words;
 10072  	            var iv = this.cfg.iv;
 10073  
 10074  	            // Swap endian
 10075  	            for (var i = 0; i < 4; i++) {
 10076  	                K[i] = (((K[i] << 8)  | (K[i] >>> 24)) & 0x00ff00ff) |
 10077  	                       (((K[i] << 24) | (K[i] >>> 8))  & 0xff00ff00);
 10078  	            }
 10079  
 10080  	            // Generate initial state values
 10081  	            var X = this._X = [
 10082  	                K[0], (K[3] << 16) | (K[2] >>> 16),
 10083  	                K[1], (K[0] << 16) | (K[3] >>> 16),
 10084  	                K[2], (K[1] << 16) | (K[0] >>> 16),
 10085  	                K[3], (K[2] << 16) | (K[1] >>> 16)
 10086  	            ];
 10087  
 10088  	            // Generate initial counter values
 10089  	            var C = this._C = [
 10090  	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
 10091  	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
 10092  	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
 10093  	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
 10094  	            ];
 10095  
 10096  	            // Carry bit
 10097  	            this._b = 0;
 10098  
 10099  	            // Iterate the system four times
 10100  	            for (var i = 0; i < 4; i++) {
 10101  	                nextState.call(this);
 10102  	            }
 10103  
 10104  	            // Modify the counters
 10105  	            for (var i = 0; i < 8; i++) {
 10106  	                C[i] ^= X[(i + 4) & 7];
 10107  	            }
 10108  
 10109  	            // IV setup
 10110  	            if (iv) {
 10111  	                // Shortcuts
 10112  	                var IV = iv.words;
 10113  	                var IV_0 = IV[0];
 10114  	                var IV_1 = IV[1];
 10115  
 10116  	                // Generate four subvectors
 10117  	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
 10118  	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
 10119  	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
 10120  	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
 10121  
 10122  	                // Modify counter values
 10123  	                C[0] ^= i0;
 10124  	                C[1] ^= i1;
 10125  	                C[2] ^= i2;
 10126  	                C[3] ^= i3;
 10127  	                C[4] ^= i0;
 10128  	                C[5] ^= i1;
 10129  	                C[6] ^= i2;
 10130  	                C[7] ^= i3;
 10131  
 10132  	                // Iterate the system four times
 10133  	                for (var i = 0; i < 4; i++) {
 10134  	                    nextState.call(this);
 10135  	                }
 10136  	            }
 10137  	        },
 10138  
 10139  	        _doProcessBlock: function (M, offset) {
 10140  	            // Shortcut
 10141  	            var X = this._X;
 10142  
 10143  	            // Iterate the system
 10144  	            nextState.call(this);
 10145  
 10146  	            // Generate four keystream words
 10147  	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
 10148  	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
 10149  	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
 10150  	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
 10151  
 10152  	            for (var i = 0; i < 4; i++) {
 10153  	                // Swap endian
 10154  	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
 10155  	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
 10156  
 10157  	                // Encrypt
 10158  	                M[offset + i] ^= S[i];
 10159  	            }
 10160  	        },
 10161  
 10162  	        blockSize: 128/32,
 10163  
 10164  	        ivSize: 64/32
 10165  	    });
 10166  
 10167  	    function nextState() {
 10168  	        // Shortcuts
 10169  	        var X = this._X;
 10170  	        var C = this._C;
 10171  
 10172  	        // Save old counter values
 10173  	        for (var i = 0; i < 8; i++) {
 10174  	            C_[i] = C[i];
 10175  	        }
 10176  
 10177  	        // Calculate new counter values
 10178  	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
 10179  	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
 10180  	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
 10181  	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
 10182  	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
 10183  	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
 10184  	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
 10185  	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
 10186  	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
 10187  
 10188  	        // Calculate the g-values
 10189  	        for (var i = 0; i < 8; i++) {
 10190  	            var gx = X[i] + C[i];
 10191  
 10192  	            // Construct high and low argument for squaring
 10193  	            var ga = gx & 0xffff;
 10194  	            var gb = gx >>> 16;
 10195  
 10196  	            // Calculate high and low result of squaring
 10197  	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 10198  	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
 10199  
 10200  	            // High XOR low
 10201  	            G[i] = gh ^ gl;
 10202  	        }
 10203  
 10204  	        // Calculate new state values
 10205  	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
 10206  	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
 10207  	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
 10208  	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
 10209  	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
 10210  	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
 10211  	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
 10212  	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
 10213  	    }
 10214  
 10215  	    /**
 10216  	     * Shortcut functions to the cipher's object interface.
 10217  	     *
 10218  	     * @example
 10219  	     *
 10220  	     *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
 10221  	     *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
 10222  	     */
 10223  	    C.Rabbit = StreamCipher._createHelper(Rabbit);
 10224  	}());
 10225  
 10226  
 10227  	return CryptoJS.Rabbit;
 10228  
 10229  }));
 10230  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],75:[function(require,module,exports){
 10231  ;(function (root, factory, undef) {
 10232  	if (typeof exports === "object") {
 10233  		// CommonJS
 10234  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 10235  	}
 10236  	else if (typeof define === "function" && define.amd) {
 10237  		// AMD
 10238  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 10239  	}
 10240  	else {
 10241  		// Global (browser)
 10242  		factory(root.CryptoJS);
 10243  	}
 10244  }(this, function (CryptoJS) {
 10245  
 10246  	(function () {
 10247  	    // Shortcuts
 10248  	    var C = CryptoJS;
 10249  	    var C_lib = C.lib;
 10250  	    var StreamCipher = C_lib.StreamCipher;
 10251  	    var C_algo = C.algo;
 10252  
 10253  	    /**
 10254  	     * RC4 stream cipher algorithm.
 10255  	     */
 10256  	    var RC4 = C_algo.RC4 = StreamCipher.extend({
 10257  	        _doReset: function () {
 10258  	            // Shortcuts
 10259  	            var key = this._key;
 10260  	            var keyWords = key.words;
 10261  	            var keySigBytes = key.sigBytes;
 10262  
 10263  	            // Init sbox
 10264  	            var S = this._S = [];
 10265  	            for (var i = 0; i < 256; i++) {
 10266  	                S[i] = i;
 10267  	            }
 10268  
 10269  	            // Key setup
 10270  	            for (var i = 0, j = 0; i < 256; i++) {
 10271  	                var keyByteIndex = i % keySigBytes;
 10272  	                var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
 10273  
 10274  	                j = (j + S[i] + keyByte) % 256;
 10275  
 10276  	                // Swap
 10277  	                var t = S[i];
 10278  	                S[i] = S[j];
 10279  	                S[j] = t;
 10280  	            }
 10281  
 10282  	            // Counters
 10283  	            this._i = this._j = 0;
 10284  	        },
 10285  
 10286  	        _doProcessBlock: function (M, offset) {
 10287  	            M[offset] ^= generateKeystreamWord.call(this);
 10288  	        },
 10289  
 10290  	        keySize: 256/32,
 10291  
 10292  	        ivSize: 0
 10293  	    });
 10294  
 10295  	    function generateKeystreamWord() {
 10296  	        // Shortcuts
 10297  	        var S = this._S;
 10298  	        var i = this._i;
 10299  	        var j = this._j;
 10300  
 10301  	        // Generate keystream word
 10302  	        var keystreamWord = 0;
 10303  	        for (var n = 0; n < 4; n++) {
 10304  	            i = (i + 1) % 256;
 10305  	            j = (j + S[i]) % 256;
 10306  
 10307  	            // Swap
 10308  	            var t = S[i];
 10309  	            S[i] = S[j];
 10310  	            S[j] = t;
 10311  
 10312  	            keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
 10313  	        }
 10314  
 10315  	        // Update counters
 10316  	        this._i = i;
 10317  	        this._j = j;
 10318  
 10319  	        return keystreamWord;
 10320  	    }
 10321  
 10322  	    /**
 10323  	     * Shortcut functions to the cipher's object interface.
 10324  	     *
 10325  	     * @example
 10326  	     *
 10327  	     *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
 10328  	     *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
 10329  	     */
 10330  	    C.RC4 = StreamCipher._createHelper(RC4);
 10331  
 10332  	    /**
 10333  	     * Modified RC4 stream cipher algorithm.
 10334  	     */
 10335  	    var RC4Drop = C_algo.RC4Drop = RC4.extend({
 10336  	        /**
 10337  	         * Configuration options.
 10338  	         *
 10339  	         * @property {number} drop The number of keystream words to drop. Default 192
 10340  	         */
 10341  	        cfg: RC4.cfg.extend({
 10342  	            drop: 192
 10343  	        }),
 10344  
 10345  	        _doReset: function () {
 10346  	            RC4._doReset.call(this);
 10347  
 10348  	            // Drop
 10349  	            for (var i = this.cfg.drop; i > 0; i--) {
 10350  	                generateKeystreamWord.call(this);
 10351  	            }
 10352  	        }
 10353  	    });
 10354  
 10355  	    /**
 10356  	     * Shortcut functions to the cipher's object interface.
 10357  	     *
 10358  	     * @example
 10359  	     *
 10360  	     *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
 10361  	     *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
 10362  	     */
 10363  	    C.RC4Drop = StreamCipher._createHelper(RC4Drop);
 10364  	}());
 10365  
 10366  
 10367  	return CryptoJS.RC4;
 10368  
 10369  }));
 10370  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],76:[function(require,module,exports){
 10371  ;(function (root, factory) {
 10372  	if (typeof exports === "object") {
 10373  		// CommonJS
 10374  		module.exports = exports = factory(require("./core"));
 10375  	}
 10376  	else if (typeof define === "function" && define.amd) {
 10377  		// AMD
 10378  		define(["./core"], factory);
 10379  	}
 10380  	else {
 10381  		// Global (browser)
 10382  		factory(root.CryptoJS);
 10383  	}
 10384  }(this, function (CryptoJS) {
 10385  
 10386  	/** @preserve
 10387  	(c) 2012 by Cédric Mesnil. All rights reserved.
 10388  
 10389  	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 10390  
 10391  	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 10392  	    - 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.
 10393  
 10394  	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.
 10395  	*/
 10396  
 10397  	(function (Math) {
 10398  	    // Shortcuts
 10399  	    var C = CryptoJS;
 10400  	    var C_lib = C.lib;
 10401  	    var WordArray = C_lib.WordArray;
 10402  	    var Hasher = C_lib.Hasher;
 10403  	    var C_algo = C.algo;
 10404  
 10405  	    // Constants table
 10406  	    var _zl = WordArray.create([
 10407  	        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
 10408  	        7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
 10409  	        3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
 10410  	        1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
 10411  	        4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13]);
 10412  	    var _zr = WordArray.create([
 10413  	        5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
 10414  	        6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
 10415  	        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
 10416  	        8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
 10417  	        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11]);
 10418  	    var _sl = WordArray.create([
 10419  	         11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
 10420  	        7, 6,   8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
 10421  	        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
 10422  	          11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
 10423  	        9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 ]);
 10424  	    var _sr = WordArray.create([
 10425  	        8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
 10426  	        9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
 10427  	        9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
 10428  	        15,  5,  8, 11, 14, 14,  6, 14,  6,  9, 12,  9, 12,  5, 15,  8,
 10429  	        8,  5, 12,  9, 12,  5, 14,  6,  8, 13,  6,  5, 15, 13, 11, 11 ]);
 10430  
 10431  	    var _hl =  WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
 10432  	    var _hr =  WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
 10433  
 10434  	    /**
 10435  	     * RIPEMD160 hash algorithm.
 10436  	     */
 10437  	    var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
 10438  	        _doReset: function () {
 10439  	            this._hash  = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
 10440  	        },
 10441  
 10442  	        _doProcessBlock: function (M, offset) {
 10443  
 10444  	            // Swap endian
 10445  	            for (var i = 0; i < 16; i++) {
 10446  	                // Shortcuts
 10447  	                var offset_i = offset + i;
 10448  	                var M_offset_i = M[offset_i];
 10449  
 10450  	                // Swap
 10451  	                M[offset_i] = (
 10452  	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
 10453  	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
 10454  	                );
 10455  	            }
 10456  	            // Shortcut
 10457  	            var H  = this._hash.words;
 10458  	            var hl = _hl.words;
 10459  	            var hr = _hr.words;
 10460  	            var zl = _zl.words;
 10461  	            var zr = _zr.words;
 10462  	            var sl = _sl.words;
 10463  	            var sr = _sr.words;
 10464  
 10465  	            // Working variables
 10466  	            var al, bl, cl, dl, el;
 10467  	            var ar, br, cr, dr, er;
 10468  
 10469  	            ar = al = H[0];
 10470  	            br = bl = H[1];
 10471  	            cr = cl = H[2];
 10472  	            dr = dl = H[3];
 10473  	            er = el = H[4];
 10474  	            // Computation
 10475  	            var t;
 10476  	            for (var i = 0; i < 80; i += 1) {
 10477  	                t = (al +  M[offset+zl[i]])|0;
 10478  	                if (i<16){
 10479  		            t +=  f1(bl,cl,dl) + hl[0];
 10480  	                } else if (i<32) {
 10481  		            t +=  f2(bl,cl,dl) + hl[1];
 10482  	                } else if (i<48) {
 10483  		            t +=  f3(bl,cl,dl) + hl[2];
 10484  	                } else if (i<64) {
 10485  		            t +=  f4(bl,cl,dl) + hl[3];
 10486  	                } else {// if (i<80) {
 10487  		            t +=  f5(bl,cl,dl) + hl[4];
 10488  	                }
 10489  	                t = t|0;
 10490  	                t =  rotl(t,sl[i]);
 10491  	                t = (t+el)|0;
 10492  	                al = el;
 10493  	                el = dl;
 10494  	                dl = rotl(cl, 10);
 10495  	                cl = bl;
 10496  	                bl = t;
 10497  
 10498  	                t = (ar + M[offset+zr[i]])|0;
 10499  	                if (i<16){
 10500  		            t +=  f5(br,cr,dr) + hr[0];
 10501  	                } else if (i<32) {
 10502  		            t +=  f4(br,cr,dr) + hr[1];
 10503  	                } else if (i<48) {
 10504  		            t +=  f3(br,cr,dr) + hr[2];
 10505  	                } else if (i<64) {
 10506  		            t +=  f2(br,cr,dr) + hr[3];
 10507  	                } else {// if (i<80) {
 10508  		            t +=  f1(br,cr,dr) + hr[4];
 10509  	                }
 10510  	                t = t|0;
 10511  	                t =  rotl(t,sr[i]) ;
 10512  	                t = (t+er)|0;
 10513  	                ar = er;
 10514  	                er = dr;
 10515  	                dr = rotl(cr, 10);
 10516  	                cr = br;
 10517  	                br = t;
 10518  	            }
 10519  	            // Intermediate hash value
 10520  	            t    = (H[1] + cl + dr)|0;
 10521  	            H[1] = (H[2] + dl + er)|0;
 10522  	            H[2] = (H[3] + el + ar)|0;
 10523  	            H[3] = (H[4] + al + br)|0;
 10524  	            H[4] = (H[0] + bl + cr)|0;
 10525  	            H[0] =  t;
 10526  	        },
 10527  
 10528  	        _doFinalize: function () {
 10529  	            // Shortcuts
 10530  	            var data = this._data;
 10531  	            var dataWords = data.words;
 10532  
 10533  	            var nBitsTotal = this._nDataBytes * 8;
 10534  	            var nBitsLeft = data.sigBytes * 8;
 10535  
 10536  	            // Add padding
 10537  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 10538  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
 10539  	                (((nBitsTotal << 8)  | (nBitsTotal >>> 24)) & 0x00ff00ff) |
 10540  	                (((nBitsTotal << 24) | (nBitsTotal >>> 8))  & 0xff00ff00)
 10541  	            );
 10542  	            data.sigBytes = (dataWords.length + 1) * 4;
 10543  
 10544  	            // Hash final blocks
 10545  	            this._process();
 10546  
 10547  	            // Shortcuts
 10548  	            var hash = this._hash;
 10549  	            var H = hash.words;
 10550  
 10551  	            // Swap endian
 10552  	            for (var i = 0; i < 5; i++) {
 10553  	                // Shortcut
 10554  	                var H_i = H[i];
 10555  
 10556  	                // Swap
 10557  	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
 10558  	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
 10559  	            }
 10560  
 10561  	            // Return final computed hash
 10562  	            return hash;
 10563  	        },
 10564  
 10565  	        clone: function () {
 10566  	            var clone = Hasher.clone.call(this);
 10567  	            clone._hash = this._hash.clone();
 10568  
 10569  	            return clone;
 10570  	        }
 10571  	    });
 10572  
 10573  
 10574  	    function f1(x, y, z) {
 10575  	        return ((x) ^ (y) ^ (z));
 10576  
 10577  	    }
 10578  
 10579  	    function f2(x, y, z) {
 10580  	        return (((x)&(y)) | ((~x)&(z)));
 10581  	    }
 10582  
 10583  	    function f3(x, y, z) {
 10584  	        return (((x) | (~(y))) ^ (z));
 10585  	    }
 10586  
 10587  	    function f4(x, y, z) {
 10588  	        return (((x) & (z)) | ((y)&(~(z))));
 10589  	    }
 10590  
 10591  	    function f5(x, y, z) {
 10592  	        return ((x) ^ ((y) |(~(z))));
 10593  
 10594  	    }
 10595  
 10596  	    function rotl(x,n) {
 10597  	        return (x<<n) | (x>>>(32-n));
 10598  	    }
 10599  
 10600  
 10601  	    /**
 10602  	     * Shortcut function to the hasher's object interface.
 10603  	     *
 10604  	     * @param {WordArray|string} message The message to hash.
 10605  	     *
 10606  	     * @return {WordArray} The hash.
 10607  	     *
 10608  	     * @static
 10609  	     *
 10610  	     * @example
 10611  	     *
 10612  	     *     var hash = CryptoJS.RIPEMD160('message');
 10613  	     *     var hash = CryptoJS.RIPEMD160(wordArray);
 10614  	     */
 10615  	    C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
 10616  
 10617  	    /**
 10618  	     * Shortcut function to the HMAC's object interface.
 10619  	     *
 10620  	     * @param {WordArray|string} message The message to hash.
 10621  	     * @param {WordArray|string} key The secret key.
 10622  	     *
 10623  	     * @return {WordArray} The HMAC.
 10624  	     *
 10625  	     * @static
 10626  	     *
 10627  	     * @example
 10628  	     *
 10629  	     *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
 10630  	     */
 10631  	    C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
 10632  	}(Math));
 10633  
 10634  
 10635  	return CryptoJS.RIPEMD160;
 10636  
 10637  }));
 10638  },{"./core":53}],77:[function(require,module,exports){
 10639  ;(function (root, factory) {
 10640  	if (typeof exports === "object") {
 10641  		// CommonJS
 10642  		module.exports = exports = factory(require("./core"));
 10643  	}
 10644  	else if (typeof define === "function" && define.amd) {
 10645  		// AMD
 10646  		define(["./core"], factory);
 10647  	}
 10648  	else {
 10649  		// Global (browser)
 10650  		factory(root.CryptoJS);
 10651  	}
 10652  }(this, function (CryptoJS) {
 10653  
 10654  	(function () {
 10655  	    // Shortcuts
 10656  	    var C = CryptoJS;
 10657  	    var C_lib = C.lib;
 10658  	    var WordArray = C_lib.WordArray;
 10659  	    var Hasher = C_lib.Hasher;
 10660  	    var C_algo = C.algo;
 10661  
 10662  	    // Reusable object
 10663  	    var W = [];
 10664  
 10665  	    /**
 10666  	     * SHA-1 hash algorithm.
 10667  	     */
 10668  	    var SHA1 = C_algo.SHA1 = Hasher.extend({
 10669  	        _doReset: function () {
 10670  	            this._hash = new WordArray.init([
 10671  	                0x67452301, 0xefcdab89,
 10672  	                0x98badcfe, 0x10325476,
 10673  	                0xc3d2e1f0
 10674  	            ]);
 10675  	        },
 10676  
 10677  	        _doProcessBlock: function (M, offset) {
 10678  	            // Shortcut
 10679  	            var H = this._hash.words;
 10680  
 10681  	            // Working variables
 10682  	            var a = H[0];
 10683  	            var b = H[1];
 10684  	            var c = H[2];
 10685  	            var d = H[3];
 10686  	            var e = H[4];
 10687  
 10688  	            // Computation
 10689  	            for (var i = 0; i < 80; i++) {
 10690  	                if (i < 16) {
 10691  	                    W[i] = M[offset + i] | 0;
 10692  	                } else {
 10693  	                    var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
 10694  	                    W[i] = (n << 1) | (n >>> 31);
 10695  	                }
 10696  
 10697  	                var t = ((a << 5) | (a >>> 27)) + e + W[i];
 10698  	                if (i < 20) {
 10699  	                    t += ((b & c) | (~b & d)) + 0x5a827999;
 10700  	                } else if (i < 40) {
 10701  	                    t += (b ^ c ^ d) + 0x6ed9eba1;
 10702  	                } else if (i < 60) {
 10703  	                    t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
 10704  	                } else /* if (i < 80) */ {
 10705  	                    t += (b ^ c ^ d) - 0x359d3e2a;
 10706  	                }
 10707  
 10708  	                e = d;
 10709  	                d = c;
 10710  	                c = (b << 30) | (b >>> 2);
 10711  	                b = a;
 10712  	                a = t;
 10713  	            }
 10714  
 10715  	            // Intermediate hash value
 10716  	            H[0] = (H[0] + a) | 0;
 10717  	            H[1] = (H[1] + b) | 0;
 10718  	            H[2] = (H[2] + c) | 0;
 10719  	            H[3] = (H[3] + d) | 0;
 10720  	            H[4] = (H[4] + e) | 0;
 10721  	        },
 10722  
 10723  	        _doFinalize: function () {
 10724  	            // Shortcuts
 10725  	            var data = this._data;
 10726  	            var dataWords = data.words;
 10727  
 10728  	            var nBitsTotal = this._nDataBytes * 8;
 10729  	            var nBitsLeft = data.sigBytes * 8;
 10730  
 10731  	            // Add padding
 10732  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 10733  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
 10734  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 10735  	            data.sigBytes = dataWords.length * 4;
 10736  
 10737  	            // Hash final blocks
 10738  	            this._process();
 10739  
 10740  	            // Return final computed hash
 10741  	            return this._hash;
 10742  	        },
 10743  
 10744  	        clone: function () {
 10745  	            var clone = Hasher.clone.call(this);
 10746  	            clone._hash = this._hash.clone();
 10747  
 10748  	            return clone;
 10749  	        }
 10750  	    });
 10751  
 10752  	    /**
 10753  	     * Shortcut function to the hasher's object interface.
 10754  	     *
 10755  	     * @param {WordArray|string} message The message to hash.
 10756  	     *
 10757  	     * @return {WordArray} The hash.
 10758  	     *
 10759  	     * @static
 10760  	     *
 10761  	     * @example
 10762  	     *
 10763  	     *     var hash = CryptoJS.SHA1('message');
 10764  	     *     var hash = CryptoJS.SHA1(wordArray);
 10765  	     */
 10766  	    C.SHA1 = Hasher._createHelper(SHA1);
 10767  
 10768  	    /**
 10769  	     * Shortcut function to the HMAC's object interface.
 10770  	     *
 10771  	     * @param {WordArray|string} message The message to hash.
 10772  	     * @param {WordArray|string} key The secret key.
 10773  	     *
 10774  	     * @return {WordArray} The HMAC.
 10775  	     *
 10776  	     * @static
 10777  	     *
 10778  	     * @example
 10779  	     *
 10780  	     *     var hmac = CryptoJS.HmacSHA1(message, key);
 10781  	     */
 10782  	    C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
 10783  	}());
 10784  
 10785  
 10786  	return CryptoJS.SHA1;
 10787  
 10788  }));
 10789  },{"./core":53}],78:[function(require,module,exports){
 10790  ;(function (root, factory, undef) {
 10791  	if (typeof exports === "object") {
 10792  		// CommonJS
 10793  		module.exports = exports = factory(require("./core"), require("./sha256"));
 10794  	}
 10795  	else if (typeof define === "function" && define.amd) {
 10796  		// AMD
 10797  		define(["./core", "./sha256"], factory);
 10798  	}
 10799  	else {
 10800  		// Global (browser)
 10801  		factory(root.CryptoJS);
 10802  	}
 10803  }(this, function (CryptoJS) {
 10804  
 10805  	(function () {
 10806  	    // Shortcuts
 10807  	    var C = CryptoJS;
 10808  	    var C_lib = C.lib;
 10809  	    var WordArray = C_lib.WordArray;
 10810  	    var C_algo = C.algo;
 10811  	    var SHA256 = C_algo.SHA256;
 10812  
 10813  	    /**
 10814  	     * SHA-224 hash algorithm.
 10815  	     */
 10816  	    var SHA224 = C_algo.SHA224 = SHA256.extend({
 10817  	        _doReset: function () {
 10818  	            this._hash = new WordArray.init([
 10819  	                0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
 10820  	                0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
 10821  	            ]);
 10822  	        },
 10823  
 10824  	        _doFinalize: function () {
 10825  	            var hash = SHA256._doFinalize.call(this);
 10826  
 10827  	            hash.sigBytes -= 4;
 10828  
 10829  	            return hash;
 10830  	        }
 10831  	    });
 10832  
 10833  	    /**
 10834  	     * Shortcut function to the hasher's object interface.
 10835  	     *
 10836  	     * @param {WordArray|string} message The message to hash.
 10837  	     *
 10838  	     * @return {WordArray} The hash.
 10839  	     *
 10840  	     * @static
 10841  	     *
 10842  	     * @example
 10843  	     *
 10844  	     *     var hash = CryptoJS.SHA224('message');
 10845  	     *     var hash = CryptoJS.SHA224(wordArray);
 10846  	     */
 10847  	    C.SHA224 = SHA256._createHelper(SHA224);
 10848  
 10849  	    /**
 10850  	     * Shortcut function to the HMAC's object interface.
 10851  	     *
 10852  	     * @param {WordArray|string} message The message to hash.
 10853  	     * @param {WordArray|string} key The secret key.
 10854  	     *
 10855  	     * @return {WordArray} The HMAC.
 10856  	     *
 10857  	     * @static
 10858  	     *
 10859  	     * @example
 10860  	     *
 10861  	     *     var hmac = CryptoJS.HmacSHA224(message, key);
 10862  	     */
 10863  	    C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
 10864  	}());
 10865  
 10866  
 10867  	return CryptoJS.SHA224;
 10868  
 10869  }));
 10870  },{"./core":53,"./sha256":79}],79:[function(require,module,exports){
 10871  ;(function (root, factory) {
 10872  	if (typeof exports === "object") {
 10873  		// CommonJS
 10874  		module.exports = exports = factory(require("./core"));
 10875  	}
 10876  	else if (typeof define === "function" && define.amd) {
 10877  		// AMD
 10878  		define(["./core"], factory);
 10879  	}
 10880  	else {
 10881  		// Global (browser)
 10882  		factory(root.CryptoJS);
 10883  	}
 10884  }(this, function (CryptoJS) {
 10885  
 10886  	(function (Math) {
 10887  	    // Shortcuts
 10888  	    var C = CryptoJS;
 10889  	    var C_lib = C.lib;
 10890  	    var WordArray = C_lib.WordArray;
 10891  	    var Hasher = C_lib.Hasher;
 10892  	    var C_algo = C.algo;
 10893  
 10894  	    // Initialization and round constants tables
 10895  	    var H = [];
 10896  	    var K = [];
 10897  
 10898  	    // Compute constants
 10899  	    (function () {
 10900  	        function isPrime(n) {
 10901  	            var sqrtN = Math.sqrt(n);
 10902  	            for (var factor = 2; factor <= sqrtN; factor++) {
 10903  	                if (!(n % factor)) {
 10904  	                    return false;
 10905  	                }
 10906  	            }
 10907  
 10908  	            return true;
 10909  	        }
 10910  
 10911  	        function getFractionalBits(n) {
 10912  	            return ((n - (n | 0)) * 0x100000000) | 0;
 10913  	        }
 10914  
 10915  	        var n = 2;
 10916  	        var nPrime = 0;
 10917  	        while (nPrime < 64) {
 10918  	            if (isPrime(n)) {
 10919  	                if (nPrime < 8) {
 10920  	                    H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
 10921  	                }
 10922  	                K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
 10923  
 10924  	                nPrime++;
 10925  	            }
 10926  
 10927  	            n++;
 10928  	        }
 10929  	    }());
 10930  
 10931  	    // Reusable object
 10932  	    var W = [];
 10933  
 10934  	    /**
 10935  	     * SHA-256 hash algorithm.
 10936  	     */
 10937  	    var SHA256 = C_algo.SHA256 = Hasher.extend({
 10938  	        _doReset: function () {
 10939  	            this._hash = new WordArray.init(H.slice(0));
 10940  	        },
 10941  
 10942  	        _doProcessBlock: function (M, offset) {
 10943  	            // Shortcut
 10944  	            var H = this._hash.words;
 10945  
 10946  	            // Working variables
 10947  	            var a = H[0];
 10948  	            var b = H[1];
 10949  	            var c = H[2];
 10950  	            var d = H[3];
 10951  	            var e = H[4];
 10952  	            var f = H[5];
 10953  	            var g = H[6];
 10954  	            var h = H[7];
 10955  
 10956  	            // Computation
 10957  	            for (var i = 0; i < 64; i++) {
 10958  	                if (i < 16) {
 10959  	                    W[i] = M[offset + i] | 0;
 10960  	                } else {
 10961  	                    var gamma0x = W[i - 15];
 10962  	                    var gamma0  = ((gamma0x << 25) | (gamma0x >>> 7))  ^
 10963  	                                  ((gamma0x << 14) | (gamma0x >>> 18)) ^
 10964  	                                   (gamma0x >>> 3);
 10965  
 10966  	                    var gamma1x = W[i - 2];
 10967  	                    var gamma1  = ((gamma1x << 15) | (gamma1x >>> 17)) ^
 10968  	                                  ((gamma1x << 13) | (gamma1x >>> 19)) ^
 10969  	                                   (gamma1x >>> 10);
 10970  
 10971  	                    W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
 10972  	                }
 10973  
 10974  	                var ch  = (e & f) ^ (~e & g);
 10975  	                var maj = (a & b) ^ (a & c) ^ (b & c);
 10976  
 10977  	                var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
 10978  	                var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7)  | (e >>> 25));
 10979  
 10980  	                var t1 = h + sigma1 + ch + K[i] + W[i];
 10981  	                var t2 = sigma0 + maj;
 10982  
 10983  	                h = g;
 10984  	                g = f;
 10985  	                f = e;
 10986  	                e = (d + t1) | 0;
 10987  	                d = c;
 10988  	                c = b;
 10989  	                b = a;
 10990  	                a = (t1 + t2) | 0;
 10991  	            }
 10992  
 10993  	            // Intermediate hash value
 10994  	            H[0] = (H[0] + a) | 0;
 10995  	            H[1] = (H[1] + b) | 0;
 10996  	            H[2] = (H[2] + c) | 0;
 10997  	            H[3] = (H[3] + d) | 0;
 10998  	            H[4] = (H[4] + e) | 0;
 10999  	            H[5] = (H[5] + f) | 0;
 11000  	            H[6] = (H[6] + g) | 0;
 11001  	            H[7] = (H[7] + h) | 0;
 11002  	        },
 11003  
 11004  	        _doFinalize: function () {
 11005  	            // Shortcuts
 11006  	            var data = this._data;
 11007  	            var dataWords = data.words;
 11008  
 11009  	            var nBitsTotal = this._nDataBytes * 8;
 11010  	            var nBitsLeft = data.sigBytes * 8;
 11011  
 11012  	            // Add padding
 11013  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 11014  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
 11015  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 11016  	            data.sigBytes = dataWords.length * 4;
 11017  
 11018  	            // Hash final blocks
 11019  	            this._process();
 11020  
 11021  	            // Return final computed hash
 11022  	            return this._hash;
 11023  	        },
 11024  
 11025  	        clone: function () {
 11026  	            var clone = Hasher.clone.call(this);
 11027  	            clone._hash = this._hash.clone();
 11028  
 11029  	            return clone;
 11030  	        }
 11031  	    });
 11032  
 11033  	    /**
 11034  	     * Shortcut function to the hasher's object interface.
 11035  	     *
 11036  	     * @param {WordArray|string} message The message to hash.
 11037  	     *
 11038  	     * @return {WordArray} The hash.
 11039  	     *
 11040  	     * @static
 11041  	     *
 11042  	     * @example
 11043  	     *
 11044  	     *     var hash = CryptoJS.SHA256('message');
 11045  	     *     var hash = CryptoJS.SHA256(wordArray);
 11046  	     */
 11047  	    C.SHA256 = Hasher._createHelper(SHA256);
 11048  
 11049  	    /**
 11050  	     * Shortcut function to the HMAC's object interface.
 11051  	     *
 11052  	     * @param {WordArray|string} message The message to hash.
 11053  	     * @param {WordArray|string} key The secret key.
 11054  	     *
 11055  	     * @return {WordArray} The HMAC.
 11056  	     *
 11057  	     * @static
 11058  	     *
 11059  	     * @example
 11060  	     *
 11061  	     *     var hmac = CryptoJS.HmacSHA256(message, key);
 11062  	     */
 11063  	    C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
 11064  	}(Math));
 11065  
 11066  
 11067  	return CryptoJS.SHA256;
 11068  
 11069  }));
 11070  },{"./core":53}],80:[function(require,module,exports){
 11071  ;(function (root, factory, undef) {
 11072  	if (typeof exports === "object") {
 11073  		// CommonJS
 11074  		module.exports = exports = factory(require("./core"), require("./x64-core"));
 11075  	}
 11076  	else if (typeof define === "function" && define.amd) {
 11077  		// AMD
 11078  		define(["./core", "./x64-core"], factory);
 11079  	}
 11080  	else {
 11081  		// Global (browser)
 11082  		factory(root.CryptoJS);
 11083  	}
 11084  }(this, function (CryptoJS) {
 11085  
 11086  	(function (Math) {
 11087  	    // Shortcuts
 11088  	    var C = CryptoJS;
 11089  	    var C_lib = C.lib;
 11090  	    var WordArray = C_lib.WordArray;
 11091  	    var Hasher = C_lib.Hasher;
 11092  	    var C_x64 = C.x64;
 11093  	    var X64Word = C_x64.Word;
 11094  	    var C_algo = C.algo;
 11095  
 11096  	    // Constants tables
 11097  	    var RHO_OFFSETS = [];
 11098  	    var PI_INDEXES  = [];
 11099  	    var ROUND_CONSTANTS = [];
 11100  
 11101  	    // Compute Constants
 11102  	    (function () {
 11103  	        // Compute rho offset constants
 11104  	        var x = 1, y = 0;
 11105  	        for (var t = 0; t < 24; t++) {
 11106  	            RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
 11107  
 11108  	            var newX = y % 5;
 11109  	            var newY = (2 * x + 3 * y) % 5;
 11110  	            x = newX;
 11111  	            y = newY;
 11112  	        }
 11113  
 11114  	        // Compute pi index constants
 11115  	        for (var x = 0; x < 5; x++) {
 11116  	            for (var y = 0; y < 5; y++) {
 11117  	                PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
 11118  	            }
 11119  	        }
 11120  
 11121  	        // Compute round constants
 11122  	        var LFSR = 0x01;
 11123  	        for (var i = 0; i < 24; i++) {
 11124  	            var roundConstantMsw = 0;
 11125  	            var roundConstantLsw = 0;
 11126  
 11127  	            for (var j = 0; j < 7; j++) {
 11128  	                if (LFSR & 0x01) {
 11129  	                    var bitPosition = (1 << j) - 1;
 11130  	                    if (bitPosition < 32) {
 11131  	                        roundConstantLsw ^= 1 << bitPosition;
 11132  	                    } else /* if (bitPosition >= 32) */ {
 11133  	                        roundConstantMsw ^= 1 << (bitPosition - 32);
 11134  	                    }
 11135  	                }
 11136  
 11137  	                // Compute next LFSR
 11138  	                if (LFSR & 0x80) {
 11139  	                    // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
 11140  	                    LFSR = (LFSR << 1) ^ 0x71;
 11141  	                } else {
 11142  	                    LFSR <<= 1;
 11143  	                }
 11144  	            }
 11145  
 11146  	            ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
 11147  	        }
 11148  	    }());
 11149  
 11150  	    // Reusable objects for temporary values
 11151  	    var T = [];
 11152  	    (function () {
 11153  	        for (var i = 0; i < 25; i++) {
 11154  	            T[i] = X64Word.create();
 11155  	        }
 11156  	    }());
 11157  
 11158  	    /**
 11159  	     * SHA-3 hash algorithm.
 11160  	     */
 11161  	    var SHA3 = C_algo.SHA3 = Hasher.extend({
 11162  	        /**
 11163  	         * Configuration options.
 11164  	         *
 11165  	         * @property {number} outputLength
 11166  	         *   The desired number of bits in the output hash.
 11167  	         *   Only values permitted are: 224, 256, 384, 512.
 11168  	         *   Default: 512
 11169  	         */
 11170  	        cfg: Hasher.cfg.extend({
 11171  	            outputLength: 512
 11172  	        }),
 11173  
 11174  	        _doReset: function () {
 11175  	            var state = this._state = []
 11176  	            for (var i = 0; i < 25; i++) {
 11177  	                state[i] = new X64Word.init();
 11178  	            }
 11179  
 11180  	            this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
 11181  	        },
 11182  
 11183  	        _doProcessBlock: function (M, offset) {
 11184  	            // Shortcuts
 11185  	            var state = this._state;
 11186  	            var nBlockSizeLanes = this.blockSize / 2;
 11187  
 11188  	            // Absorb
 11189  	            for (var i = 0; i < nBlockSizeLanes; i++) {
 11190  	                // Shortcuts
 11191  	                var M2i  = M[offset + 2 * i];
 11192  	                var M2i1 = M[offset + 2 * i + 1];
 11193  
 11194  	                // Swap endian
 11195  	                M2i = (
 11196  	                    (((M2i << 8)  | (M2i >>> 24)) & 0x00ff00ff) |
 11197  	                    (((M2i << 24) | (M2i >>> 8))  & 0xff00ff00)
 11198  	                );
 11199  	                M2i1 = (
 11200  	                    (((M2i1 << 8)  | (M2i1 >>> 24)) & 0x00ff00ff) |
 11201  	                    (((M2i1 << 24) | (M2i1 >>> 8))  & 0xff00ff00)
 11202  	                );
 11203  
 11204  	                // Absorb message into state
 11205  	                var lane = state[i];
 11206  	                lane.high ^= M2i1;
 11207  	                lane.low  ^= M2i;
 11208  	            }
 11209  
 11210  	            // Rounds
 11211  	            for (var round = 0; round < 24; round++) {
 11212  	                // Theta
 11213  	                for (var x = 0; x < 5; x++) {
 11214  	                    // Mix column lanes
 11215  	                    var tMsw = 0, tLsw = 0;
 11216  	                    for (var y = 0; y < 5; y++) {
 11217  	                        var lane = state[x + 5 * y];
 11218  	                        tMsw ^= lane.high;
 11219  	                        tLsw ^= lane.low;
 11220  	                    }
 11221  
 11222  	                    // Temporary values
 11223  	                    var Tx = T[x];
 11224  	                    Tx.high = tMsw;
 11225  	                    Tx.low  = tLsw;
 11226  	                }
 11227  	                for (var x = 0; x < 5; x++) {
 11228  	                    // Shortcuts
 11229  	                    var Tx4 = T[(x + 4) % 5];
 11230  	                    var Tx1 = T[(x + 1) % 5];
 11231  	                    var Tx1Msw = Tx1.high;
 11232  	                    var Tx1Lsw = Tx1.low;
 11233  
 11234  	                    // Mix surrounding columns
 11235  	                    var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
 11236  	                    var tLsw = Tx4.low  ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
 11237  	                    for (var y = 0; y < 5; y++) {
 11238  	                        var lane = state[x + 5 * y];
 11239  	                        lane.high ^= tMsw;
 11240  	                        lane.low  ^= tLsw;
 11241  	                    }
 11242  	                }
 11243  
 11244  	                // Rho Pi
 11245  	                for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
 11246  	                    // Shortcuts
 11247  	                    var lane = state[laneIndex];
 11248  	                    var laneMsw = lane.high;
 11249  	                    var laneLsw = lane.low;
 11250  	                    var rhoOffset = RHO_OFFSETS[laneIndex];
 11251  
 11252  	                    // Rotate lanes
 11253  	                    if (rhoOffset < 32) {
 11254  	                        var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
 11255  	                        var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
 11256  	                    } else /* if (rhoOffset >= 32) */ {
 11257  	                        var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
 11258  	                        var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
 11259  	                    }
 11260  
 11261  	                    // Transpose lanes
 11262  	                    var TPiLane = T[PI_INDEXES[laneIndex]];
 11263  	                    TPiLane.high = tMsw;
 11264  	                    TPiLane.low  = tLsw;
 11265  	                }
 11266  
 11267  	                // Rho pi at x = y = 0
 11268  	                var T0 = T[0];
 11269  	                var state0 = state[0];
 11270  	                T0.high = state0.high;
 11271  	                T0.low  = state0.low;
 11272  
 11273  	                // Chi
 11274  	                for (var x = 0; x < 5; x++) {
 11275  	                    for (var y = 0; y < 5; y++) {
 11276  	                        // Shortcuts
 11277  	                        var laneIndex = x + 5 * y;
 11278  	                        var lane = state[laneIndex];
 11279  	                        var TLane = T[laneIndex];
 11280  	                        var Tx1Lane = T[((x + 1) % 5) + 5 * y];
 11281  	                        var Tx2Lane = T[((x + 2) % 5) + 5 * y];
 11282  
 11283  	                        // Mix rows
 11284  	                        lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
 11285  	                        lane.low  = TLane.low  ^ (~Tx1Lane.low  & Tx2Lane.low);
 11286  	                    }
 11287  	                }
 11288  
 11289  	                // Iota
 11290  	                var lane = state[0];
 11291  	                var roundConstant = ROUND_CONSTANTS[round];
 11292  	                lane.high ^= roundConstant.high;
 11293  	                lane.low  ^= roundConstant.low;;
 11294  	            }
 11295  	        },
 11296  
 11297  	        _doFinalize: function () {
 11298  	            // Shortcuts
 11299  	            var data = this._data;
 11300  	            var dataWords = data.words;
 11301  	            var nBitsTotal = this._nDataBytes * 8;
 11302  	            var nBitsLeft = data.sigBytes * 8;
 11303  	            var blockSizeBits = this.blockSize * 32;
 11304  
 11305  	            // Add padding
 11306  	            dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
 11307  	            dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
 11308  	            data.sigBytes = dataWords.length * 4;
 11309  
 11310  	            // Hash final blocks
 11311  	            this._process();
 11312  
 11313  	            // Shortcuts
 11314  	            var state = this._state;
 11315  	            var outputLengthBytes = this.cfg.outputLength / 8;
 11316  	            var outputLengthLanes = outputLengthBytes / 8;
 11317  
 11318  	            // Squeeze
 11319  	            var hashWords = [];
 11320  	            for (var i = 0; i < outputLengthLanes; i++) {
 11321  	                // Shortcuts
 11322  	                var lane = state[i];
 11323  	                var laneMsw = lane.high;
 11324  	                var laneLsw = lane.low;
 11325  
 11326  	                // Swap endian
 11327  	                laneMsw = (
 11328  	                    (((laneMsw << 8)  | (laneMsw >>> 24)) & 0x00ff00ff) |
 11329  	                    (((laneMsw << 24) | (laneMsw >>> 8))  & 0xff00ff00)
 11330  	                );
 11331  	                laneLsw = (
 11332  	                    (((laneLsw << 8)  | (laneLsw >>> 24)) & 0x00ff00ff) |
 11333  	                    (((laneLsw << 24) | (laneLsw >>> 8))  & 0xff00ff00)
 11334  	                );
 11335  
 11336  	                // Squeeze state to retrieve hash
 11337  	                hashWords.push(laneLsw);
 11338  	                hashWords.push(laneMsw);
 11339  	            }
 11340  
 11341  	            // Return final computed hash
 11342  	            return new WordArray.init(hashWords, outputLengthBytes);
 11343  	        },
 11344  
 11345  	        clone: function () {
 11346  	            var clone = Hasher.clone.call(this);
 11347  
 11348  	            var state = clone._state = this._state.slice(0);
 11349  	            for (var i = 0; i < 25; i++) {
 11350  	                state[i] = state[i].clone();
 11351  	            }
 11352  
 11353  	            return clone;
 11354  	        }
 11355  	    });
 11356  
 11357  	    /**
 11358  	     * Shortcut function to the hasher's object interface.
 11359  	     *
 11360  	     * @param {WordArray|string} message The message to hash.
 11361  	     *
 11362  	     * @return {WordArray} The hash.
 11363  	     *
 11364  	     * @static
 11365  	     *
 11366  	     * @example
 11367  	     *
 11368  	     *     var hash = CryptoJS.SHA3('message');
 11369  	     *     var hash = CryptoJS.SHA3(wordArray);
 11370  	     */
 11371  	    C.SHA3 = Hasher._createHelper(SHA3);
 11372  
 11373  	    /**
 11374  	     * Shortcut function to the HMAC's object interface.
 11375  	     *
 11376  	     * @param {WordArray|string} message The message to hash.
 11377  	     * @param {WordArray|string} key The secret key.
 11378  	     *
 11379  	     * @return {WordArray} The HMAC.
 11380  	     *
 11381  	     * @static
 11382  	     *
 11383  	     * @example
 11384  	     *
 11385  	     *     var hmac = CryptoJS.HmacSHA3(message, key);
 11386  	     */
 11387  	    C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
 11388  	}(Math));
 11389  
 11390  
 11391  	return CryptoJS.SHA3;
 11392  
 11393  }));
 11394  },{"./core":53,"./x64-core":84}],81:[function(require,module,exports){
 11395  ;(function (root, factory, undef) {
 11396  	if (typeof exports === "object") {
 11397  		// CommonJS
 11398  		module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
 11399  	}
 11400  	else if (typeof define === "function" && define.amd) {
 11401  		// AMD
 11402  		define(["./core", "./x64-core", "./sha512"], factory);
 11403  	}
 11404  	else {
 11405  		// Global (browser)
 11406  		factory(root.CryptoJS);
 11407  	}
 11408  }(this, function (CryptoJS) {
 11409  
 11410  	(function () {
 11411  	    // Shortcuts
 11412  	    var C = CryptoJS;
 11413  	    var C_x64 = C.x64;
 11414  	    var X64Word = C_x64.Word;
 11415  	    var X64WordArray = C_x64.WordArray;
 11416  	    var C_algo = C.algo;
 11417  	    var SHA512 = C_algo.SHA512;
 11418  
 11419  	    /**
 11420  	     * SHA-384 hash algorithm.
 11421  	     */
 11422  	    var SHA384 = C_algo.SHA384 = SHA512.extend({
 11423  	        _doReset: function () {
 11424  	            this._hash = new X64WordArray.init([
 11425  	                new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
 11426  	                new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
 11427  	                new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
 11428  	                new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
 11429  	            ]);
 11430  	        },
 11431  
 11432  	        _doFinalize: function () {
 11433  	            var hash = SHA512._doFinalize.call(this);
 11434  
 11435  	            hash.sigBytes -= 16;
 11436  
 11437  	            return hash;
 11438  	        }
 11439  	    });
 11440  
 11441  	    /**
 11442  	     * Shortcut function to the hasher's object interface.
 11443  	     *
 11444  	     * @param {WordArray|string} message The message to hash.
 11445  	     *
 11446  	     * @return {WordArray} The hash.
 11447  	     *
 11448  	     * @static
 11449  	     *
 11450  	     * @example
 11451  	     *
 11452  	     *     var hash = CryptoJS.SHA384('message');
 11453  	     *     var hash = CryptoJS.SHA384(wordArray);
 11454  	     */
 11455  	    C.SHA384 = SHA512._createHelper(SHA384);
 11456  
 11457  	    /**
 11458  	     * Shortcut function to the HMAC's object interface.
 11459  	     *
 11460  	     * @param {WordArray|string} message The message to hash.
 11461  	     * @param {WordArray|string} key The secret key.
 11462  	     *
 11463  	     * @return {WordArray} The HMAC.
 11464  	     *
 11465  	     * @static
 11466  	     *
 11467  	     * @example
 11468  	     *
 11469  	     *     var hmac = CryptoJS.HmacSHA384(message, key);
 11470  	     */
 11471  	    C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
 11472  	}());
 11473  
 11474  
 11475  	return CryptoJS.SHA384;
 11476  
 11477  }));
 11478  },{"./core":53,"./sha512":82,"./x64-core":84}],82:[function(require,module,exports){
 11479  ;(function (root, factory, undef) {
 11480  	if (typeof exports === "object") {
 11481  		// CommonJS
 11482  		module.exports = exports = factory(require("./core"), require("./x64-core"));
 11483  	}
 11484  	else if (typeof define === "function" && define.amd) {
 11485  		// AMD
 11486  		define(["./core", "./x64-core"], factory);
 11487  	}
 11488  	else {
 11489  		// Global (browser)
 11490  		factory(root.CryptoJS);
 11491  	}
 11492  }(this, function (CryptoJS) {
 11493  
 11494  	(function () {
 11495  	    // Shortcuts
 11496  	    var C = CryptoJS;
 11497  	    var C_lib = C.lib;
 11498  	    var Hasher = C_lib.Hasher;
 11499  	    var C_x64 = C.x64;
 11500  	    var X64Word = C_x64.Word;
 11501  	    var X64WordArray = C_x64.WordArray;
 11502  	    var C_algo = C.algo;
 11503  
 11504  	    function X64Word_create() {
 11505  	        return X64Word.create.apply(X64Word, arguments);
 11506  	    }
 11507  
 11508  	    // Constants
 11509  	    var K = [
 11510  	        X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
 11511  	        X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
 11512  	        X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
 11513  	        X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
 11514  	        X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
 11515  	        X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
 11516  	        X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
 11517  	        X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
 11518  	        X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
 11519  	        X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
 11520  	        X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
 11521  	        X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
 11522  	        X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
 11523  	        X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
 11524  	        X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
 11525  	        X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
 11526  	        X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
 11527  	        X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
 11528  	        X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
 11529  	        X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
 11530  	        X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
 11531  	        X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
 11532  	        X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
 11533  	        X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
 11534  	        X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
 11535  	        X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
 11536  	        X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
 11537  	        X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
 11538  	        X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
 11539  	        X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
 11540  	        X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
 11541  	        X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
 11542  	        X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
 11543  	        X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
 11544  	        X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
 11545  	        X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
 11546  	        X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
 11547  	        X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
 11548  	        X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
 11549  	        X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
 11550  	    ];
 11551  
 11552  	    // Reusable objects
 11553  	    var W = [];
 11554  	    (function () {
 11555  	        for (var i = 0; i < 80; i++) {
 11556  	            W[i] = X64Word_create();
 11557  	        }
 11558  	    }());
 11559  
 11560  	    /**
 11561  	     * SHA-512 hash algorithm.
 11562  	     */
 11563  	    var SHA512 = C_algo.SHA512 = Hasher.extend({
 11564  	        _doReset: function () {
 11565  	            this._hash = new X64WordArray.init([
 11566  	                new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
 11567  	                new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
 11568  	                new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
 11569  	                new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
 11570  	            ]);
 11571  	        },
 11572  
 11573  	        _doProcessBlock: function (M, offset) {
 11574  	            // Shortcuts
 11575  	            var H = this._hash.words;
 11576  
 11577  	            var H0 = H[0];
 11578  	            var H1 = H[1];
 11579  	            var H2 = H[2];
 11580  	            var H3 = H[3];
 11581  	            var H4 = H[4];
 11582  	            var H5 = H[5];
 11583  	            var H6 = H[6];
 11584  	            var H7 = H[7];
 11585  
 11586  	            var H0h = H0.high;
 11587  	            var H0l = H0.low;
 11588  	            var H1h = H1.high;
 11589  	            var H1l = H1.low;
 11590  	            var H2h = H2.high;
 11591  	            var H2l = H2.low;
 11592  	            var H3h = H3.high;
 11593  	            var H3l = H3.low;
 11594  	            var H4h = H4.high;
 11595  	            var H4l = H4.low;
 11596  	            var H5h = H5.high;
 11597  	            var H5l = H5.low;
 11598  	            var H6h = H6.high;
 11599  	            var H6l = H6.low;
 11600  	            var H7h = H7.high;
 11601  	            var H7l = H7.low;
 11602  
 11603  	            // Working variables
 11604  	            var ah = H0h;
 11605  	            var al = H0l;
 11606  	            var bh = H1h;
 11607  	            var bl = H1l;
 11608  	            var ch = H2h;
 11609  	            var cl = H2l;
 11610  	            var dh = H3h;
 11611  	            var dl = H3l;
 11612  	            var eh = H4h;
 11613  	            var el = H4l;
 11614  	            var fh = H5h;
 11615  	            var fl = H5l;
 11616  	            var gh = H6h;
 11617  	            var gl = H6l;
 11618  	            var hh = H7h;
 11619  	            var hl = H7l;
 11620  
 11621  	            // Rounds
 11622  	            for (var i = 0; i < 80; i++) {
 11623  	                // Shortcut
 11624  	                var Wi = W[i];
 11625  
 11626  	                // Extend message
 11627  	                if (i < 16) {
 11628  	                    var Wih = Wi.high = M[offset + i * 2]     | 0;
 11629  	                    var Wil = Wi.low  = M[offset + i * 2 + 1] | 0;
 11630  	                } else {
 11631  	                    // Gamma0
 11632  	                    var gamma0x  = W[i - 15];
 11633  	                    var gamma0xh = gamma0x.high;
 11634  	                    var gamma0xl = gamma0x.low;
 11635  	                    var gamma0h  = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
 11636  	                    var gamma0l  = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
 11637  
 11638  	                    // Gamma1
 11639  	                    var gamma1x  = W[i - 2];
 11640  	                    var gamma1xh = gamma1x.high;
 11641  	                    var gamma1xl = gamma1x.low;
 11642  	                    var gamma1h  = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
 11643  	                    var gamma1l  = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
 11644  
 11645  	                    // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
 11646  	                    var Wi7  = W[i - 7];
 11647  	                    var Wi7h = Wi7.high;
 11648  	                    var Wi7l = Wi7.low;
 11649  
 11650  	                    var Wi16  = W[i - 16];
 11651  	                    var Wi16h = Wi16.high;
 11652  	                    var Wi16l = Wi16.low;
 11653  
 11654  	                    var Wil = gamma0l + Wi7l;
 11655  	                    var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
 11656  	                    var Wil = Wil + gamma1l;
 11657  	                    var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
 11658  	                    var Wil = Wil + Wi16l;
 11659  	                    var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
 11660  
 11661  	                    Wi.high = Wih;
 11662  	                    Wi.low  = Wil;
 11663  	                }
 11664  
 11665  	                var chh  = (eh & fh) ^ (~eh & gh);
 11666  	                var chl  = (el & fl) ^ (~el & gl);
 11667  	                var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
 11668  	                var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
 11669  
 11670  	                var sigma0h = ((ah >>> 28) | (al << 4))  ^ ((ah << 30)  | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
 11671  	                var sigma0l = ((al >>> 28) | (ah << 4))  ^ ((al << 30)  | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
 11672  	                var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
 11673  	                var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
 11674  
 11675  	                // t1 = h + sigma1 + ch + K[i] + W[i]
 11676  	                var Ki  = K[i];
 11677  	                var Kih = Ki.high;
 11678  	                var Kil = Ki.low;
 11679  
 11680  	                var t1l = hl + sigma1l;
 11681  	                var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
 11682  	                var t1l = t1l + chl;
 11683  	                var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
 11684  	                var t1l = t1l + Kil;
 11685  	                var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
 11686  	                var t1l = t1l + Wil;
 11687  	                var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
 11688  
 11689  	                // t2 = sigma0 + maj
 11690  	                var t2l = sigma0l + majl;
 11691  	                var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
 11692  
 11693  	                // Update working variables
 11694  	                hh = gh;
 11695  	                hl = gl;
 11696  	                gh = fh;
 11697  	                gl = fl;
 11698  	                fh = eh;
 11699  	                fl = el;
 11700  	                el = (dl + t1l) | 0;
 11701  	                eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
 11702  	                dh = ch;
 11703  	                dl = cl;
 11704  	                ch = bh;
 11705  	                cl = bl;
 11706  	                bh = ah;
 11707  	                bl = al;
 11708  	                al = (t1l + t2l) | 0;
 11709  	                ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
 11710  	            }
 11711  
 11712  	            // Intermediate hash value
 11713  	            H0l = H0.low  = (H0l + al);
 11714  	            H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
 11715  	            H1l = H1.low  = (H1l + bl);
 11716  	            H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
 11717  	            H2l = H2.low  = (H2l + cl);
 11718  	            H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
 11719  	            H3l = H3.low  = (H3l + dl);
 11720  	            H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
 11721  	            H4l = H4.low  = (H4l + el);
 11722  	            H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
 11723  	            H5l = H5.low  = (H5l + fl);
 11724  	            H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
 11725  	            H6l = H6.low  = (H6l + gl);
 11726  	            H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
 11727  	            H7l = H7.low  = (H7l + hl);
 11728  	            H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
 11729  	        },
 11730  
 11731  	        _doFinalize: function () {
 11732  	            // Shortcuts
 11733  	            var data = this._data;
 11734  	            var dataWords = data.words;
 11735  
 11736  	            var nBitsTotal = this._nDataBytes * 8;
 11737  	            var nBitsLeft = data.sigBytes * 8;
 11738  
 11739  	            // Add padding
 11740  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 11741  	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
 11742  	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
 11743  	            data.sigBytes = dataWords.length * 4;
 11744  
 11745  	            // Hash final blocks
 11746  	            this._process();
 11747  
 11748  	            // Convert hash to 32-bit word array before returning
 11749  	            var hash = this._hash.toX32();
 11750  
 11751  	            // Return final computed hash
 11752  	            return hash;
 11753  	        },
 11754  
 11755  	        clone: function () {
 11756  	            var clone = Hasher.clone.call(this);
 11757  	            clone._hash = this._hash.clone();
 11758  
 11759  	            return clone;
 11760  	        },
 11761  
 11762  	        blockSize: 1024/32
 11763  	    });
 11764  
 11765  	    /**
 11766  	     * Shortcut function to the hasher's object interface.
 11767  	     *
 11768  	     * @param {WordArray|string} message The message to hash.
 11769  	     *
 11770  	     * @return {WordArray} The hash.
 11771  	     *
 11772  	     * @static
 11773  	     *
 11774  	     * @example
 11775  	     *
 11776  	     *     var hash = CryptoJS.SHA512('message');
 11777  	     *     var hash = CryptoJS.SHA512(wordArray);
 11778  	     */
 11779  	    C.SHA512 = Hasher._createHelper(SHA512);
 11780  
 11781  	    /**
 11782  	     * Shortcut function to the HMAC's object interface.
 11783  	     *
 11784  	     * @param {WordArray|string} message The message to hash.
 11785  	     * @param {WordArray|string} key The secret key.
 11786  	     *
 11787  	     * @return {WordArray} The HMAC.
 11788  	     *
 11789  	     * @static
 11790  	     *
 11791  	     * @example
 11792  	     *
 11793  	     *     var hmac = CryptoJS.HmacSHA512(message, key);
 11794  	     */
 11795  	    C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
 11796  	}());
 11797  
 11798  
 11799  	return CryptoJS.SHA512;
 11800  
 11801  }));
 11802  },{"./core":53,"./x64-core":84}],83:[function(require,module,exports){
 11803  ;(function (root, factory, undef) {
 11804  	if (typeof exports === "object") {
 11805  		// CommonJS
 11806  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 11807  	}
 11808  	else if (typeof define === "function" && define.amd) {
 11809  		// AMD
 11810  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 11811  	}
 11812  	else {
 11813  		// Global (browser)
 11814  		factory(root.CryptoJS);
 11815  	}
 11816  }(this, function (CryptoJS) {
 11817  
 11818  	(function () {
 11819  	    // Shortcuts
 11820  	    var C = CryptoJS;
 11821  	    var C_lib = C.lib;
 11822  	    var WordArray = C_lib.WordArray;
 11823  	    var BlockCipher = C_lib.BlockCipher;
 11824  	    var C_algo = C.algo;
 11825  
 11826  	    // Permuted Choice 1 constants
 11827  	    var PC1 = [
 11828  	        57, 49, 41, 33, 25, 17, 9,  1,
 11829  	        58, 50, 42, 34, 26, 18, 10, 2,
 11830  	        59, 51, 43, 35, 27, 19, 11, 3,
 11831  	        60, 52, 44, 36, 63, 55, 47, 39,
 11832  	        31, 23, 15, 7,  62, 54, 46, 38,
 11833  	        30, 22, 14, 6,  61, 53, 45, 37,
 11834  	        29, 21, 13, 5,  28, 20, 12, 4
 11835  	    ];
 11836  
 11837  	    // Permuted Choice 2 constants
 11838  	    var PC2 = [
 11839  	        14, 17, 11, 24, 1,  5,
 11840  	        3,  28, 15, 6,  21, 10,
 11841  	        23, 19, 12, 4,  26, 8,
 11842  	        16, 7,  27, 20, 13, 2,
 11843  	        41, 52, 31, 37, 47, 55,
 11844  	        30, 40, 51, 45, 33, 48,
 11845  	        44, 49, 39, 56, 34, 53,
 11846  	        46, 42, 50, 36, 29, 32
 11847  	    ];
 11848  
 11849  	    // Cumulative bit shift constants
 11850  	    var BIT_SHIFTS = [1,  2,  4,  6,  8,  10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
 11851  
 11852  	    // SBOXes and round permutation constants
 11853  	    var SBOX_P = [
 11854  	        {
 11855  	            0x0: 0x808200,
 11856  	            0x10000000: 0x8000,
 11857  	            0x20000000: 0x808002,
 11858  	            0x30000000: 0x2,
 11859  	            0x40000000: 0x200,
 11860  	            0x50000000: 0x808202,
 11861  	            0x60000000: 0x800202,
 11862  	            0x70000000: 0x800000,
 11863  	            0x80000000: 0x202,
 11864  	            0x90000000: 0x800200,
 11865  	            0xa0000000: 0x8200,
 11866  	            0xb0000000: 0x808000,
 11867  	            0xc0000000: 0x8002,
 11868  	            0xd0000000: 0x800002,
 11869  	            0xe0000000: 0x0,
 11870  	            0xf0000000: 0x8202,
 11871  	            0x8000000: 0x0,
 11872  	            0x18000000: 0x808202,
 11873  	            0x28000000: 0x8202,
 11874  	            0x38000000: 0x8000,
 11875  	            0x48000000: 0x808200,
 11876  	            0x58000000: 0x200,
 11877  	            0x68000000: 0x808002,
 11878  	            0x78000000: 0x2,
 11879  	            0x88000000: 0x800200,
 11880  	            0x98000000: 0x8200,
 11881  	            0xa8000000: 0x808000,
 11882  	            0xb8000000: 0x800202,
 11883  	            0xc8000000: 0x800002,
 11884  	            0xd8000000: 0x8002,
 11885  	            0xe8000000: 0x202,
 11886  	            0xf8000000: 0x800000,
 11887  	            0x1: 0x8000,
 11888  	            0x10000001: 0x2,
 11889  	            0x20000001: 0x808200,
 11890  	            0x30000001: 0x800000,
 11891  	            0x40000001: 0x808002,
 11892  	            0x50000001: 0x8200,
 11893  	            0x60000001: 0x200,
 11894  	            0x70000001: 0x800202,
 11895  	            0x80000001: 0x808202,
 11896  	            0x90000001: 0x808000,
 11897  	            0xa0000001: 0x800002,
 11898  	            0xb0000001: 0x8202,
 11899  	            0xc0000001: 0x202,
 11900  	            0xd0000001: 0x800200,
 11901  	            0xe0000001: 0x8002,
 11902  	            0xf0000001: 0x0,
 11903  	            0x8000001: 0x808202,
 11904  	            0x18000001: 0x808000,
 11905  	            0x28000001: 0x800000,
 11906  	            0x38000001: 0x200,
 11907  	            0x48000001: 0x8000,
 11908  	            0x58000001: 0x800002,
 11909  	            0x68000001: 0x2,
 11910  	            0x78000001: 0x8202,
 11911  	            0x88000001: 0x8002,
 11912  	            0x98000001: 0x800202,
 11913  	            0xa8000001: 0x202,
 11914  	            0xb8000001: 0x808200,
 11915  	            0xc8000001: 0x800200,
 11916  	            0xd8000001: 0x0,
 11917  	            0xe8000001: 0x8200,
 11918  	            0xf8000001: 0x808002
 11919  	        },
 11920  	        {
 11921  	            0x0: 0x40084010,
 11922  	            0x1000000: 0x4000,
 11923  	            0x2000000: 0x80000,
 11924  	            0x3000000: 0x40080010,
 11925  	            0x4000000: 0x40000010,
 11926  	            0x5000000: 0x40084000,
 11927  	            0x6000000: 0x40004000,
 11928  	            0x7000000: 0x10,
 11929  	            0x8000000: 0x84000,
 11930  	            0x9000000: 0x40004010,
 11931  	            0xa000000: 0x40000000,
 11932  	            0xb000000: 0x84010,
 11933  	            0xc000000: 0x80010,
 11934  	            0xd000000: 0x0,
 11935  	            0xe000000: 0x4010,
 11936  	            0xf000000: 0x40080000,
 11937  	            0x800000: 0x40004000,
 11938  	            0x1800000: 0x84010,
 11939  	            0x2800000: 0x10,
 11940  	            0x3800000: 0x40004010,
 11941  	            0x4800000: 0x40084010,
 11942  	            0x5800000: 0x40000000,
 11943  	            0x6800000: 0x80000,
 11944  	            0x7800000: 0x40080010,
 11945  	            0x8800000: 0x80010,
 11946  	            0x9800000: 0x0,
 11947  	            0xa800000: 0x4000,
 11948  	            0xb800000: 0x40080000,
 11949  	            0xc800000: 0x40000010,
 11950  	            0xd800000: 0x84000,
 11951  	            0xe800000: 0x40084000,
 11952  	            0xf800000: 0x4010,
 11953  	            0x10000000: 0x0,
 11954  	            0x11000000: 0x40080010,
 11955  	            0x12000000: 0x40004010,
 11956  	            0x13000000: 0x40084000,
 11957  	            0x14000000: 0x40080000,
 11958  	            0x15000000: 0x10,
 11959  	            0x16000000: 0x84010,
 11960  	            0x17000000: 0x4000,
 11961  	            0x18000000: 0x4010,
 11962  	            0x19000000: 0x80000,
 11963  	            0x1a000000: 0x80010,
 11964  	            0x1b000000: 0x40000010,
 11965  	            0x1c000000: 0x84000,
 11966  	            0x1d000000: 0x40004000,
 11967  	            0x1e000000: 0x40000000,
 11968  	            0x1f000000: 0x40084010,
 11969  	            0x10800000: 0x84010,
 11970  	            0x11800000: 0x80000,
 11971  	            0x12800000: 0x40080000,
 11972  	            0x13800000: 0x4000,
 11973  	            0x14800000: 0x40004000,
 11974  	            0x15800000: 0x40084010,
 11975  	            0x16800000: 0x10,
 11976  	            0x17800000: 0x40000000,
 11977  	            0x18800000: 0x40084000,
 11978  	            0x19800000: 0x40000010,
 11979  	            0x1a800000: 0x40004010,
 11980  	            0x1b800000: 0x80010,
 11981  	            0x1c800000: 0x0,
 11982  	            0x1d800000: 0x4010,
 11983  	            0x1e800000: 0x40080010,
 11984  	            0x1f800000: 0x84000
 11985  	        },
 11986  	        {
 11987  	            0x0: 0x104,
 11988  	            0x100000: 0x0,
 11989  	            0x200000: 0x4000100,
 11990  	            0x300000: 0x10104,
 11991  	            0x400000: 0x10004,
 11992  	            0x500000: 0x4000004,
 11993  	            0x600000: 0x4010104,
 11994  	            0x700000: 0x4010000,
 11995  	            0x800000: 0x4000000,
 11996  	            0x900000: 0x4010100,
 11997  	            0xa00000: 0x10100,
 11998  	            0xb00000: 0x4010004,
 11999  	            0xc00000: 0x4000104,
 12000  	            0xd00000: 0x10000,
 12001  	            0xe00000: 0x4,
 12002  	            0xf00000: 0x100,
 12003  	            0x80000: 0x4010100,
 12004  	            0x180000: 0x4010004,
 12005  	            0x280000: 0x0,
 12006  	            0x380000: 0x4000100,
 12007  	            0x480000: 0x4000004,
 12008  	            0x580000: 0x10000,
 12009  	            0x680000: 0x10004,
 12010  	            0x780000: 0x104,
 12011  	            0x880000: 0x4,
 12012  	            0x980000: 0x100,
 12013  	            0xa80000: 0x4010000,
 12014  	            0xb80000: 0x10104,
 12015  	            0xc80000: 0x10100,
 12016  	            0xd80000: 0x4000104,
 12017  	            0xe80000: 0x4010104,
 12018  	            0xf80000: 0x4000000,
 12019  	            0x1000000: 0x4010100,
 12020  	            0x1100000: 0x10004,
 12021  	            0x1200000: 0x10000,
 12022  	            0x1300000: 0x4000100,
 12023  	            0x1400000: 0x100,
 12024  	            0x1500000: 0x4010104,
 12025  	            0x1600000: 0x4000004,
 12026  	            0x1700000: 0x0,
 12027  	            0x1800000: 0x4000104,
 12028  	            0x1900000: 0x4000000,
 12029  	            0x1a00000: 0x4,
 12030  	            0x1b00000: 0x10100,
 12031  	            0x1c00000: 0x4010000,
 12032  	            0x1d00000: 0x104,
 12033  	            0x1e00000: 0x10104,
 12034  	            0x1f00000: 0x4010004,
 12035  	            0x1080000: 0x4000000,
 12036  	            0x1180000: 0x104,
 12037  	            0x1280000: 0x4010100,
 12038  	            0x1380000: 0x0,
 12039  	            0x1480000: 0x10004,
 12040  	            0x1580000: 0x4000100,
 12041  	            0x1680000: 0x100,
 12042  	            0x1780000: 0x4010004,
 12043  	            0x1880000: 0x10000,
 12044  	            0x1980000: 0x4010104,
 12045  	            0x1a80000: 0x10104,
 12046  	            0x1b80000: 0x4000004,
 12047  	            0x1c80000: 0x4000104,
 12048  	            0x1d80000: 0x4010000,
 12049  	            0x1e80000: 0x4,
 12050  	            0x1f80000: 0x10100
 12051  	        },
 12052  	        {
 12053  	            0x0: 0x80401000,
 12054  	            0x10000: 0x80001040,
 12055  	            0x20000: 0x401040,
 12056  	            0x30000: 0x80400000,
 12057  	            0x40000: 0x0,
 12058  	            0x50000: 0x401000,
 12059  	            0x60000: 0x80000040,
 12060  	            0x70000: 0x400040,
 12061  	            0x80000: 0x80000000,
 12062  	            0x90000: 0x400000,
 12063  	            0xa0000: 0x40,
 12064  	            0xb0000: 0x80001000,
 12065  	            0xc0000: 0x80400040,
 12066  	            0xd0000: 0x1040,
 12067  	            0xe0000: 0x1000,
 12068  	            0xf0000: 0x80401040,
 12069  	            0x8000: 0x80001040,
 12070  	            0x18000: 0x40,
 12071  	            0x28000: 0x80400040,
 12072  	            0x38000: 0x80001000,
 12073  	            0x48000: 0x401000,
 12074  	            0x58000: 0x80401040,
 12075  	            0x68000: 0x0,
 12076  	            0x78000: 0x80400000,
 12077  	            0x88000: 0x1000,
 12078  	            0x98000: 0x80401000,
 12079  	            0xa8000: 0x400000,
 12080  	            0xb8000: 0x1040,
 12081  	            0xc8000: 0x80000000,
 12082  	            0xd8000: 0x400040,
 12083  	            0xe8000: 0x401040,
 12084  	            0xf8000: 0x80000040,
 12085  	            0x100000: 0x400040,
 12086  	            0x110000: 0x401000,
 12087  	            0x120000: 0x80000040,
 12088  	            0x130000: 0x0,
 12089  	            0x140000: 0x1040,
 12090  	            0x150000: 0x80400040,
 12091  	            0x160000: 0x80401000,
 12092  	            0x170000: 0x80001040,
 12093  	            0x180000: 0x80401040,
 12094  	            0x190000: 0x80000000,
 12095  	            0x1a0000: 0x80400000,
 12096  	            0x1b0000: 0x401040,
 12097  	            0x1c0000: 0x80001000,
 12098  	            0x1d0000: 0x400000,
 12099  	            0x1e0000: 0x40,
 12100  	            0x1f0000: 0x1000,
 12101  	            0x108000: 0x80400000,
 12102  	            0x118000: 0x80401040,
 12103  	            0x128000: 0x0,
 12104  	            0x138000: 0x401000,
 12105  	            0x148000: 0x400040,
 12106  	            0x158000: 0x80000000,
 12107  	            0x168000: 0x80001040,
 12108  	            0x178000: 0x40,
 12109  	            0x188000: 0x80000040,
 12110  	            0x198000: 0x1000,
 12111  	            0x1a8000: 0x80001000,
 12112  	            0x1b8000: 0x80400040,
 12113  	            0x1c8000: 0x1040,
 12114  	            0x1d8000: 0x80401000,
 12115  	            0x1e8000: 0x400000,
 12116  	            0x1f8000: 0x401040
 12117  	        },
 12118  	        {
 12119  	            0x0: 0x80,
 12120  	            0x1000: 0x1040000,
 12121  	            0x2000: 0x40000,
 12122  	            0x3000: 0x20000000,
 12123  	            0x4000: 0x20040080,
 12124  	            0x5000: 0x1000080,
 12125  	            0x6000: 0x21000080,
 12126  	            0x7000: 0x40080,
 12127  	            0x8000: 0x1000000,
 12128  	            0x9000: 0x20040000,
 12129  	            0xa000: 0x20000080,
 12130  	            0xb000: 0x21040080,
 12131  	            0xc000: 0x21040000,
 12132  	            0xd000: 0x0,
 12133  	            0xe000: 0x1040080,
 12134  	            0xf000: 0x21000000,
 12135  	            0x800: 0x1040080,
 12136  	            0x1800: 0x21000080,
 12137  	            0x2800: 0x80,
 12138  	            0x3800: 0x1040000,
 12139  	            0x4800: 0x40000,
 12140  	            0x5800: 0x20040080,
 12141  	            0x6800: 0x21040000,
 12142  	            0x7800: 0x20000000,
 12143  	            0x8800: 0x20040000,
 12144  	            0x9800: 0x0,
 12145  	            0xa800: 0x21040080,
 12146  	            0xb800: 0x1000080,
 12147  	            0xc800: 0x20000080,
 12148  	            0xd800: 0x21000000,
 12149  	            0xe800: 0x1000000,
 12150  	            0xf800: 0x40080,
 12151  	            0x10000: 0x40000,
 12152  	            0x11000: 0x80,
 12153  	            0x12000: 0x20000000,
 12154  	            0x13000: 0x21000080,
 12155  	            0x14000: 0x1000080,
 12156  	            0x15000: 0x21040000,
 12157  	            0x16000: 0x20040080,
 12158  	            0x17000: 0x1000000,
 12159  	            0x18000: 0x21040080,
 12160  	            0x19000: 0x21000000,
 12161  	            0x1a000: 0x1040000,
 12162  	            0x1b000: 0x20040000,
 12163  	            0x1c000: 0x40080,
 12164  	            0x1d000: 0x20000080,
 12165  	            0x1e000: 0x0,
 12166  	            0x1f000: 0x1040080,
 12167  	            0x10800: 0x21000080,
 12168  	            0x11800: 0x1000000,
 12169  	            0x12800: 0x1040000,
 12170  	            0x13800: 0x20040080,
 12171  	            0x14800: 0x20000000,
 12172  	            0x15800: 0x1040080,
 12173  	            0x16800: 0x80,
 12174  	            0x17800: 0x21040000,
 12175  	            0x18800: 0x40080,
 12176  	            0x19800: 0x21040080,
 12177  	            0x1a800: 0x0,
 12178  	            0x1b800: 0x21000000,
 12179  	            0x1c800: 0x1000080,
 12180  	            0x1d800: 0x40000,
 12181  	            0x1e800: 0x20040000,
 12182  	            0x1f800: 0x20000080
 12183  	        },
 12184  	        {
 12185  	            0x0: 0x10000008,
 12186  	            0x100: 0x2000,
 12187  	            0x200: 0x10200000,
 12188  	            0x300: 0x10202008,
 12189  	            0x400: 0x10002000,
 12190  	            0x500: 0x200000,
 12191  	            0x600: 0x200008,
 12192  	            0x700: 0x10000000,
 12193  	            0x800: 0x0,
 12194  	            0x900: 0x10002008,
 12195  	            0xa00: 0x202000,
 12196  	            0xb00: 0x8,
 12197  	            0xc00: 0x10200008,
 12198  	            0xd00: 0x202008,
 12199  	            0xe00: 0x2008,
 12200  	            0xf00: 0x10202000,
 12201  	            0x80: 0x10200000,
 12202  	            0x180: 0x10202008,
 12203  	            0x280: 0x8,
 12204  	            0x380: 0x200000,
 12205  	            0x480: 0x202008,
 12206  	            0x580: 0x10000008,
 12207  	            0x680: 0x10002000,
 12208  	            0x780: 0x2008,
 12209  	            0x880: 0x200008,
 12210  	            0x980: 0x2000,
 12211  	            0xa80: 0x10002008,
 12212  	            0xb80: 0x10200008,
 12213  	            0xc80: 0x0,
 12214  	            0xd80: 0x10202000,
 12215  	            0xe80: 0x202000,
 12216  	            0xf80: 0x10000000,
 12217  	            0x1000: 0x10002000,
 12218  	            0x1100: 0x10200008,
 12219  	            0x1200: 0x10202008,
 12220  	            0x1300: 0x2008,
 12221  	            0x1400: 0x200000,
 12222  	            0x1500: 0x10000000,
 12223  	            0x1600: 0x10000008,
 12224  	            0x1700: 0x202000,
 12225  	            0x1800: 0x202008,
 12226  	            0x1900: 0x0,
 12227  	            0x1a00: 0x8,
 12228  	            0x1b00: 0x10200000,
 12229  	            0x1c00: 0x2000,
 12230  	            0x1d00: 0x10002008,
 12231  	            0x1e00: 0x10202000,
 12232  	            0x1f00: 0x200008,
 12233  	            0x1080: 0x8,
 12234  	            0x1180: 0x202000,
 12235  	            0x1280: 0x200000,
 12236  	            0x1380: 0x10000008,
 12237  	            0x1480: 0x10002000,
 12238  	            0x1580: 0x2008,
 12239  	            0x1680: 0x10202008,
 12240  	            0x1780: 0x10200000,
 12241  	            0x1880: 0x10202000,
 12242  	            0x1980: 0x10200008,
 12243  	            0x1a80: 0x2000,
 12244  	            0x1b80: 0x202008,
 12245  	            0x1c80: 0x200008,
 12246  	            0x1d80: 0x0,
 12247  	            0x1e80: 0x10000000,
 12248  	            0x1f80: 0x10002008
 12249  	        },
 12250  	        {
 12251  	            0x0: 0x100000,
 12252  	            0x10: 0x2000401,
 12253  	            0x20: 0x400,
 12254  	            0x30: 0x100401,
 12255  	            0x40: 0x2100401,
 12256  	            0x50: 0x0,
 12257  	            0x60: 0x1,
 12258  	            0x70: 0x2100001,
 12259  	            0x80: 0x2000400,
 12260  	            0x90: 0x100001,
 12261  	            0xa0: 0x2000001,
 12262  	            0xb0: 0x2100400,
 12263  	            0xc0: 0x2100000,
 12264  	            0xd0: 0x401,
 12265  	            0xe0: 0x100400,
 12266  	            0xf0: 0x2000000,
 12267  	            0x8: 0x2100001,
 12268  	            0x18: 0x0,
 12269  	            0x28: 0x2000401,
 12270  	            0x38: 0x2100400,
 12271  	            0x48: 0x100000,
 12272  	            0x58: 0x2000001,
 12273  	            0x68: 0x2000000,
 12274  	            0x78: 0x401,
 12275  	            0x88: 0x100401,
 12276  	            0x98: 0x2000400,
 12277  	            0xa8: 0x2100000,
 12278  	            0xb8: 0x100001,
 12279  	            0xc8: 0x400,
 12280  	            0xd8: 0x2100401,
 12281  	            0xe8: 0x1,
 12282  	            0xf8: 0x100400,
 12283  	            0x100: 0x2000000,
 12284  	            0x110: 0x100000,
 12285  	            0x120: 0x2000401,
 12286  	            0x130: 0x2100001,
 12287  	            0x140: 0x100001,
 12288  	            0x150: 0x2000400,
 12289  	            0x160: 0x2100400,
 12290  	            0x170: 0x100401,
 12291  	            0x180: 0x401,
 12292  	            0x190: 0x2100401,
 12293  	            0x1a0: 0x100400,
 12294  	            0x1b0: 0x1,
 12295  	            0x1c0: 0x0,
 12296  	            0x1d0: 0x2100000,
 12297  	            0x1e0: 0x2000001,
 12298  	            0x1f0: 0x400,
 12299  	            0x108: 0x100400,
 12300  	            0x118: 0x2000401,
 12301  	            0x128: 0x2100001,
 12302  	            0x138: 0x1,
 12303  	            0x148: 0x2000000,
 12304  	            0x158: 0x100000,
 12305  	            0x168: 0x401,
 12306  	            0x178: 0x2100400,
 12307  	            0x188: 0x2000001,
 12308  	            0x198: 0x2100000,
 12309  	            0x1a8: 0x0,
 12310  	            0x1b8: 0x2100401,
 12311  	            0x1c8: 0x100401,
 12312  	            0x1d8: 0x400,
 12313  	            0x1e8: 0x2000400,
 12314  	            0x1f8: 0x100001
 12315  	        },
 12316  	        {
 12317  	            0x0: 0x8000820,
 12318  	            0x1: 0x20000,
 12319  	            0x2: 0x8000000,
 12320  	            0x3: 0x20,
 12321  	            0x4: 0x20020,
 12322  	            0x5: 0x8020820,
 12323  	            0x6: 0x8020800,
 12324  	            0x7: 0x800,
 12325  	            0x8: 0x8020000,
 12326  	            0x9: 0x8000800,
 12327  	            0xa: 0x20800,
 12328  	            0xb: 0x8020020,
 12329  	            0xc: 0x820,
 12330  	            0xd: 0x0,
 12331  	            0xe: 0x8000020,
 12332  	            0xf: 0x20820,
 12333  	            0x80000000: 0x800,
 12334  	            0x80000001: 0x8020820,
 12335  	            0x80000002: 0x8000820,
 12336  	            0x80000003: 0x8000000,
 12337  	            0x80000004: 0x8020000,
 12338  	            0x80000005: 0x20800,
 12339  	            0x80000006: 0x20820,
 12340  	            0x80000007: 0x20,
 12341  	            0x80000008: 0x8000020,
 12342  	            0x80000009: 0x820,
 12343  	            0x8000000a: 0x20020,
 12344  	            0x8000000b: 0x8020800,
 12345  	            0x8000000c: 0x0,
 12346  	            0x8000000d: 0x8020020,
 12347  	            0x8000000e: 0x8000800,
 12348  	            0x8000000f: 0x20000,
 12349  	            0x10: 0x20820,
 12350  	            0x11: 0x8020800,
 12351  	            0x12: 0x20,
 12352  	            0x13: 0x800,
 12353  	            0x14: 0x8000800,
 12354  	            0x15: 0x8000020,
 12355  	            0x16: 0x8020020,
 12356  	            0x17: 0x20000,
 12357  	            0x18: 0x0,
 12358  	            0x19: 0x20020,
 12359  	            0x1a: 0x8020000,
 12360  	            0x1b: 0x8000820,
 12361  	            0x1c: 0x8020820,
 12362  	            0x1d: 0x20800,
 12363  	            0x1e: 0x820,
 12364  	            0x1f: 0x8000000,
 12365  	            0x80000010: 0x20000,
 12366  	            0x80000011: 0x800,
 12367  	            0x80000012: 0x8020020,
 12368  	            0x80000013: 0x20820,
 12369  	            0x80000014: 0x20,
 12370  	            0x80000015: 0x8020000,
 12371  	            0x80000016: 0x8000000,
 12372  	            0x80000017: 0x8000820,
 12373  	            0x80000018: 0x8020820,
 12374  	            0x80000019: 0x8000020,
 12375  	            0x8000001a: 0x8000800,
 12376  	            0x8000001b: 0x0,
 12377  	            0x8000001c: 0x20800,
 12378  	            0x8000001d: 0x820,
 12379  	            0x8000001e: 0x20020,
 12380  	            0x8000001f: 0x8020800
 12381  	        }
 12382  	    ];
 12383  
 12384  	    // Masks that select the SBOX input
 12385  	    var SBOX_MASK = [
 12386  	        0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
 12387  	        0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
 12388  	    ];
 12389  
 12390  	    /**
 12391  	     * DES block cipher algorithm.
 12392  	     */
 12393  	    var DES = C_algo.DES = BlockCipher.extend({
 12394  	        _doReset: function () {
 12395  	            // Shortcuts
 12396  	            var key = this._key;
 12397  	            var keyWords = key.words;
 12398  
 12399  	            // Select 56 bits according to PC1
 12400  	            var keyBits = [];
 12401  	            for (var i = 0; i < 56; i++) {
 12402  	                var keyBitPos = PC1[i] - 1;
 12403  	                keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
 12404  	            }
 12405  
 12406  	            // Assemble 16 subkeys
 12407  	            var subKeys = this._subKeys = [];
 12408  	            for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
 12409  	                // Create subkey
 12410  	                var subKey = subKeys[nSubKey] = [];
 12411  
 12412  	                // Shortcut
 12413  	                var bitShift = BIT_SHIFTS[nSubKey];
 12414  
 12415  	                // Select 48 bits according to PC2
 12416  	                for (var i = 0; i < 24; i++) {
 12417  	                    // Select from the left 28 key bits
 12418  	                    subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
 12419  
 12420  	                    // Select from the right 28 key bits
 12421  	                    subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
 12422  	                }
 12423  
 12424  	                // Since each subkey is applied to an expanded 32-bit input,
 12425  	                // the subkey can be broken into 8 values scaled to 32-bits,
 12426  	                // which allows the key to be used without expansion
 12427  	                subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
 12428  	                for (var i = 1; i < 7; i++) {
 12429  	                    subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
 12430  	                }
 12431  	                subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
 12432  	            }
 12433  
 12434  	            // Compute inverse subkeys
 12435  	            var invSubKeys = this._invSubKeys = [];
 12436  	            for (var i = 0; i < 16; i++) {
 12437  	                invSubKeys[i] = subKeys[15 - i];
 12438  	            }
 12439  	        },
 12440  
 12441  	        encryptBlock: function (M, offset) {
 12442  	            this._doCryptBlock(M, offset, this._subKeys);
 12443  	        },
 12444  
 12445  	        decryptBlock: function (M, offset) {
 12446  	            this._doCryptBlock(M, offset, this._invSubKeys);
 12447  	        },
 12448  
 12449  	        _doCryptBlock: function (M, offset, subKeys) {
 12450  	            // Get input
 12451  	            this._lBlock = M[offset];
 12452  	            this._rBlock = M[offset + 1];
 12453  
 12454  	            // Initial permutation
 12455  	            exchangeLR.call(this, 4,  0x0f0f0f0f);
 12456  	            exchangeLR.call(this, 16, 0x0000ffff);
 12457  	            exchangeRL.call(this, 2,  0x33333333);
 12458  	            exchangeRL.call(this, 8,  0x00ff00ff);
 12459  	            exchangeLR.call(this, 1,  0x55555555);
 12460  
 12461  	            // Rounds
 12462  	            for (var round = 0; round < 16; round++) {
 12463  	                // Shortcuts
 12464  	                var subKey = subKeys[round];
 12465  	                var lBlock = this._lBlock;
 12466  	                var rBlock = this._rBlock;
 12467  
 12468  	                // Feistel function
 12469  	                var f = 0;
 12470  	                for (var i = 0; i < 8; i++) {
 12471  	                    f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
 12472  	                }
 12473  	                this._lBlock = rBlock;
 12474  	                this._rBlock = lBlock ^ f;
 12475  	            }
 12476  
 12477  	            // Undo swap from last round
 12478  	            var t = this._lBlock;
 12479  	            this._lBlock = this._rBlock;
 12480  	            this._rBlock = t;
 12481  
 12482  	            // Final permutation
 12483  	            exchangeLR.call(this, 1,  0x55555555);
 12484  	            exchangeRL.call(this, 8,  0x00ff00ff);
 12485  	            exchangeRL.call(this, 2,  0x33333333);
 12486  	            exchangeLR.call(this, 16, 0x0000ffff);
 12487  	            exchangeLR.call(this, 4,  0x0f0f0f0f);
 12488  
 12489  	            // Set output
 12490  	            M[offset] = this._lBlock;
 12491  	            M[offset + 1] = this._rBlock;
 12492  	        },
 12493  
 12494  	        keySize: 64/32,
 12495  
 12496  	        ivSize: 64/32,
 12497  
 12498  	        blockSize: 64/32
 12499  	    });
 12500  
 12501  	    // Swap bits across the left and right words
 12502  	    function exchangeLR(offset, mask) {
 12503  	        var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
 12504  	        this._rBlock ^= t;
 12505  	        this._lBlock ^= t << offset;
 12506  	    }
 12507  
 12508  	    function exchangeRL(offset, mask) {
 12509  	        var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
 12510  	        this._lBlock ^= t;
 12511  	        this._rBlock ^= t << offset;
 12512  	    }
 12513  
 12514  	    /**
 12515  	     * Shortcut functions to the cipher's object interface.
 12516  	     *
 12517  	     * @example
 12518  	     *
 12519  	     *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
 12520  	     *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
 12521  	     */
 12522  	    C.DES = BlockCipher._createHelper(DES);
 12523  
 12524  	    /**
 12525  	     * Triple-DES block cipher algorithm.
 12526  	     */
 12527  	    var TripleDES = C_algo.TripleDES = BlockCipher.extend({
 12528  	        _doReset: function () {
 12529  	            // Shortcuts
 12530  	            var key = this._key;
 12531  	            var keyWords = key.words;
 12532  
 12533  	            // Create DES instances
 12534  	            this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2)));
 12535  	            this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4)));
 12536  	            this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6)));
 12537  	        },
 12538  
 12539  	        encryptBlock: function (M, offset) {
 12540  	            this._des1.encryptBlock(M, offset);
 12541  	            this._des2.decryptBlock(M, offset);
 12542  	            this._des3.encryptBlock(M, offset);
 12543  	        },
 12544  
 12545  	        decryptBlock: function (M, offset) {
 12546  	            this._des3.decryptBlock(M, offset);
 12547  	            this._des2.encryptBlock(M, offset);
 12548  	            this._des1.decryptBlock(M, offset);
 12549  	        },
 12550  
 12551  	        keySize: 192/32,
 12552  
 12553  	        ivSize: 64/32,
 12554  
 12555  	        blockSize: 64/32
 12556  	    });
 12557  
 12558  	    /**
 12559  	     * Shortcut functions to the cipher's object interface.
 12560  	     *
 12561  	     * @example
 12562  	     *
 12563  	     *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
 12564  	     *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
 12565  	     */
 12566  	    C.TripleDES = BlockCipher._createHelper(TripleDES);
 12567  	}());
 12568  
 12569  
 12570  	return CryptoJS.TripleDES;
 12571  
 12572  }));
 12573  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],84:[function(require,module,exports){
 12574  ;(function (root, factory) {
 12575  	if (typeof exports === "object") {
 12576  		// CommonJS
 12577  		module.exports = exports = factory(require("./core"));
 12578  	}
 12579  	else if (typeof define === "function" && define.amd) {
 12580  		// AMD
 12581  		define(["./core"], factory);
 12582  	}
 12583  	else {
 12584  		// Global (browser)
 12585  		factory(root.CryptoJS);
 12586  	}
 12587  }(this, function (CryptoJS) {
 12588  
 12589  	(function (undefined) {
 12590  	    // Shortcuts
 12591  	    var C = CryptoJS;
 12592  	    var C_lib = C.lib;
 12593  	    var Base = C_lib.Base;
 12594  	    var X32WordArray = C_lib.WordArray;
 12595  
 12596  	    /**
 12597  	     * x64 namespace.
 12598  	     */
 12599  	    var C_x64 = C.x64 = {};
 12600  
 12601  	    /**
 12602  	     * A 64-bit word.
 12603  	     */
 12604  	    var X64Word = C_x64.Word = Base.extend({
 12605  	        /**
 12606  	         * Initializes a newly created 64-bit word.
 12607  	         *
 12608  	         * @param {number} high The high 32 bits.
 12609  	         * @param {number} low The low 32 bits.
 12610  	         *
 12611  	         * @example
 12612  	         *
 12613  	         *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
 12614  	         */
 12615  	        init: function (high, low) {
 12616  	            this.high = high;
 12617  	            this.low = low;
 12618  	        }
 12619  
 12620  	        /**
 12621  	         * Bitwise NOTs this word.
 12622  	         *
 12623  	         * @return {X64Word} A new x64-Word object after negating.
 12624  	         *
 12625  	         * @example
 12626  	         *
 12627  	         *     var negated = x64Word.not();
 12628  	         */
 12629  	        // not: function () {
 12630  	            // var high = ~this.high;
 12631  	            // var low = ~this.low;
 12632  
 12633  	            // return X64Word.create(high, low);
 12634  	        // },
 12635  
 12636  	        /**
 12637  	         * Bitwise ANDs this word with the passed word.
 12638  	         *
 12639  	         * @param {X64Word} word The x64-Word to AND with this word.
 12640  	         *
 12641  	         * @return {X64Word} A new x64-Word object after ANDing.
 12642  	         *
 12643  	         * @example
 12644  	         *
 12645  	         *     var anded = x64Word.and(anotherX64Word);
 12646  	         */
 12647  	        // and: function (word) {
 12648  	            // var high = this.high & word.high;
 12649  	            // var low = this.low & word.low;
 12650  
 12651  	            // return X64Word.create(high, low);
 12652  	        // },
 12653  
 12654  	        /**
 12655  	         * Bitwise ORs this word with the passed word.
 12656  	         *
 12657  	         * @param {X64Word} word The x64-Word to OR with this word.
 12658  	         *
 12659  	         * @return {X64Word} A new x64-Word object after ORing.
 12660  	         *
 12661  	         * @example
 12662  	         *
 12663  	         *     var ored = x64Word.or(anotherX64Word);
 12664  	         */
 12665  	        // or: function (word) {
 12666  	            // var high = this.high | word.high;
 12667  	            // var low = this.low | word.low;
 12668  
 12669  	            // return X64Word.create(high, low);
 12670  	        // },
 12671  
 12672  	        /**
 12673  	         * Bitwise XORs this word with the passed word.
 12674  	         *
 12675  	         * @param {X64Word} word The x64-Word to XOR with this word.
 12676  	         *
 12677  	         * @return {X64Word} A new x64-Word object after XORing.
 12678  	         *
 12679  	         * @example
 12680  	         *
 12681  	         *     var xored = x64Word.xor(anotherX64Word);
 12682  	         */
 12683  	        // xor: function (word) {
 12684  	            // var high = this.high ^ word.high;
 12685  	            // var low = this.low ^ word.low;
 12686  
 12687  	            // return X64Word.create(high, low);
 12688  	        // },
 12689  
 12690  	        /**
 12691  	         * Shifts this word n bits to the left.
 12692  	         *
 12693  	         * @param {number} n The number of bits to shift.
 12694  	         *
 12695  	         * @return {X64Word} A new x64-Word object after shifting.
 12696  	         *
 12697  	         * @example
 12698  	         *
 12699  	         *     var shifted = x64Word.shiftL(25);
 12700  	         */
 12701  	        // shiftL: function (n) {
 12702  	            // if (n < 32) {
 12703  	                // var high = (this.high << n) | (this.low >>> (32 - n));
 12704  	                // var low = this.low << n;
 12705  	            // } else {
 12706  	                // var high = this.low << (n - 32);
 12707  	                // var low = 0;
 12708  	            // }
 12709  
 12710  	            // return X64Word.create(high, low);
 12711  	        // },
 12712  
 12713  	        /**
 12714  	         * Shifts this word n bits to the right.
 12715  	         *
 12716  	         * @param {number} n The number of bits to shift.
 12717  	         *
 12718  	         * @return {X64Word} A new x64-Word object after shifting.
 12719  	         *
 12720  	         * @example
 12721  	         *
 12722  	         *     var shifted = x64Word.shiftR(7);
 12723  	         */
 12724  	        // shiftR: function (n) {
 12725  	            // if (n < 32) {
 12726  	                // var low = (this.low >>> n) | (this.high << (32 - n));
 12727  	                // var high = this.high >>> n;
 12728  	            // } else {
 12729  	                // var low = this.high >>> (n - 32);
 12730  	                // var high = 0;
 12731  	            // }
 12732  
 12733  	            // return X64Word.create(high, low);
 12734  	        // },
 12735  
 12736  	        /**
 12737  	         * Rotates this word n bits to the left.
 12738  	         *
 12739  	         * @param {number} n The number of bits to rotate.
 12740  	         *
 12741  	         * @return {X64Word} A new x64-Word object after rotating.
 12742  	         *
 12743  	         * @example
 12744  	         *
 12745  	         *     var rotated = x64Word.rotL(25);
 12746  	         */
 12747  	        // rotL: function (n) {
 12748  	            // return this.shiftL(n).or(this.shiftR(64 - n));
 12749  	        // },
 12750  
 12751  	        /**
 12752  	         * Rotates this word n bits to the right.
 12753  	         *
 12754  	         * @param {number} n The number of bits to rotate.
 12755  	         *
 12756  	         * @return {X64Word} A new x64-Word object after rotating.
 12757  	         *
 12758  	         * @example
 12759  	         *
 12760  	         *     var rotated = x64Word.rotR(7);
 12761  	         */
 12762  	        // rotR: function (n) {
 12763  	            // return this.shiftR(n).or(this.shiftL(64 - n));
 12764  	        // },
 12765  
 12766  	        /**
 12767  	         * Adds this word with the passed word.
 12768  	         *
 12769  	         * @param {X64Word} word The x64-Word to add with this word.
 12770  	         *
 12771  	         * @return {X64Word} A new x64-Word object after adding.
 12772  	         *
 12773  	         * @example
 12774  	         *
 12775  	         *     var added = x64Word.add(anotherX64Word);
 12776  	         */
 12777  	        // add: function (word) {
 12778  	            // var low = (this.low + word.low) | 0;
 12779  	            // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
 12780  	            // var high = (this.high + word.high + carry) | 0;
 12781  
 12782  	            // return X64Word.create(high, low);
 12783  	        // }
 12784  	    });
 12785  
 12786  	    /**
 12787  	     * An array of 64-bit words.
 12788  	     *
 12789  	     * @property {Array} words The array of CryptoJS.x64.Word objects.
 12790  	     * @property {number} sigBytes The number of significant bytes in this word array.
 12791  	     */
 12792  	    var X64WordArray = C_x64.WordArray = Base.extend({
 12793  	        /**
 12794  	         * Initializes a newly created word array.
 12795  	         *
 12796  	         * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
 12797  	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
 12798  	         *
 12799  	         * @example
 12800  	         *
 12801  	         *     var wordArray = CryptoJS.x64.WordArray.create();
 12802  	         *
 12803  	         *     var wordArray = CryptoJS.x64.WordArray.create([
 12804  	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 12805  	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 12806  	         *     ]);
 12807  	         *
 12808  	         *     var wordArray = CryptoJS.x64.WordArray.create([
 12809  	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 12810  	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 12811  	         *     ], 10);
 12812  	         */
 12813  	        init: function (words, sigBytes) {
 12814  	            words = this.words = words || [];
 12815  
 12816  	            if (sigBytes != undefined) {
 12817  	                this.sigBytes = sigBytes;
 12818  	            } else {
 12819  	                this.sigBytes = words.length * 8;
 12820  	            }
 12821  	        },
 12822  
 12823  	        /**
 12824  	         * Converts this 64-bit word array to a 32-bit word array.
 12825  	         *
 12826  	         * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
 12827  	         *
 12828  	         * @example
 12829  	         *
 12830  	         *     var x32WordArray = x64WordArray.toX32();
 12831  	         */
 12832  	        toX32: function () {
 12833  	            // Shortcuts
 12834  	            var x64Words = this.words;
 12835  	            var x64WordsLength = x64Words.length;
 12836  
 12837  	            // Convert
 12838  	            var x32Words = [];
 12839  	            for (var i = 0; i < x64WordsLength; i++) {
 12840  	                var x64Word = x64Words[i];
 12841  	                x32Words.push(x64Word.high);
 12842  	                x32Words.push(x64Word.low);
 12843  	            }
 12844  
 12845  	            return X32WordArray.create(x32Words, this.sigBytes);
 12846  	        },
 12847  
 12848  	        /**
 12849  	         * Creates a copy of this word array.
 12850  	         *
 12851  	         * @return {X64WordArray} The clone.
 12852  	         *
 12853  	         * @example
 12854  	         *
 12855  	         *     var clone = x64WordArray.clone();
 12856  	         */
 12857  	        clone: function () {
 12858  	            var clone = Base.clone.call(this);
 12859  
 12860  	            // Clone "words" array
 12861  	            var words = clone.words = this.words.slice(0);
 12862  
 12863  	            // Clone each X64Word object
 12864  	            var wordsLength = words.length;
 12865  	            for (var i = 0; i < wordsLength; i++) {
 12866  	                words[i] = words[i].clone();
 12867  	            }
 12868  
 12869  	            return clone;
 12870  	        }
 12871  	    });
 12872  	}());
 12873  
 12874  
 12875  	return CryptoJS;
 12876  
 12877  }));
 12878  },{"./core":53}],85:[function(require,module,exports){
 12879  /*! https://mths.be/utf8js v2.1.2 by @mathias */
 12880  ;(function(root) {
 12881  
 12882  	// Detect free variables `exports`
 12883  	var freeExports = typeof exports == 'object' && exports;
 12884  
 12885  	// Detect free variable `module`
 12886  	var freeModule = typeof module == 'object' && module &&
 12887  		module.exports == freeExports && module;
 12888  
 12889  	// Detect free variable `global`, from Node.js or Browserified code,
 12890  	// and use it as `root`
 12891  	var freeGlobal = typeof global == 'object' && global;
 12892  	if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
 12893  		root = freeGlobal;
 12894  	}
 12895  
 12896  	/*--------------------------------------------------------------------------*/
 12897  
 12898  	var stringFromCharCode = String.fromCharCode;
 12899  
 12900  	// Taken from https://mths.be/punycode
 12901  	function ucs2decode(string) {
 12902  		var output = [];
 12903  		var counter = 0;
 12904  		var length = string.length;
 12905  		var value;
 12906  		var extra;
 12907  		while (counter < length) {
 12908  			value = string.charCodeAt(counter++);
 12909  			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
 12910  				// high surrogate, and there is a next character
 12911  				extra = string.charCodeAt(counter++);
 12912  				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
 12913  					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
 12914  				} else {
 12915  					// unmatched surrogate; only append this code unit, in case the next
 12916  					// code unit is the high surrogate of a surrogate pair
 12917  					output.push(value);
 12918  					counter--;
 12919  				}
 12920  			} else {
 12921  				output.push(value);
 12922  			}
 12923  		}
 12924  		return output;
 12925  	}
 12926  
 12927  	// Taken from https://mths.be/punycode
 12928  	function ucs2encode(array) {
 12929  		var length = array.length;
 12930  		var index = -1;
 12931  		var value;
 12932  		var output = '';
 12933  		while (++index < length) {
 12934  			value = array[index];
 12935  			if (value > 0xFFFF) {
 12936  				value -= 0x10000;
 12937  				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
 12938  				value = 0xDC00 | value & 0x3FF;
 12939  			}
 12940  			output += stringFromCharCode(value);
 12941  		}
 12942  		return output;
 12943  	}
 12944  
 12945  	function checkScalarValue(codePoint) {
 12946  		if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
 12947  			throw Error(
 12948  				'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
 12949  				' is not a scalar value'
 12950  			);
 12951  		}
 12952  	}
 12953  	/*--------------------------------------------------------------------------*/
 12954  
 12955  	function createByte(codePoint, shift) {
 12956  		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
 12957  	}
 12958  
 12959  	function encodeCodePoint(codePoint) {
 12960  		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
 12961  			return stringFromCharCode(codePoint);
 12962  		}
 12963  		var symbol = '';
 12964  		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
 12965  			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
 12966  		}
 12967  		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
 12968  			checkScalarValue(codePoint);
 12969  			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
 12970  			symbol += createByte(codePoint, 6);
 12971  		}
 12972  		else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
 12973  			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
 12974  			symbol += createByte(codePoint, 12);
 12975  			symbol += createByte(codePoint, 6);
 12976  		}
 12977  		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
 12978  		return symbol;
 12979  	}
 12980  
 12981  	function utf8encode(string) {
 12982  		var codePoints = ucs2decode(string);
 12983  		var length = codePoints.length;
 12984  		var index = -1;
 12985  		var codePoint;
 12986  		var byteString = '';
 12987  		while (++index < length) {
 12988  			codePoint = codePoints[index];
 12989  			byteString += encodeCodePoint(codePoint);
 12990  		}
 12991  		return byteString;
 12992  	}
 12993  
 12994  	/*--------------------------------------------------------------------------*/
 12995  
 12996  	function readContinuationByte() {
 12997  		if (byteIndex >= byteCount) {
 12998  			throw Error('Invalid byte index');
 12999  		}
 13000  
 13001  		var continuationByte = byteArray[byteIndex] & 0xFF;
 13002  		byteIndex++;
 13003  
 13004  		if ((continuationByte & 0xC0) == 0x80) {
 13005  			return continuationByte & 0x3F;
 13006  		}
 13007  
 13008  		// If we end up here, it’s not a continuation byte
 13009  		throw Error('Invalid continuation byte');
 13010  	}
 13011  
 13012  	function decodeSymbol() {
 13013  		var byte1;
 13014  		var byte2;
 13015  		var byte3;
 13016  		var byte4;
 13017  		var codePoint;
 13018  
 13019  		if (byteIndex > byteCount) {
 13020  			throw Error('Invalid byte index');
 13021  		}
 13022  
 13023  		if (byteIndex == byteCount) {
 13024  			return false;
 13025  		}
 13026  
 13027  		// Read first byte
 13028  		byte1 = byteArray[byteIndex] & 0xFF;
 13029  		byteIndex++;
 13030  
 13031  		// 1-byte sequence (no continuation bytes)
 13032  		if ((byte1 & 0x80) == 0) {
 13033  			return byte1;
 13034  		}
 13035  
 13036  		// 2-byte sequence
 13037  		if ((byte1 & 0xE0) == 0xC0) {
 13038  			byte2 = readContinuationByte();
 13039  			codePoint = ((byte1 & 0x1F) << 6) | byte2;
 13040  			if (codePoint >= 0x80) {
 13041  				return codePoint;
 13042  			} else {
 13043  				throw Error('Invalid continuation byte');
 13044  			}
 13045  		}
 13046  
 13047  		// 3-byte sequence (may include unpaired surrogates)
 13048  		if ((byte1 & 0xF0) == 0xE0) {
 13049  			byte2 = readContinuationByte();
 13050  			byte3 = readContinuationByte();
 13051  			codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
 13052  			if (codePoint >= 0x0800) {
 13053  				checkScalarValue(codePoint);
 13054  				return codePoint;
 13055  			} else {
 13056  				throw Error('Invalid continuation byte');
 13057  			}
 13058  		}
 13059  
 13060  		// 4-byte sequence
 13061  		if ((byte1 & 0xF8) == 0xF0) {
 13062  			byte2 = readContinuationByte();
 13063  			byte3 = readContinuationByte();
 13064  			byte4 = readContinuationByte();
 13065  			codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
 13066  				(byte3 << 0x06) | byte4;
 13067  			if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
 13068  				return codePoint;
 13069  			}
 13070  		}
 13071  
 13072  		throw Error('Invalid UTF-8 detected');
 13073  	}
 13074  
 13075  	var byteArray;
 13076  	var byteCount;
 13077  	var byteIndex;
 13078  	function utf8decode(byteString) {
 13079  		byteArray = ucs2decode(byteString);
 13080  		byteCount = byteArray.length;
 13081  		byteIndex = 0;
 13082  		var codePoints = [];
 13083  		var tmp;
 13084  		while ((tmp = decodeSymbol()) !== false) {
 13085  			codePoints.push(tmp);
 13086  		}
 13087  		return ucs2encode(codePoints);
 13088  	}
 13089  
 13090  	/*--------------------------------------------------------------------------*/
 13091  
 13092  	var utf8 = {
 13093  		'version': '2.1.2',
 13094  		'encode': utf8encode,
 13095  		'decode': utf8decode
 13096  	};
 13097  
 13098  	// Some AMD build optimizers, like r.js, check for specific condition patterns
 13099  	// like the following:
 13100  	if (
 13101  		typeof define == 'function' &&
 13102  		typeof define.amd == 'object' &&
 13103  		define.amd
 13104  	) {
 13105  		define(function() {
 13106  			return utf8;
 13107  		});
 13108  	}	else if (freeExports && !freeExports.nodeType) {
 13109  		if (freeModule) { // in Node.js or RingoJS v0.8.0+
 13110  			freeModule.exports = utf8;
 13111  		} else { // in Narwhal or RingoJS v0.7.0-
 13112  			var object = {};
 13113  			var hasOwnProperty = object.hasOwnProperty;
 13114  			for (var key in utf8) {
 13115  				hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
 13116  			}
 13117  		}
 13118  	} else { // in Rhino or a web browser
 13119  		root.utf8 = utf8;
 13120  	}
 13121  
 13122  }(this));
 13123  
 13124  },{}],86:[function(require,module,exports){
 13125  module.exports = XMLHttpRequest;
 13126  
 13127  },{}],"bignumber.js":[function(require,module,exports){
 13128  'use strict';
 13129  
 13130  module.exports = BigNumber; // jshint ignore:line
 13131  
 13132  
 13133  },{}],"web3":[function(require,module,exports){
 13134  var Web3 = require('./lib/web3');
 13135  
 13136  // don't override global variable
 13137  if (typeof window !== 'undefined' && typeof window.Web3 === 'undefined') {
 13138      window.Web3 = Web3;
 13139  }
 13140  
 13141  module.exports = Web3;
 13142  
 13143  },{"./lib/web3":22}]},{},["web3"])
 13144