github.com/fff-chain/go-fff@v0.0.0-20220726032732-1c84420b8a99/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 SolidityType = require('./type');
   519  
   520  /**
   521   * SolidityTypeAddress is a prootype 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 SolidityTypeAddress = function () {
   531      this._inputFormatter = f.formatInputInt;
   532      this._outputFormatter = f.formatOutputAddress;
   533  };
   534  
   535  SolidityTypeAddress.prototype = new SolidityType({});
   536  SolidityTypeAddress.prototype.constructor = SolidityTypeAddress;
   537  
   538  SolidityTypeAddress.prototype.isType = function (name) {
   539      return !!name.match(/address(\[([0-9]*)\])?/);
   540  };
   541  
   542  module.exports = SolidityTypeAddress;
   543  
   544  },{"./formatters":9,"./type":14}],5:[function(require,module,exports){
   545  var f = require('./formatters');
   546  var SolidityType = require('./type');
   547  
   548  /**
   549   * SolidityTypeBool is a prootype 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 SolidityTypeBool = function () {
   559      this._inputFormatter = f.formatInputBool;
   560      this._outputFormatter = f.formatOutputBool;
   561  };
   562  
   563  SolidityTypeBool.prototype = new SolidityType({});
   564  SolidityTypeBool.prototype.constructor = SolidityTypeBool;
   565  
   566  SolidityTypeBool.prototype.isType = function (name) {
   567      return !!name.match(/^bool(\[([0-9]*)\])*$/);
   568  };
   569  
   570  module.exports = SolidityTypeBool;
   571  
   572  },{"./formatters":9,"./type":14}],6:[function(require,module,exports){
   573  var f = require('./formatters');
   574  var SolidityType = require('./type');
   575  
   576  /**
   577   * SolidityTypeBytes 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 SolidityTypeBytes = function () {
   590      this._inputFormatter = f.formatInputBytes;
   591      this._outputFormatter = f.formatOutputBytes;
   592  };
   593  
   594  SolidityTypeBytes.prototype = new SolidityType({});
   595  SolidityTypeBytes.prototype.constructor = SolidityTypeBytes;
   596  
   597  SolidityTypeBytes.prototype.isType = function (name) {
   598      return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
   599  };
   600  
   601  module.exports = SolidityTypeBytes;
   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 SolidityTypeAddress = require('./address');
   629  var SolidityTypeBool = require('./bool');
   630  var SolidityTypeInt = require('./int');
   631  var SolidityTypeUInt = require('./uint');
   632  var SolidityTypeDynamicBytes = require('./dynamicbytes');
   633  var SolidityTypeString = require('./string');
   634  var SolidityTypeReal = require('./real');
   635  var SolidityTypeUReal = require('./ureal');
   636  var SolidityTypeBytes = require('./bytes');
   637  
   638  var isDynamic = function (solidityType, type) {
   639     return solidityType.isDynamicType(type) ||
   640            solidityType.isDynamicArray(type);
   641  };
   642  
   643  /**
   644   * SolidityCoder prototype should be used to encode/decode solidity params of any type
   645   */
   646  var SolidityCoder = function (types) {
   647      this._types = types;
   648  };
   649  
   650  /**
   651   * This method should be used to transform type to SolidityType
   652   *
   653   * @method _requireType
   654   * @param {String} type
   655   * @returns {SolidityType}
   656   * @throws {Error} throws if no matching type is found
   657   */
   658  SolidityCoder.prototype._requireType = function (type) {
   659      var solidityType = this._types.filter(function (t) {
   660          return t.isType(type);
   661      })[0];
   662  
   663      if (!solidityType) {
   664          throw Error('invalid solidity type!: ' + type);
   665      }
   666  
   667      return solidityType;
   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  SolidityCoder.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  SolidityCoder.prototype.encodeParams = function (types, params) {
   691      var solidityTypes = this.getSolidityTypes(types);
   692  
   693      var encodeds = solidityTypes.map(function (solidityType, index) {
   694          return solidityType.encode(params[index], types[index]);
   695      });
   696  
   697      var dynamicOffset = solidityTypes.reduce(function (acc, solidityType, index) {
   698          var staticPartLength = solidityType.staticPartLength(types[index]);
   699          var roundedStaticPartLength = Math.floor((staticPartLength + 31) / 32) * 32;
   700  
   701          return acc + (isDynamic(solidityTypes[index], types[index]) ?
   702              32 :
   703              roundedStaticPartLength);
   704      }, 0);
   705  
   706      var result = this.encodeMultiWithOffset(types, solidityTypes, encodeds, dynamicOffset);
   707  
   708      return result;
   709  };
   710  
   711  SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes, encodeds, dynamicOffset) {
   712      var result = "";
   713      var self = this;
   714  
   715      types.forEach(function (type, i) {
   716          if (isDynamic(solidityTypes[i], types[i])) {
   717              result += f.formatInputInt(dynamicOffset).encode();
   718              var e = self.encodeWithOffset(types[i], solidityTypes[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], solidityTypes[i], encodeds[i], dynamicOffset);
   723          }
   724  
   725          // TODO: figure out nested arrays
   726      });
   727  
   728      types.forEach(function (type, i) {
   729          if (isDynamic(solidityTypes[i], types[i])) {
   730              var e = self.encodeWithOffset(types[i], solidityTypes[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  SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) {
   740      var self = this;
   741      if (solidityType.isDynamicArray(type)) {
   742          return (function () {
   743              // offset was already set
   744              var nestedName = solidityType.nestedName(type);
   745              var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
   746              var result = encoded[0];
   747  
   748              (function () {
   749                  var previousLength = 2; // in int
   750                  if (solidityType.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, solidityType, encoded[i + 1], offset +  additionalOffset);
   763                  }
   764              })();
   765  
   766              return result;
   767          })();
   768  
   769      } else if (solidityType.isStaticArray(type)) {
   770          return (function () {
   771              var nestedName = solidityType.nestedName(type);
   772              var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
   773              var result = "";
   774  
   775  
   776              if (solidityType.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, solidityType, 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  SolidityCoder.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  SolidityCoder.prototype.decodeParams = function (types, bytes) {
   822      var solidityTypes = this.getSolidityTypes(types);
   823      var offsets = this.getOffsets(types, solidityTypes);
   824  
   825      return solidityTypes.map(function (solidityType, index) {
   826          return solidityType.decode(bytes, offsets[index],  types[index], index);
   827      });
   828  };
   829  
   830  SolidityCoder.prototype.getOffsets = function (types, solidityTypes) {
   831      var lengths =  solidityTypes.map(function (solidityType, index) {
   832          return solidityType.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 = solidityTypes[index].staticPartLength(types[index]);
   843          return length - staticPartLength;
   844      });
   845  };
   846  
   847  SolidityCoder.prototype.getSolidityTypes = function (types) {
   848      var self = this;
   849      return types.map(function (type) {
   850          return self._requireType(type);
   851      });
   852  };
   853  
   854  var coder = new SolidityCoder([
   855      new SolidityTypeAddress(),
   856      new SolidityTypeBool(),
   857      new SolidityTypeInt(),
   858      new SolidityTypeUInt(),
   859      new SolidityTypeDynamicBytes(),
   860      new SolidityTypeBytes(),
   861      new SolidityTypeString(),
   862      new SolidityTypeReal(),
   863      new SolidityTypeUReal()
   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 SolidityType = require('./type');
   871  
   872  var SolidityTypeDynamicBytes = function () {
   873      this._inputFormatter = f.formatInputDynamicBytes;
   874      this._outputFormatter = f.formatOutputDynamicBytes;
   875  };
   876  
   877  SolidityTypeDynamicBytes.prototype = new SolidityType({});
   878  SolidityTypeDynamicBytes.prototype.constructor = SolidityTypeDynamicBytes;
   879  
   880  SolidityTypeDynamicBytes.prototype.isType = function (name) {
   881      return !!name.match(/^bytes(\[([0-9]*)\])*$/);
   882  };
   883  
   884  SolidityTypeDynamicBytes.prototype.isDynamicType = function () {
   885      return true;
   886  };
   887  
   888  module.exports = SolidityTypeDynamicBytes;
   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 SolidityParam = 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 {SolidityParam}
   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 SolidityParam(result);
   932  };
   933  
   934  /**
   935   * Formats input bytes
   936   *
   937   * @method formatInputBytes
   938   * @param {String}
   939   * @returns {SolidityParam}
   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 SolidityParam(result);
   946  };
   947  
   948  /**
   949   * Formats input bytes
   950   *
   951   * @method formatDynamicInputBytes
   952   * @param {String}
   953   * @returns {SolidityParam}
   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 SolidityParam(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 {SolidityParam}
   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 SolidityParam(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 {SolidityParam}
   984   */
   985  var formatInputBool = function (value) {
   986      var result = '000000000000000000000000000000000000000000000000000000000000000' + (value ?  '1' : '0');
   987      return new SolidityParam(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 {SolidityParam}
   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 {SolidityParam} 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 {SolidityParam}
  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 {SolidityParam}
  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 {SolidityParam}
  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 {SolidityParam}
  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 {SolidityParam} 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 {SolidityParam} 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 {SolidityParam} 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 {SolidityParam} right-aligned input bytes
  1119   * @returns {String} address
  1120   */
  1121  var formatOutputAddress = function (param) {
  1122      var value = param.staticPart();
  1123      return "0x" + 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 SolidityType = require('./type');
  1147  
  1148  /**
  1149   * SolidityTypeInt is a prootype 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 SolidityTypeInt = function () {
  1165      this._inputFormatter = f.formatInputInt;
  1166      this._outputFormatter = f.formatOutputInt;
  1167  };
  1168  
  1169  SolidityTypeInt.prototype = new SolidityType({});
  1170  SolidityTypeInt.prototype.constructor = SolidityTypeInt;
  1171  
  1172  SolidityTypeInt.prototype.isType = function (name) {
  1173      return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/);
  1174  };
  1175  
  1176  module.exports = SolidityTypeInt;
  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   * SolidityParam object prototype.
  1205   * Should be used when encoding, decoding solidity bytes
  1206   */
  1207  var SolidityParam = 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  SolidityParam.prototype.dynamicPartLength = function () {
  1219      return this.dynamicPart().length / 2;
  1220  };
  1221  
  1222  /**
  1223   * This method should be used to create copy of solidity param with different offset
  1224   *
  1225   * @method withOffset
  1226   * @param {Number} offset length in bytes
  1227   * @returns {SolidityParam} new solidity param with applied offset
  1228   */
  1229  SolidityParam.prototype.withOffset = function (offset) {
  1230      return new SolidityParam(this.value, offset);
  1231  };
  1232  
  1233  /**
  1234   * This method should be used to combine solidity params together
  1235   * eg. when appending an array
  1236   *
  1237   * @method combine
  1238   * @param {SolidityParam} param with which we should combine
  1239   * @param {SolidityParam} result of combination
  1240   */
  1241  SolidityParam.prototype.combine = function (param) {
  1242      return new SolidityParam(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  SolidityParam.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  SolidityParam.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  SolidityParam.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  SolidityParam.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  SolidityParam.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[SolidityParam]} params
  1304   * @returns {String}
  1305   */
  1306  SolidityParam.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 = SolidityParam;
  1330  
  1331  
  1332  },{"../utils/utils":20}],12:[function(require,module,exports){
  1333  var f = require('./formatters');
  1334  var SolidityType = require('./type');
  1335  
  1336  /**
  1337   * SolidityTypeReal is a prootype 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 SolidityTypeReal = function () {
  1353      this._inputFormatter = f.formatInputReal;
  1354      this._outputFormatter = f.formatOutputReal;
  1355  };
  1356  
  1357  SolidityTypeReal.prototype = new SolidityType({});
  1358  SolidityTypeReal.prototype.constructor = SolidityTypeReal;
  1359  
  1360  SolidityTypeReal.prototype.isType = function (name) {
  1361      return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/);
  1362  };
  1363  
  1364  module.exports = SolidityTypeReal;
  1365  
  1366  },{"./formatters":9,"./type":14}],13:[function(require,module,exports){
  1367  var f = require('./formatters');
  1368  var SolidityType = require('./type');
  1369  
  1370  var SolidityTypeString = function () {
  1371      this._inputFormatter = f.formatInputString;
  1372      this._outputFormatter = f.formatOutputString;
  1373  };
  1374  
  1375  SolidityTypeString.prototype = new SolidityType({});
  1376  SolidityTypeString.prototype.constructor = SolidityTypeString;
  1377  
  1378  SolidityTypeString.prototype.isType = function (name) {
  1379      return !!name.match(/^string(\[([0-9]*)\])*$/);
  1380  };
  1381  
  1382  SolidityTypeString.prototype.isDynamicType = function () {
  1383      return true;
  1384  };
  1385  
  1386  module.exports = SolidityTypeString;
  1387  
  1388  },{"./formatters":9,"./type":14}],14:[function(require,module,exports){
  1389  var f = require('./formatters');
  1390  var SolidityParam = require('./param');
  1391  
  1392  /**
  1393   * SolidityType prototype is used to encode/decode solidity params of certain type
  1394   */
  1395  var SolidityType = function (config) {
  1396      this._inputFormatter = config.inputFormatter;
  1397      this._outputFormatter = config.outputFormatter;
  1398  };
  1399  
  1400  /**
  1401   * Should be used to determine if this SolidityType do match given name
  1402   *
  1403   * @method isType
  1404   * @param {String} name
  1405   * @return {Bool} true if type match this SolidityType, otherwise false
  1406   */
  1407  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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  SolidityType.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 SolidityParam(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 SolidityParam(bytes.substr(offset * 2, length * 2));
  1640      return this._outputFormatter(param, name);
  1641  };
  1642  
  1643  module.exports = SolidityType;
  1644  
  1645  },{"./formatters":9,"./param":11}],15:[function(require,module,exports){
  1646  var f = require('./formatters');
  1647  var SolidityType = require('./type');
  1648  
  1649  /**
  1650   * SolidityTypeUInt is a prootype 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 SolidityTypeUInt = function () {
  1666      this._inputFormatter = f.formatInputInt;
  1667      this._outputFormatter = f.formatOutputUInt;
  1668  };
  1669  
  1670  SolidityTypeUInt.prototype = new SolidityType({});
  1671  SolidityTypeUInt.prototype.constructor = SolidityTypeUInt;
  1672  
  1673  SolidityTypeUInt.prototype.isType = function (name) {
  1674      return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/);
  1675  };
  1676  
  1677  module.exports = SolidityTypeUInt;
  1678  
  1679  },{"./formatters":9,"./type":14}],16:[function(require,module,exports){
  1680  var f = require('./formatters');
  1681  var SolidityType = require('./type');
  1682  
  1683  /**
  1684   * SolidityTypeUReal is a prootype 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 SolidityTypeUReal = function () {
  1700      this._inputFormatter = f.formatInputReal;
  1701      this._outputFormatter = f.formatOutputUReal;
  1702  };
  1703  
  1704  SolidityTypeUReal.prototype = new SolidityType({});
  1705  SolidityTypeUReal.prototype.constructor = SolidityTypeUReal;
  1706  
  1707  SolidityTypeUReal.prototype.isType = function (name) {
  1708      return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/);
  1709  };
  1710  
  1711  module.exports = SolidityTypeUReal;
  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 /^0x[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 (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
  2250          // check if it has the basic requirements of an address
  2251          return false;
  2252      } else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) {
  2253          // If it's all small caps or all caps, return true
  2254          return true;
  2255      } else {
  2256          // Otherwise check each case
  2257          return isChecksumAddress(address);
  2258      }
  2259  };
  2260  
  2261  /**
  2262   * Checks if the given string is a checksummed address
  2263   *
  2264   * @method isChecksumAddress
  2265   * @param {String} address the given HEX address
  2266   * @return {Boolean}
  2267  */
  2268  var isChecksumAddress = function (address) {
  2269      // Check each case
  2270      address = address.replace('0x','');
  2271      var addressHash = sha3(address.toLowerCase());
  2272  
  2273      for (var i = 0; i < 40; i++ ) {
  2274          // the nth letter should be uppercase if the nth digit of casemap is 1
  2275          if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
  2276              return false;
  2277          }
  2278      }
  2279      return true;
  2280  };
  2281  
  2282  
  2283  
  2284  /**
  2285   * Makes a checksum address
  2286   *
  2287   * @method toChecksumAddress
  2288   * @param {String} address the given HEX address
  2289   * @return {String}
  2290  */
  2291  var toChecksumAddress = function (address) {
  2292      if (typeof address === 'undefined') return '';
  2293  
  2294      address = address.toLowerCase().replace('0x','');
  2295      var addressHash = sha3(address);
  2296      var checksumAddress = '0x';
  2297  
  2298      for (var i = 0; i < address.length; i++ ) {
  2299          // If ith character is 9 to f then make it uppercase
  2300          if (parseInt(addressHash[i], 16) > 7) {
  2301            checksumAddress += address[i].toUpperCase();
  2302          } else {
  2303              checksumAddress += address[i];
  2304          }
  2305      }
  2306      return checksumAddress;
  2307  };
  2308  
  2309  /**
  2310   * Transforms given string to valid 20 bytes-length addres with 0x prefix
  2311   *
  2312   * @method toAddress
  2313   * @param {String} address
  2314   * @return {String} formatted address
  2315   */
  2316  var toAddress = function (address) {
  2317      if (isStrictAddress(address)) {
  2318          return address;
  2319      }
  2320  
  2321      if (/^[0-9a-f]{40}$/.test(address)) {
  2322          return '0x' + address;
  2323      }
  2324  
  2325      return '0x' + padLeft(toHex(address).substr(2), 40);
  2326  };
  2327  
  2328  /**
  2329   * Returns true if object is BigNumber, otherwise false
  2330   *
  2331   * @method isBigNumber
  2332   * @param {Object}
  2333   * @return {Boolean}
  2334   */
  2335  var isBigNumber = function (object) {
  2336      return object instanceof BigNumber ||
  2337          (object && object.constructor && object.constructor.name === 'BigNumber');
  2338  };
  2339  
  2340  /**
  2341   * Returns true if object is string, otherwise false
  2342   *
  2343   * @method isString
  2344   * @param {Object}
  2345   * @return {Boolean}
  2346   */
  2347  var isString = function (object) {
  2348      return typeof object === 'string' ||
  2349          (object && object.constructor && object.constructor.name === 'String');
  2350  };
  2351  
  2352  /**
  2353   * Returns true if object is function, otherwise false
  2354   *
  2355   * @method isFunction
  2356   * @param {Object}
  2357   * @return {Boolean}
  2358   */
  2359  var isFunction = function (object) {
  2360      return typeof object === 'function';
  2361  };
  2362  
  2363  /**
  2364   * Returns true if object is Objet, otherwise false
  2365   *
  2366   * @method isObject
  2367   * @param {Object}
  2368   * @return {Boolean}
  2369   */
  2370  var isObject = function (object) {
  2371      return object !== null && !(object instanceof Array) && typeof object === 'object';
  2372  };
  2373  
  2374  /**
  2375   * Returns true if object is boolean, otherwise false
  2376   *
  2377   * @method isBoolean
  2378   * @param {Object}
  2379   * @return {Boolean}
  2380   */
  2381  var isBoolean = function (object) {
  2382      return typeof object === 'boolean';
  2383  };
  2384  
  2385  /**
  2386   * Returns true if object is array, otherwise false
  2387   *
  2388   * @method isArray
  2389   * @param {Object}
  2390   * @return {Boolean}
  2391   */
  2392  var isArray = function (object) {
  2393      return object instanceof Array;
  2394  };
  2395  
  2396  /**
  2397   * Returns true if given string is valid json object
  2398   *
  2399   * @method isJson
  2400   * @param {String}
  2401   * @return {Boolean}
  2402   */
  2403  var isJson = function (str) {
  2404      try {
  2405          return !!JSON.parse(str);
  2406      } catch (e) {
  2407          return false;
  2408      }
  2409  };
  2410  
  2411  /**
  2412   * Returns true if given string is a valid Ethereum block header bloom.
  2413   *
  2414   * @method isBloom
  2415   * @param {String} hex encoded bloom filter
  2416   * @return {Boolean}
  2417   */
  2418  var isBloom = function (bloom) {
  2419      if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) {
  2420          return false;
  2421      } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) {
  2422          return true;
  2423      }
  2424      return false;
  2425  };
  2426  
  2427  /**
  2428   * Returns true if given string is a valid log topic.
  2429   *
  2430   * @method isTopic
  2431   * @param {String} hex encoded topic
  2432   * @return {Boolean}
  2433   */
  2434  var isTopic = function (topic) {
  2435      if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) {
  2436          return false;
  2437      } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) {
  2438          return true;
  2439      }
  2440      return false;
  2441  };
  2442  
  2443  module.exports = {
  2444      padLeft: padLeft,
  2445      padRight: padRight,
  2446      toHex: toHex,
  2447      toDecimal: toDecimal,
  2448      fromDecimal: fromDecimal,
  2449      toUtf8: toUtf8,
  2450      toAscii: toAscii,
  2451      fromUtf8: fromUtf8,
  2452      fromAscii: fromAscii,
  2453      transformToFullName: transformToFullName,
  2454      extractDisplayName: extractDisplayName,
  2455      extractTypeName: extractTypeName,
  2456      toWei: toWei,
  2457      fromWei: fromWei,
  2458      toBigNumber: toBigNumber,
  2459      toTwosComplement: toTwosComplement,
  2460      toAddress: toAddress,
  2461      isBigNumber: isBigNumber,
  2462      isStrictAddress: isStrictAddress,
  2463      isAddress: isAddress,
  2464      isChecksumAddress: isChecksumAddress,
  2465      toChecksumAddress: toChecksumAddress,
  2466      isFunction: isFunction,
  2467      isString: isString,
  2468      isObject: isObject,
  2469      isBoolean: isBoolean,
  2470      isArray: isArray,
  2471      isJson: isJson,
  2472      isBloom: isBloom,
  2473      isTopic: isTopic,
  2474  };
  2475  
  2476  },{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":85}],21:[function(require,module,exports){
  2477  module.exports={
  2478      "version": "0.20.1"
  2479  }
  2480  
  2481  },{}],22:[function(require,module,exports){
  2482  /*
  2483      This file is part of web3.js.
  2484  
  2485      web3.js is free software: you can redistribute it and/or modify
  2486      it under the terms of the GNU Lesser General Public License as published by
  2487      the Free Software Foundation, either version 3 of the License, or
  2488      (at your option) any later version.
  2489  
  2490      web3.js is distributed in the hope that it will be useful,
  2491      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2492      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2493      GNU Lesser General Public License for more details.
  2494  
  2495      You should have received a copy of the GNU Lesser General Public License
  2496      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2497  */
  2498  /**
  2499   * @file web3.js
  2500   * @authors:
  2501   *   Jeffrey Wilcke <jeff@ethdev.com>
  2502   *   Marek Kotewicz <marek@ethdev.com>
  2503   *   Marian Oancea <marian@ethdev.com>
  2504   *   Fabian Vogelsteller <fabian@ethdev.com>
  2505   *   Gav Wood <g@ethdev.com>
  2506   * @date 2014
  2507   */
  2508  
  2509  var RequestManager = require('./web3/requestmanager');
  2510  var Iban = require('./web3/iban');
  2511  var Eth = require('./web3/methods/eth');
  2512  var DB = require('./web3/methods/db');
  2513  var Shh = require('./web3/methods/shh');
  2514  var Net = require('./web3/methods/net');
  2515  var Personal = require('./web3/methods/personal');
  2516  var Swarm = require('./web3/methods/swarm');
  2517  var Settings = require('./web3/settings');
  2518  var version = require('./version.json');
  2519  var utils = require('./utils/utils');
  2520  var sha3 = require('./utils/sha3');
  2521  var extend = require('./web3/extend');
  2522  var Batch = require('./web3/batch');
  2523  var Property = require('./web3/property');
  2524  var HttpProvider = require('./web3/httpprovider');
  2525  var IpcProvider = require('./web3/ipcprovider');
  2526  var BigNumber = require('bignumber.js');
  2527  
  2528  
  2529  
  2530  function Web3 (provider) {
  2531      this._requestManager = new RequestManager(provider);
  2532      this.currentProvider = provider;
  2533      this.eth = new Eth(this);
  2534      this.db = new DB(this);
  2535      this.shh = new Shh(this);
  2536      this.net = new Net(this);
  2537      this.personal = new Personal(this);
  2538      this.bzz = new Swarm(this);
  2539      this.settings = new Settings();
  2540      this.version = {
  2541          api: version.version
  2542      };
  2543      this.providers = {
  2544          HttpProvider: HttpProvider,
  2545          IpcProvider: IpcProvider
  2546      };
  2547      this._extend = extend(this);
  2548      this._extend({
  2549          properties: properties()
  2550      });
  2551  }
  2552  
  2553  // expose providers on the class
  2554  Web3.providers = {
  2555      HttpProvider: HttpProvider,
  2556      IpcProvider: IpcProvider
  2557  };
  2558  
  2559  Web3.prototype.setProvider = function (provider) {
  2560      this._requestManager.setProvider(provider);
  2561      this.currentProvider = provider;
  2562  };
  2563  
  2564  Web3.prototype.reset = function (keepIsSyncing) {
  2565      this._requestManager.reset(keepIsSyncing);
  2566      this.settings = new Settings();
  2567  };
  2568  
  2569  Web3.prototype.BigNumber = BigNumber;
  2570  Web3.prototype.toHex = utils.toHex;
  2571  Web3.prototype.toAscii = utils.toAscii;
  2572  Web3.prototype.toUtf8 = utils.toUtf8;
  2573  Web3.prototype.fromAscii = utils.fromAscii;
  2574  Web3.prototype.fromUtf8 = utils.fromUtf8;
  2575  Web3.prototype.toDecimal = utils.toDecimal;
  2576  Web3.prototype.fromDecimal = utils.fromDecimal;
  2577  Web3.prototype.toBigNumber = utils.toBigNumber;
  2578  Web3.prototype.toWei = utils.toWei;
  2579  Web3.prototype.fromWei = utils.fromWei;
  2580  Web3.prototype.isAddress = utils.isAddress;
  2581  Web3.prototype.isChecksumAddress = utils.isChecksumAddress;
  2582  Web3.prototype.toChecksumAddress = utils.toChecksumAddress;
  2583  Web3.prototype.isIBAN = utils.isIBAN;
  2584  Web3.prototype.padLeft = utils.padLeft;
  2585  Web3.prototype.padRight = utils.padRight;
  2586  
  2587  
  2588  Web3.prototype.sha3 = function(string, options) {
  2589      return '0x' + sha3(string, options);
  2590  };
  2591  
  2592  /**
  2593   * Transforms direct icap to address
  2594   */
  2595  Web3.prototype.fromICAP = function (icap) {
  2596      var iban = new Iban(icap);
  2597      return iban.address();
  2598  };
  2599  
  2600  var properties = function () {
  2601      return [
  2602          new Property({
  2603              name: 'version.node',
  2604              getter: 'web3_clientVersion'
  2605          }),
  2606          new Property({
  2607              name: 'version.network',
  2608              getter: 'net_version',
  2609              inputFormatter: utils.toDecimal
  2610          }),
  2611          new Property({
  2612              name: 'version.ethereum',
  2613              getter: 'eth_protocolVersion',
  2614              inputFormatter: utils.toDecimal
  2615          }),
  2616          new Property({
  2617              name: 'version.whisper',
  2618              getter: 'shh_version',
  2619              inputFormatter: utils.toDecimal
  2620          })
  2621      ];
  2622  };
  2623  
  2624  Web3.prototype.isConnected = function(){
  2625      return (this.currentProvider && this.currentProvider.isConnected());
  2626  };
  2627  
  2628  Web3.prototype.createBatch = function () {
  2629      return new Batch(this);
  2630  };
  2631  
  2632  module.exports = Web3;
  2633  
  2634  
  2635  },{"./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/eth":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){
  2636  /*
  2637      This file is part of web3.js.
  2638  
  2639      web3.js is free software: you can redistribute it and/or modify
  2640      it under the terms of the GNU Lesser General Public License as published by
  2641      the Free Software Foundation, either version 3 of the License, or
  2642      (at your option) any later version.
  2643  
  2644      web3.js is distributed in the hope that it will be useful,
  2645      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2646      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2647      GNU Lesser General Public License for more details.
  2648  
  2649      You should have received a copy of the GNU Lesser General Public License
  2650      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2651  */
  2652  /**
  2653   * @file allevents.js
  2654   * @author Marek Kotewicz <marek@ethdev.com>
  2655   * @date 2014
  2656   */
  2657  
  2658  var sha3 = require('../utils/sha3');
  2659  var SolidityEvent = require('./event');
  2660  var formatters = require('./formatters');
  2661  var utils = require('../utils/utils');
  2662  var Filter = require('./filter');
  2663  var watches = require('./methods/watches');
  2664  
  2665  var AllSolidityEvents = function (requestManager, json, address) {
  2666      this._requestManager = requestManager;
  2667      this._json = json;
  2668      this._address = address;
  2669  };
  2670  
  2671  AllSolidityEvents.prototype.encode = function (options) {
  2672      options = options || {};
  2673      var result = {};
  2674  
  2675      ['fromBlock', 'toBlock'].filter(function (f) {
  2676          return options[f] !== undefined;
  2677      }).forEach(function (f) {
  2678          result[f] = formatters.inputBlockNumberFormatter(options[f]);
  2679      });
  2680  
  2681      result.address = this._address;
  2682  
  2683      return result;
  2684  };
  2685  
  2686  AllSolidityEvents.prototype.decode = function (data) {
  2687      data.data = data.data || '';
  2688      data.topics = data.topics || [];
  2689  
  2690      var eventTopic = data.topics[0].slice(2);
  2691      var match = this._json.filter(function (j) {
  2692          return eventTopic === sha3(utils.transformToFullName(j));
  2693      })[0];
  2694  
  2695      if (!match) { // cannot find matching event?
  2696          console.warn('cannot find event for log');
  2697          return data;
  2698      }
  2699  
  2700      var event = new SolidityEvent(this._requestManager, match, this._address);
  2701      return event.decode(data);
  2702  };
  2703  
  2704  AllSolidityEvents.prototype.execute = function (options, callback) {
  2705  
  2706      if (utils.isFunction(arguments[arguments.length - 1])) {
  2707          callback = arguments[arguments.length - 1];
  2708          if(arguments.length === 1)
  2709              options = null;
  2710      }
  2711  
  2712      var o = this.encode(options);
  2713      var formatter = this.decode.bind(this);
  2714      return new Filter(o, 'eth', this._requestManager, watches.eth(), formatter, callback);
  2715  };
  2716  
  2717  AllSolidityEvents.prototype.attachToContract = function (contract) {
  2718      var execute = this.execute.bind(this);
  2719      contract.allEvents = execute;
  2720  };
  2721  
  2722  module.exports = AllSolidityEvents;
  2723  
  2724  
  2725  },{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":43}],24:[function(require,module,exports){
  2726  /*
  2727      This file is part of web3.js.
  2728  
  2729      web3.js is free software: you can redistribute it and/or modify
  2730      it under the terms of the GNU Lesser General Public License as published by
  2731      the Free Software Foundation, either version 3 of the License, or
  2732      (at your option) any later version.
  2733  
  2734      web3.js is distributed in the hope that it will be useful,
  2735      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2736      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2737      GNU Lesser General Public License for more details.
  2738  
  2739      You should have received a copy of the GNU Lesser General Public License
  2740      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2741  */
  2742  /** 
  2743   * @file batch.js
  2744   * @author Marek Kotewicz <marek@ethdev.com>
  2745   * @date 2015
  2746   */
  2747  
  2748  var Jsonrpc = require('./jsonrpc');
  2749  var errors = require('./errors');
  2750  
  2751  var Batch = function (web3) {
  2752      this.requestManager = web3._requestManager;
  2753      this.requests = [];
  2754  };
  2755  
  2756  /**
  2757   * Should be called to add create new request to batch request
  2758   *
  2759   * @method add
  2760   * @param {Object} jsonrpc requet object
  2761   */
  2762  Batch.prototype.add = function (request) {
  2763      this.requests.push(request);
  2764  };
  2765  
  2766  /**
  2767   * Should be called to execute batch request
  2768   *
  2769   * @method execute
  2770   */
  2771  Batch.prototype.execute = function () {
  2772      var requests = this.requests;
  2773      this.requestManager.sendBatch(requests, function (err, results) {
  2774          results = results || [];
  2775          requests.map(function (request, index) {
  2776              return results[index] || {};
  2777          }).forEach(function (result, index) {
  2778              if (requests[index].callback) {
  2779  
  2780                  if (!Jsonrpc.isValidResponse(result)) {
  2781                      return requests[index].callback(errors.InvalidResponse(result));
  2782                  }
  2783  
  2784                  requests[index].callback(null, (requests[index].format ? requests[index].format(result.result) : result.result));
  2785              }
  2786          });
  2787      }); 
  2788  };
  2789  
  2790  module.exports = Batch;
  2791  
  2792  
  2793  },{"./errors":26,"./jsonrpc":35}],25:[function(require,module,exports){
  2794  /*
  2795      This file is part of web3.js.
  2796  
  2797      web3.js is free software: you can redistribute it and/or modify
  2798      it under the terms of the GNU Lesser General Public License as published by
  2799      the Free Software Foundation, either version 3 of the License, or
  2800      (at your option) any later version.
  2801  
  2802      web3.js is distributed in the hope that it will be useful,
  2803      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2804      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2805      GNU Lesser General Public License for more details.
  2806  
  2807      You should have received a copy of the GNU Lesser General Public License
  2808      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2809  */
  2810  /**
  2811   * @file contract.js
  2812   * @author Marek Kotewicz <marek@ethdev.com>
  2813   * @date 2014
  2814   */
  2815  
  2816  var utils = require('../utils/utils');
  2817  var coder = require('../solidity/coder');
  2818  var SolidityEvent = require('./event');
  2819  var SolidityFunction = require('./function');
  2820  var AllEvents = require('./allevents');
  2821  
  2822  /**
  2823   * Should be called to encode constructor params
  2824   *
  2825   * @method encodeConstructorParams
  2826   * @param {Array} abi
  2827   * @param {Array} constructor params
  2828   */
  2829  var encodeConstructorParams = function (abi, params) {
  2830      return abi.filter(function (json) {
  2831          return json.type === 'constructor' && json.inputs.length === params.length;
  2832      }).map(function (json) {
  2833          return json.inputs.map(function (input) {
  2834              return input.type;
  2835          });
  2836      }).map(function (types) {
  2837          return coder.encodeParams(types, params);
  2838      })[0] || '';
  2839  };
  2840  
  2841  /**
  2842   * Should be called to add functions to contract object
  2843   *
  2844   * @method addFunctionsToContract
  2845   * @param {Contract} contract
  2846   * @param {Array} abi
  2847   */
  2848  var addFunctionsToContract = function (contract) {
  2849      contract.abi.filter(function (json) {
  2850          return json.type === 'function';
  2851      }).map(function (json) {
  2852          return new SolidityFunction(contract._eth, json, contract.address);
  2853      }).forEach(function (f) {
  2854          f.attachToContract(contract);
  2855      });
  2856  };
  2857  
  2858  /**
  2859   * Should be called to add events to contract object
  2860   *
  2861   * @method addEventsToContract
  2862   * @param {Contract} contract
  2863   * @param {Array} abi
  2864   */
  2865  var addEventsToContract = function (contract) {
  2866      var events = contract.abi.filter(function (json) {
  2867          return json.type === 'event';
  2868      });
  2869  
  2870      var All = new AllEvents(contract._eth._requestManager, events, contract.address);
  2871      All.attachToContract(contract);
  2872  
  2873      events.map(function (json) {
  2874          return new SolidityEvent(contract._eth._requestManager, json, contract.address);
  2875      }).forEach(function (e) {
  2876          e.attachToContract(contract);
  2877      });
  2878  };
  2879  
  2880  
  2881  /**
  2882   * Should be called to check if the contract gets properly deployed on the blockchain.
  2883   *
  2884   * @method checkForContractAddress
  2885   * @param {Object} contract
  2886   * @param {Function} callback
  2887   * @returns {Undefined}
  2888   */
  2889  var checkForContractAddress = function(contract, callback){
  2890      var count = 0,
  2891          callbackFired = false;
  2892  
  2893      // wait for receipt
  2894      var filter = contract._eth.filter('latest', function(e){
  2895          if (!e && !callbackFired) {
  2896              count++;
  2897  
  2898              // stop watching after 50 blocks (timeout)
  2899              if (count > 50) {
  2900  
  2901                  filter.stopWatching(function() {});
  2902                  callbackFired = true;
  2903  
  2904                  if (callback)
  2905                      callback(new Error('Contract transaction couldn\'t be found after 50 blocks'));
  2906                  else
  2907                      throw new Error('Contract transaction couldn\'t be found after 50 blocks');
  2908  
  2909  
  2910              } else {
  2911  
  2912                  contract._eth.getTransactionReceipt(contract.transactionHash, function(e, receipt){
  2913                      if(receipt && !callbackFired) {
  2914  
  2915                          contract._eth.getCode(receipt.contractAddress, function(e, code){
  2916                              /*jshint maxcomplexity: 6 */
  2917  
  2918                              if(callbackFired || !code)
  2919                                  return;
  2920  
  2921                              filter.stopWatching(function() {});
  2922                              callbackFired = true;
  2923  
  2924                              if(code.length > 3) {
  2925  
  2926                                  // console.log('Contract code deployed!');
  2927  
  2928                                  contract.address = receipt.contractAddress;
  2929  
  2930                                  // attach events and methods again after we have
  2931                                  addFunctionsToContract(contract);
  2932                                  addEventsToContract(contract);
  2933  
  2934                                  // call callback for the second time
  2935                                  if(callback)
  2936                                      callback(null, contract);
  2937  
  2938                              } else {
  2939                                  if(callback)
  2940                                      callback(new Error('The contract code couldn\'t be stored, please check your gas amount.'));
  2941                                  else
  2942                                      throw new Error('The contract code couldn\'t be stored, please check your gas amount.');
  2943                              }
  2944                          });
  2945                      }
  2946                  });
  2947              }
  2948          }
  2949      });
  2950  };
  2951  
  2952  /**
  2953   * Should be called to create new ContractFactory instance
  2954   *
  2955   * @method ContractFactory
  2956   * @param {Array} abi
  2957   */
  2958  var ContractFactory = function (eth, abi) {
  2959      this.eth = eth;
  2960      this.abi = abi;
  2961  
  2962      /**
  2963       * Should be called to create new contract on a blockchain
  2964       *
  2965       * @method new
  2966       * @param {Any} contract constructor param1 (optional)
  2967       * @param {Any} contract constructor param2 (optional)
  2968       * @param {Object} contract transaction object (required)
  2969       * @param {Function} callback
  2970       * @returns {Contract} returns contract instance
  2971       */
  2972      this.new = function () {
  2973          /*jshint maxcomplexity: 7 */
  2974          
  2975          var contract = new Contract(this.eth, this.abi);
  2976  
  2977          // parse arguments
  2978          var options = {}; // required!
  2979          var callback;
  2980  
  2981          var args = Array.prototype.slice.call(arguments);
  2982          if (utils.isFunction(args[args.length - 1])) {
  2983              callback = args.pop();
  2984          }
  2985  
  2986          var last = args[args.length - 1];
  2987          if (utils.isObject(last) && !utils.isArray(last)) {
  2988              options = args.pop();
  2989          }
  2990  
  2991          if (options.value > 0) {
  2992              var constructorAbi = abi.filter(function (json) {
  2993                  return json.type === 'constructor' && json.inputs.length === args.length;
  2994              })[0] || {};
  2995  
  2996              if (!constructorAbi.payable) {
  2997                  throw new Error('Cannot send value to non-payable constructor');
  2998              }
  2999          }
  3000  
  3001          var bytes = encodeConstructorParams(this.abi, args);
  3002          options.data += bytes;
  3003  
  3004          if (callback) {
  3005  
  3006              // wait for the contract address and check if the code was deployed
  3007              this.eth.sendTransaction(options, function (err, hash) {
  3008                  if (err) {
  3009                      callback(err);
  3010                  } else {
  3011                      // add the transaction hash
  3012                      contract.transactionHash = hash;
  3013  
  3014                      // call callback for the first time
  3015                      callback(null, contract);
  3016  
  3017                      checkForContractAddress(contract, callback);
  3018                  }
  3019              });
  3020          } else {
  3021              var hash = this.eth.sendTransaction(options);
  3022              // add the transaction hash
  3023              contract.transactionHash = hash;
  3024              checkForContractAddress(contract);
  3025          }
  3026  
  3027          return contract;
  3028      };
  3029  
  3030      this.new.getData = this.getData.bind(this);
  3031  };
  3032  
  3033  /**
  3034   * Should be called to create new ContractFactory
  3035   *
  3036   * @method contract
  3037   * @param {Array} abi
  3038   * @returns {ContractFactory} new contract factory
  3039   */
  3040  //var contract = function (abi) {
  3041      //return new ContractFactory(abi);
  3042  //};
  3043  
  3044  
  3045  
  3046  /**
  3047   * Should be called to get access to existing contract on a blockchain
  3048   *
  3049   * @method at
  3050   * @param {Address} contract address (required)
  3051   * @param {Function} callback {optional)
  3052   * @returns {Contract} returns contract if no callback was passed,
  3053   * otherwise calls callback function (err, contract)
  3054   */
  3055  ContractFactory.prototype.at = function (address, callback) {
  3056      var contract = new Contract(this.eth, this.abi, address);
  3057  
  3058      // this functions are not part of prototype,
  3059      // because we don't want to spoil the interface
  3060      addFunctionsToContract(contract);
  3061      addEventsToContract(contract);
  3062  
  3063      if (callback) {
  3064          callback(null, contract);
  3065      }
  3066      return contract;
  3067  };
  3068  
  3069  /**
  3070   * Gets the data, which is data to deploy plus constructor params
  3071   *
  3072   * @method getData
  3073   */
  3074  ContractFactory.prototype.getData = function () {
  3075      var options = {}; // required!
  3076      var args = Array.prototype.slice.call(arguments);
  3077  
  3078      var last = args[args.length - 1];
  3079      if (utils.isObject(last) && !utils.isArray(last)) {
  3080          options = args.pop();
  3081      }
  3082  
  3083      var bytes = encodeConstructorParams(this.abi, args);
  3084      options.data += bytes;
  3085  
  3086      return options.data;
  3087  };
  3088  
  3089  /**
  3090   * Should be called to create new contract instance
  3091   *
  3092   * @method Contract
  3093   * @param {Array} abi
  3094   * @param {Address} contract address
  3095   */
  3096  var Contract = function (eth, abi, address) {
  3097      this._eth = eth;
  3098      this.transactionHash = null;
  3099      this.address = address;
  3100      this.abi = abi;
  3101  };
  3102  
  3103  module.exports = ContractFactory;
  3104  
  3105  },{"../solidity/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(require,module,exports){
  3106  /*
  3107      This file is part of web3.js.
  3108  
  3109      web3.js is free software: you can redistribute it and/or modify
  3110      it under the terms of the GNU Lesser General Public License as published by
  3111      the Free Software Foundation, either version 3 of the License, or
  3112      (at your option) any later version.
  3113  
  3114      web3.js is distributed in the hope that it will be useful,
  3115      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3116      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3117      GNU Lesser General Public License for more details.
  3118  
  3119      You should have received a copy of the GNU Lesser General Public License
  3120      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3121  */
  3122  /** 
  3123   * @file errors.js
  3124   * @author Marek Kotewicz <marek@ethdev.com>
  3125   * @date 2015
  3126   */
  3127  
  3128  module.exports = {
  3129      InvalidNumberOfSolidityArgs: function () {
  3130          return new Error('Invalid number of arguments to Solidity function');
  3131      },
  3132      InvalidNumberOfRPCParams: function () {
  3133          return new Error('Invalid number of input parameters to RPC method');
  3134      },
  3135      InvalidConnection: function (host){
  3136          return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.');
  3137      },
  3138      InvalidProvider: function () {
  3139          return new Error('Provider not set or invalid');
  3140      },
  3141      InvalidResponse: function (result){
  3142          var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result);
  3143          return new Error(message);
  3144      },
  3145      ConnectionTimeout: function (ms){
  3146          return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived');
  3147      }
  3148  };
  3149  
  3150  },{}],27:[function(require,module,exports){
  3151  /*
  3152      This file is part of web3.js.
  3153  
  3154      web3.js is free software: you can redistribute it and/or modify
  3155      it under the terms of the GNU Lesser General Public License as published by
  3156      the Free Software Foundation, either version 3 of the License, or
  3157      (at your option) any later version.
  3158  
  3159      web3.js is distributed in the hope that it will be useful,
  3160      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3161      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3162      GNU Lesser General Public License for more details.
  3163  
  3164      You should have received a copy of the GNU Lesser General Public License
  3165      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3166  */
  3167  /**
  3168   * @file event.js
  3169   * @author Marek Kotewicz <marek@ethdev.com>
  3170   * @date 2014
  3171   */
  3172  
  3173  var utils = require('../utils/utils');
  3174  var coder = require('../solidity/coder');
  3175  var formatters = require('./formatters');
  3176  var sha3 = require('../utils/sha3');
  3177  var Filter = require('./filter');
  3178  var watches = require('./methods/watches');
  3179  
  3180  /**
  3181   * This prototype should be used to create event filters
  3182   */
  3183  var SolidityEvent = function (requestManager, json, address) {
  3184      this._requestManager = requestManager;
  3185      this._params = json.inputs;
  3186      this._name = utils.transformToFullName(json);
  3187      this._address = address;
  3188      this._anonymous = json.anonymous;
  3189  };
  3190  
  3191  /**
  3192   * Should be used to get filtered param types
  3193   *
  3194   * @method types
  3195   * @param {Bool} decide if returned typed should be indexed
  3196   * @return {Array} array of types
  3197   */
  3198  SolidityEvent.prototype.types = function (indexed) {
  3199      return this._params.filter(function (i) {
  3200          return i.indexed === indexed;
  3201      }).map(function (i) {
  3202          return i.type;
  3203      });
  3204  };
  3205  
  3206  /**
  3207   * Should be used to get event display name
  3208   *
  3209   * @method displayName
  3210   * @return {String} event display name
  3211   */
  3212  SolidityEvent.prototype.displayName = function () {
  3213      return utils.extractDisplayName(this._name);
  3214  };
  3215  
  3216  /**
  3217   * Should be used to get event type name
  3218   *
  3219   * @method typeName
  3220   * @return {String} event type name
  3221   */
  3222  SolidityEvent.prototype.typeName = function () {
  3223      return utils.extractTypeName(this._name);
  3224  };
  3225  
  3226  /**
  3227   * Should be used to get event signature
  3228   *
  3229   * @method signature
  3230   * @return {String} event signature
  3231   */
  3232  SolidityEvent.prototype.signature = function () {
  3233      return sha3(this._name);
  3234  };
  3235  
  3236  /**
  3237   * Should be used to encode indexed params and options to one final object
  3238   *
  3239   * @method encode
  3240   * @param {Object} indexed
  3241   * @param {Object} options
  3242   * @return {Object} everything combined together and encoded
  3243   */
  3244  SolidityEvent.prototype.encode = function (indexed, options) {
  3245      indexed = indexed || {};
  3246      options = options || {};
  3247      var result = {};
  3248  
  3249      ['fromBlock', 'toBlock'].filter(function (f) {
  3250          return options[f] !== undefined;
  3251      }).forEach(function (f) {
  3252          result[f] = formatters.inputBlockNumberFormatter(options[f]);
  3253      });
  3254  
  3255      result.topics = [];
  3256  
  3257      result.address = this._address;
  3258      if (!this._anonymous) {
  3259          result.topics.push('0x' + this.signature());
  3260      }
  3261  
  3262      var indexedTopics = this._params.filter(function (i) {
  3263          return i.indexed === true;
  3264      }).map(function (i) {
  3265          var value = indexed[i.name];
  3266          if (value === undefined || value === null) {
  3267              return null;
  3268          }
  3269  
  3270          if (utils.isArray(value)) {
  3271              return value.map(function (v) {
  3272                  return '0x' + coder.encodeParam(i.type, v);
  3273              });
  3274          }
  3275          return '0x' + coder.encodeParam(i.type, value);
  3276      });
  3277  
  3278      result.topics = result.topics.concat(indexedTopics);
  3279  
  3280      return result;
  3281  };
  3282  
  3283  /**
  3284   * Should be used to decode indexed params and options
  3285   *
  3286   * @method decode
  3287   * @param {Object} data
  3288   * @return {Object} result object with decoded indexed && not indexed params
  3289   */
  3290  SolidityEvent.prototype.decode = function (data) {
  3291  
  3292      data.data = data.data || '';
  3293      data.topics = data.topics || [];
  3294  
  3295      var argTopics = this._anonymous ? data.topics : data.topics.slice(1);
  3296      var indexedData = argTopics.map(function (topics) { return topics.slice(2); }).join("");
  3297      var indexedParams = coder.decodeParams(this.types(true), indexedData);
  3298  
  3299      var notIndexedData = data.data.slice(2);
  3300      var notIndexedParams = coder.decodeParams(this.types(false), notIndexedData);
  3301  
  3302      var result = formatters.outputLogFormatter(data);
  3303      result.event = this.displayName();
  3304      result.address = data.address;
  3305  
  3306      result.args = this._params.reduce(function (acc, current) {
  3307          acc[current.name] = current.indexed ? indexedParams.shift() : notIndexedParams.shift();
  3308          return acc;
  3309      }, {});
  3310  
  3311      delete result.data;
  3312      delete result.topics;
  3313  
  3314      return result;
  3315  };
  3316  
  3317  /**
  3318   * Should be used to create new filter object from event
  3319   *
  3320   * @method execute
  3321   * @param {Object} indexed
  3322   * @param {Object} options
  3323   * @return {Object} filter object
  3324   */
  3325  SolidityEvent.prototype.execute = function (indexed, options, callback) {
  3326  
  3327      if (utils.isFunction(arguments[arguments.length - 1])) {
  3328          callback = arguments[arguments.length - 1];
  3329          if(arguments.length === 2)
  3330              options = null;
  3331          if(arguments.length === 1) {
  3332              options = null;
  3333              indexed = {};
  3334          }
  3335      }
  3336  
  3337      var o = this.encode(indexed, options);
  3338      var formatter = this.decode.bind(this);
  3339      return new Filter(o, 'eth', this._requestManager, watches.eth(), formatter, callback);
  3340  };
  3341  
  3342  /**
  3343   * Should be used to attach event to contract object
  3344   *
  3345   * @method attachToContract
  3346   * @param {Contract}
  3347   */
  3348  SolidityEvent.prototype.attachToContract = function (contract) {
  3349      var execute = this.execute.bind(this);
  3350      var displayName = this.displayName();
  3351      if (!contract[displayName]) {
  3352          contract[displayName] = execute;
  3353      }
  3354      contract[displayName][this.typeName()] = this.execute.bind(this, contract);
  3355  };
  3356  
  3357  module.exports = SolidityEvent;
  3358  
  3359  
  3360  },{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":43}],28:[function(require,module,exports){
  3361  var formatters = require('./formatters');
  3362  var utils = require('./../utils/utils');
  3363  var Method = require('./method');
  3364  var Property = require('./property');
  3365  
  3366  // TODO: refactor, so the input params are not altered.
  3367  // it's necessary to make same 'extension' work with multiple providers
  3368  var extend = function (web3) {
  3369      /* jshint maxcomplexity:5 */
  3370      var ex = function (extension) {
  3371  
  3372          var extendedObject;
  3373          if (extension.property) {
  3374              if (!web3[extension.property]) {
  3375                  web3[extension.property] = {};
  3376              }
  3377              extendedObject = web3[extension.property];
  3378          } else {
  3379              extendedObject = web3;
  3380          }
  3381  
  3382          if (extension.methods) {
  3383              extension.methods.forEach(function (method) {
  3384                  method.attachToObject(extendedObject);
  3385                  method.setRequestManager(web3._requestManager);
  3386              });
  3387          }
  3388  
  3389          if (extension.properties) {
  3390              extension.properties.forEach(function (property) {
  3391                  property.attachToObject(extendedObject);
  3392                  property.setRequestManager(web3._requestManager);
  3393              });
  3394          }
  3395      };
  3396  
  3397      ex.formatters = formatters; 
  3398      ex.utils = utils;
  3399      ex.Method = Method;
  3400      ex.Property = Property;
  3401  
  3402      return ex;
  3403  };
  3404  
  3405  
  3406  
  3407  module.exports = extend;
  3408  
  3409  
  3410  },{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(require,module,exports){
  3411  /*
  3412      This file is part of web3.js.
  3413  
  3414      web3.js is free software: you can redistribute it and/or modify
  3415      it under the terms of the GNU Lesser General Public License as published by
  3416      the Free Software Foundation, either version 3 of the License, or
  3417      (at your option) any later version.
  3418  
  3419      web3.js is distributed in the hope that it will be useful,
  3420      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3421      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3422      GNU Lesser General Public License for more details.
  3423  
  3424      You should have received a copy of the GNU Lesser General Public License
  3425      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3426  */
  3427  /** @file filter.js
  3428   * @authors:
  3429   *   Jeffrey Wilcke <jeff@ethdev.com>
  3430   *   Marek Kotewicz <marek@ethdev.com>
  3431   *   Marian Oancea <marian@ethdev.com>
  3432   *   Fabian Vogelsteller <fabian@ethdev.com>
  3433   *   Gav Wood <g@ethdev.com>
  3434   * @date 2014
  3435   */
  3436  
  3437  var formatters = require('./formatters');
  3438  var utils = require('../utils/utils');
  3439  
  3440  /**
  3441  * Converts a given topic to a hex string, but also allows null values.
  3442  *
  3443  * @param {Mixed} value
  3444  * @return {String}
  3445  */
  3446  var toTopic = function(value){
  3447  
  3448      if(value === null || typeof value === 'undefined')
  3449          return null;
  3450  
  3451      value = String(value);
  3452  
  3453      if(value.indexOf('0x') === 0)
  3454          return value;
  3455      else
  3456          return utils.fromUtf8(value);
  3457  };
  3458  
  3459  /// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones
  3460  /// @param should be string or object
  3461  /// @returns options string or object
  3462  var getOptions = function (options, type) {
  3463      /*jshint maxcomplexity: 6 */
  3464  
  3465      if (utils.isString(options)) {
  3466          return options;
  3467      }
  3468  
  3469      options = options || {};
  3470  
  3471  
  3472      switch(type) {
  3473          case 'eth':
  3474  
  3475              // make sure topics, get converted to hex
  3476              options.topics = options.topics || [];
  3477              options.topics = options.topics.map(function(topic){
  3478                  return (utils.isArray(topic)) ? topic.map(toTopic) : toTopic(topic);
  3479              });
  3480  
  3481              return {
  3482                  topics: options.topics,
  3483                  from: options.from,
  3484                  to: options.to,
  3485                  address: options.address,
  3486                  fromBlock: formatters.inputBlockNumberFormatter(options.fromBlock),
  3487                  toBlock: formatters.inputBlockNumberFormatter(options.toBlock)
  3488              };
  3489          case 'shh':
  3490              return options;
  3491      }
  3492  };
  3493  
  3494  /**
  3495  Adds the callback and sets up the methods, to iterate over the results.
  3496  
  3497  @method getLogsAtStart
  3498  @param {Object} self
  3499  @param {function} callback
  3500  */
  3501  var getLogsAtStart = function(self, callback){
  3502      // call getFilterLogs for the first watch callback start
  3503      if (!utils.isString(self.options)) {
  3504          self.get(function (err, messages) {
  3505              // don't send all the responses to all the watches again... just to self one
  3506              if (err) {
  3507                  callback(err);
  3508              }
  3509  
  3510              if(utils.isArray(messages)) {
  3511                  messages.forEach(function (message) {
  3512                      callback(null, message);
  3513                  });
  3514              }
  3515          });
  3516      }
  3517  };
  3518  
  3519  /**
  3520  Adds the callback and sets up the methods, to iterate over the results.
  3521  
  3522  @method pollFilter
  3523  @param {Object} self
  3524  */
  3525  var pollFilter = function(self) {
  3526  
  3527      var onMessage = function (error, messages) {
  3528          if (error) {
  3529              return self.callbacks.forEach(function (callback) {
  3530                  callback(error);
  3531              });
  3532          }
  3533  
  3534          if(utils.isArray(messages)) {
  3535              messages.forEach(function (message) {
  3536                  message = self.formatter ? self.formatter(message) : message;
  3537                  self.callbacks.forEach(function (callback) {
  3538                      callback(null, message);
  3539                  });
  3540              });
  3541          }
  3542      };
  3543  
  3544      self.requestManager.startPolling({
  3545          method: self.implementation.poll.call,
  3546          params: [self.filterId],
  3547      }, self.filterId, onMessage, self.stopWatching.bind(self));
  3548  
  3549  };
  3550  
  3551  var Filter = function (options, type, requestManager, methods, formatter, callback, filterCreationErrorCallback) {
  3552      var self = this;
  3553      var implementation = {};
  3554      methods.forEach(function (method) {
  3555          method.setRequestManager(requestManager);
  3556          method.attachToObject(implementation);
  3557      });
  3558      this.requestManager = requestManager;
  3559      this.options = getOptions(options, type);
  3560      this.implementation = implementation;
  3561      this.filterId = null;
  3562      this.callbacks = [];
  3563      this.getLogsCallbacks = [];
  3564      this.pollFilters = [];
  3565      this.formatter = formatter;
  3566      this.implementation.newFilter(this.options, function(error, id){
  3567          if(error) {
  3568              self.callbacks.forEach(function(cb){
  3569                  cb(error);
  3570              });
  3571              if (typeof filterCreationErrorCallback === 'function') {
  3572                filterCreationErrorCallback(error);
  3573              }
  3574          } else {
  3575              self.filterId = id;
  3576  
  3577              // check if there are get pending callbacks as a consequence
  3578              // of calling get() with filterId unassigned.
  3579              self.getLogsCallbacks.forEach(function (cb){
  3580                  self.get(cb);
  3581              });
  3582              self.getLogsCallbacks = [];
  3583  
  3584              // get filter logs for the already existing watch calls
  3585              self.callbacks.forEach(function(cb){
  3586                  getLogsAtStart(self, cb);
  3587              });
  3588              if(self.callbacks.length > 0)
  3589                  pollFilter(self);
  3590  
  3591              // start to watch immediately
  3592              if(typeof callback === 'function') {
  3593                  return self.watch(callback);
  3594              }
  3595          }
  3596      });
  3597  
  3598      return this;
  3599  };
  3600  
  3601  Filter.prototype.watch = function (callback) {
  3602      this.callbacks.push(callback);
  3603  
  3604      if(this.filterId) {
  3605          getLogsAtStart(this, callback);
  3606          pollFilter(this);
  3607      }
  3608  
  3609      return this;
  3610  };
  3611  
  3612  Filter.prototype.stopWatching = function (callback) {
  3613      this.requestManager.stopPolling(this.filterId);
  3614      this.callbacks = [];
  3615      // remove filter async
  3616      if (callback) {
  3617          this.implementation.uninstallFilter(this.filterId, callback);
  3618      } else {
  3619          return this.implementation.uninstallFilter(this.filterId);
  3620      }
  3621  };
  3622  
  3623  Filter.prototype.get = function (callback) {
  3624      var self = this;
  3625      if (utils.isFunction(callback)) {
  3626          if (this.filterId === null) {
  3627              // If filterId is not set yet, call it back
  3628              // when newFilter() assigns it.
  3629              this.getLogsCallbacks.push(callback);
  3630          } else {
  3631              this.implementation.getLogs(this.filterId, function(err, res){
  3632                  if (err) {
  3633                      callback(err);
  3634                  } else {
  3635                      callback(null, res.map(function (log) {
  3636                          return self.formatter ? self.formatter(log) : log;
  3637                      }));
  3638                  }
  3639              });
  3640          }
  3641      } else {
  3642          if (this.filterId === null) {
  3643              throw new Error('Filter ID Error: filter().get() can\'t be chained synchronous, please provide a callback for the get() method.');
  3644          }
  3645          var logs = this.implementation.getLogs(this.filterId);
  3646          return logs.map(function (log) {
  3647              return self.formatter ? self.formatter(log) : log;
  3648          });
  3649      }
  3650  
  3651      return this;
  3652  };
  3653  
  3654  module.exports = Filter;
  3655  
  3656  
  3657  },{"../utils/utils":20,"./formatters":30}],30:[function(require,module,exports){
  3658  'use strict'
  3659  
  3660  /*
  3661      This file is part of web3.js.
  3662  
  3663      web3.js is free software: you can redistribute it and/or modify
  3664      it under the terms of the GNU Lesser General Public License as published by
  3665      the Free Software Foundation, either version 3 of the License, or
  3666      (at your option) any later version.
  3667  
  3668      web3.js is distributed in the hope that it will be useful,
  3669      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3670      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3671      GNU Lesser General Public License for more details.
  3672  
  3673      You should have received a copy of the GNU Lesser General Public License
  3674      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3675  */
  3676  /**
  3677   * @file formatters.js
  3678   * @author Marek Kotewicz <marek@ethdev.com>
  3679   * @author Fabian Vogelsteller <fabian@ethdev.com>
  3680   * @date 2015
  3681   */
  3682  
  3683  var utils = require('../utils/utils');
  3684  var config = require('../utils/config');
  3685  var Iban = require('./iban');
  3686  
  3687  /**
  3688   * Should the format output to a big number
  3689   *
  3690   * @method outputBigNumberFormatter
  3691   * @param {String|Number|BigNumber}
  3692   * @returns {BigNumber} object
  3693   */
  3694  var outputBigNumberFormatter = function (number) {
  3695      return utils.toBigNumber(number);
  3696  };
  3697  
  3698  var isPredefinedBlockNumber = function (blockNumber) {
  3699      return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest';
  3700  };
  3701  
  3702  var inputDefaultBlockNumberFormatter = function (blockNumber) {
  3703      if (blockNumber === undefined) {
  3704          return config.defaultBlock;
  3705      }
  3706      return inputBlockNumberFormatter(blockNumber);
  3707  };
  3708  
  3709  var inputBlockNumberFormatter = function (blockNumber) {
  3710      if (blockNumber === undefined) {
  3711          return undefined;
  3712      } else if (isPredefinedBlockNumber(blockNumber)) {
  3713          return blockNumber;
  3714      }
  3715      return utils.toHex(blockNumber);
  3716  };
  3717  
  3718  /**
  3719   * Formats the input of a transaction and converts all values to HEX
  3720   *
  3721   * @method inputCallFormatter
  3722   * @param {Object} transaction options
  3723   * @returns object
  3724  */
  3725  var inputCallFormatter = function (options){
  3726  
  3727      options.from = options.from || config.defaultAccount;
  3728  
  3729      if (options.from) {
  3730          options.from = inputAddressFormatter(options.from);
  3731      }
  3732  
  3733      if (options.to) { // it might be contract creation
  3734          options.to = inputAddressFormatter(options.to);
  3735      }
  3736  
  3737      ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
  3738          return options[key] !== undefined;
  3739      }).forEach(function(key){
  3740          options[key] = utils.fromDecimal(options[key]);
  3741      });
  3742  
  3743      return options;
  3744  };
  3745  
  3746  /**
  3747   * Formats the input of a transaction and converts all values to HEX
  3748   *
  3749   * @method inputTransactionFormatter
  3750   * @param {Object} transaction options
  3751   * @returns object
  3752  */
  3753  var inputTransactionFormatter = function (options){
  3754  
  3755      options.from = options.from || config.defaultAccount;
  3756      options.from = inputAddressFormatter(options.from);
  3757  
  3758      if (options.to) { // it might be contract creation
  3759          options.to = inputAddressFormatter(options.to);
  3760      }
  3761  
  3762      ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
  3763          return options[key] !== undefined;
  3764      }).forEach(function(key){
  3765          options[key] = utils.fromDecimal(options[key]);
  3766      });
  3767  
  3768      return options;
  3769  };
  3770  
  3771  /**
  3772   * Formats the output of a transaction to its proper values
  3773   *
  3774   * @method outputTransactionFormatter
  3775   * @param {Object} tx
  3776   * @returns {Object}
  3777  */
  3778  var outputTransactionFormatter = function (tx){
  3779      if(tx.blockNumber !== null)
  3780          tx.blockNumber = utils.toDecimal(tx.blockNumber);
  3781      if(tx.transactionIndex !== null)
  3782          tx.transactionIndex = utils.toDecimal(tx.transactionIndex);
  3783      tx.nonce = utils.toDecimal(tx.nonce);
  3784      tx.gas = utils.toDecimal(tx.gas);
  3785      tx.gasPrice = utils.toBigNumber(tx.gasPrice);
  3786      tx.value = utils.toBigNumber(tx.value);
  3787      return tx;
  3788  };
  3789  
  3790  /**
  3791   * Formats the output of a transaction receipt to its proper values
  3792   *
  3793   * @method outputTransactionReceiptFormatter
  3794   * @param {Object} receipt
  3795   * @returns {Object}
  3796  */
  3797  var outputTransactionReceiptFormatter = function (receipt){
  3798      if(receipt.blockNumber !== null)
  3799          receipt.blockNumber = utils.toDecimal(receipt.blockNumber);
  3800      if(receipt.transactionIndex !== null)
  3801          receipt.transactionIndex = utils.toDecimal(receipt.transactionIndex);
  3802      receipt.cumulativeGasUsed = utils.toDecimal(receipt.cumulativeGasUsed);
  3803      receipt.gasUsed = utils.toDecimal(receipt.gasUsed);
  3804  
  3805      if(utils.isArray(receipt.logs)) {
  3806          receipt.logs = receipt.logs.map(function(log){
  3807              return outputLogFormatter(log);
  3808          });
  3809      }
  3810  
  3811      return receipt;
  3812  };
  3813  
  3814  /**
  3815   * Formats the output of a transaction original data and receipt to its proper values
  3816   *
  3817   * @method outputTransactionDataAndReceiptFormatter
  3818   * @param {Object} dataAndReceipt
  3819   * @returns {Object}
  3820   */
  3821  var outputTransactionDataAndReceiptFormatter = function (dataAndReceipt){
  3822    if(dataAndReceipt.receipt.blockNumber !== null)
  3823      dataAndReceipt.receipt.blockNumber = utils.toDecimal(dataAndReceipt.receipt.blockNumber);
  3824    if(dataAndReceipt.receipt.transactionIndex !== null)
  3825      dataAndReceipt.receipt.transactionIndex = utils.toDecimal(dataAndReceipt.receipt.transactionIndex);
  3826    dataAndReceipt.receipt.cumulativeGasUsed = utils.toDecimal(dataAndReceipt.receipt.cumulativeGasUsed);
  3827    dataAndReceipt.receipt.gasUsed = utils.toDecimal(dataAndReceipt.receipt.gasUsed);
  3828  
  3829    if(utils.isArray(dataAndReceipt.receipt.logs)) {
  3830      dataAndReceipt.receipt.logs = dataAndReceipt.receipt.logs.map(function(log){
  3831        return outputLogFormatter(log);
  3832      });
  3833    }
  3834  
  3835    if(dataAndReceipt.txData.blockNumber !== null)
  3836      dataAndReceipt.txData.blockNumber = utils.toDecimal(dataAndReceipt.txData.blockNumber);
  3837    if(dataAndReceipt.txData.transactionIndex !== null)
  3838      dataAndReceipt.txData.transactionIndex = utils.toDecimal(dataAndReceipt.txData.transactionIndex);
  3839    dataAndReceipt.txData.nonce = utils.toDecimal(dataAndReceipt.txData.nonce);
  3840    dataAndReceipt.txData.gas = utils.toDecimal(dataAndReceipt.txData.gas);
  3841    dataAndReceipt.txData.gasPrice = utils.toBigNumber(dataAndReceipt.txData.gasPrice);
  3842    dataAndReceipt.txData.value = utils.toBigNumber(dataAndReceipt.txData.value);
  3843  
  3844    return dataAndReceipt;
  3845  };
  3846  
  3847  /**
  3848   * Formats the output of a block to its proper values
  3849   *
  3850   * @method outputBlockFormatter
  3851   * @param {Object} block
  3852   * @returns {Object}
  3853  */
  3854  var outputBlockFormatter = function(block) {
  3855  
  3856      // transform to number
  3857      block.gasLimit = utils.toDecimal(block.gasLimit);
  3858      block.gasUsed = utils.toDecimal(block.gasUsed);
  3859      block.size = utils.toDecimal(block.size);
  3860      block.timestamp = utils.toDecimal(block.timestamp);
  3861      if(block.number !== null)
  3862          block.number = utils.toDecimal(block.number);
  3863  
  3864      block.difficulty = utils.toBigNumber(block.difficulty);
  3865      block.totalDifficulty = utils.toBigNumber(block.totalDifficulty);
  3866  
  3867      if (utils.isArray(block.transactions)) {
  3868          block.transactions.forEach(function(item){
  3869              if(!utils.isString(item))
  3870                  return outputTransactionFormatter(item);
  3871          });
  3872      }
  3873  
  3874      return block;
  3875  };
  3876  
  3877  /**
  3878   * Formats the output of a log
  3879   *
  3880   * @method outputLogFormatter
  3881   * @param {Object} log object
  3882   * @returns {Object} log
  3883  */
  3884  var outputLogFormatter = function(log) {
  3885      if(log.blockNumber)
  3886          log.blockNumber = utils.toDecimal(log.blockNumber);
  3887      if(log.transactionIndex)
  3888          log.transactionIndex = utils.toDecimal(log.transactionIndex);
  3889      if(log.logIndex)
  3890          log.logIndex = utils.toDecimal(log.logIndex);
  3891  
  3892      return log;
  3893  };
  3894  
  3895  /**
  3896   * Formats the input of a whisper post and converts all values to HEX
  3897   *
  3898   * @method inputPostFormatter
  3899   * @param {Object} transaction object
  3900   * @returns {Object}
  3901  */
  3902  var inputPostFormatter = function(post) {
  3903  
  3904      // post.payload = utils.toHex(post.payload);
  3905      post.ttl = utils.fromDecimal(post.ttl);
  3906      post.workToProve = utils.fromDecimal(post.workToProve);
  3907      post.priority = utils.fromDecimal(post.priority);
  3908  
  3909      // fallback
  3910      if (!utils.isArray(post.topics)) {
  3911          post.topics = post.topics ? [post.topics] : [];
  3912      }
  3913  
  3914      // format the following options
  3915      post.topics = post.topics.map(function(topic){
  3916          // convert only if not hex
  3917          return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);
  3918      });
  3919  
  3920      return post;
  3921  };
  3922  
  3923  /**
  3924   * Formats the output of a received post message
  3925   *
  3926   * @method outputPostFormatter
  3927   * @param {Object}
  3928   * @returns {Object}
  3929   */
  3930  var outputPostFormatter = function(post){
  3931  
  3932      post.expiry = utils.toDecimal(post.expiry);
  3933      post.sent = utils.toDecimal(post.sent);
  3934      post.ttl = utils.toDecimal(post.ttl);
  3935      post.workProved = utils.toDecimal(post.workProved);
  3936      // post.payloadRaw = post.payload;
  3937      // post.payload = utils.toAscii(post.payload);
  3938  
  3939      // if (utils.isJson(post.payload)) {
  3940      //     post.payload = JSON.parse(post.payload);
  3941      // }
  3942  
  3943      // format the following options
  3944      if (!post.topics) {
  3945          post.topics = [];
  3946      }
  3947      post.topics = post.topics.map(function(topic){
  3948          return utils.toAscii(topic);
  3949      });
  3950  
  3951      return post;
  3952  };
  3953  
  3954  var inputAddressFormatter = function (address) {
  3955  
  3956      return address;
  3957      var iban = new Iban(address);
  3958      if (iban.isValid() && iban.isDirect()) {
  3959          return '0x' + iban.address();
  3960      } else if (utils.isStrictAddress(address)) {
  3961          return address;
  3962      } else if (utils.isAddress(address)) {
  3963          return '0x' + address;
  3964      }
  3965      throw new Error('invalid address');
  3966  };
  3967  
  3968  
  3969  var outputSyncingFormatter = function(result) {
  3970      if (!result) {
  3971          return result;
  3972      }
  3973  
  3974      result.startingBlock = utils.toDecimal(result.startingBlock);
  3975      result.currentBlock = utils.toDecimal(result.currentBlock);
  3976      result.highestBlock = utils.toDecimal(result.highestBlock);
  3977      if (result.knownStates) {
  3978          result.knownStates = utils.toDecimal(result.knownStates);
  3979          result.pulledStates = utils.toDecimal(result.pulledStates);
  3980      }
  3981  
  3982      return result;
  3983  };
  3984  
  3985  module.exports = {
  3986      inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
  3987      inputBlockNumberFormatter: inputBlockNumberFormatter,
  3988      inputCallFormatter: inputCallFormatter,
  3989      inputTransactionFormatter: inputTransactionFormatter,
  3990      inputAddressFormatter: inputAddressFormatter,
  3991      inputPostFormatter: inputPostFormatter,
  3992      outputBigNumberFormatter: outputBigNumberFormatter,
  3993      outputTransactionFormatter: outputTransactionFormatter,
  3994      outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,
  3995      outputTransactionDataAndReceiptFormatter: outputTransactionDataAndReceiptFormatter,
  3996      outputBlockFormatter: outputBlockFormatter,
  3997      outputLogFormatter: outputLogFormatter,
  3998      outputPostFormatter: outputPostFormatter,
  3999      outputSyncingFormatter: outputSyncingFormatter
  4000  };
  4001  
  4002  
  4003  },{"../utils/config":18,"../utils/utils":20,"./iban":33}],31:[function(require,module,exports){
  4004  /*
  4005      This file is part of web3.js.
  4006  
  4007      web3.js is free software: you can redistribute it and/or modify
  4008      it under the terms of the GNU Lesser General Public License as published by
  4009      the Free Software Foundation, either version 3 of the License, or
  4010      (at your option) any later version.
  4011  
  4012      web3.js is distributed in the hope that it will be useful,
  4013      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4014      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4015      GNU Lesser General Public License for more details.
  4016  
  4017      You should have received a copy of the GNU Lesser General Public License
  4018      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4019  */
  4020  /**
  4021   * @file function.js
  4022   * @author Marek Kotewicz <marek@ethdev.com>
  4023   * @date 2015
  4024   */
  4025  
  4026  var coder = require('../solidity/coder');
  4027  var utils = require('../utils/utils');
  4028  var errors = require('./errors');
  4029  var formatters = require('./formatters');
  4030  var sha3 = require('../utils/sha3');
  4031  
  4032  /**
  4033   * This prototype should be used to call/sendTransaction to solidity functions
  4034   */
  4035  var SolidityFunction = function (eth, json, address) {
  4036      this._eth = eth;
  4037      this._inputTypes = json.inputs.map(function (i) {
  4038          return i.type;
  4039      });
  4040      this._outputTypes = json.outputs.map(function (i) {
  4041          return i.type;
  4042      });
  4043      this._constant = json.constant;
  4044      this._payable = json.payable;
  4045      this._name = utils.transformToFullName(json);
  4046      this._address = address;
  4047  };
  4048  
  4049  SolidityFunction.prototype.extractCallback = function (args) {
  4050      if (utils.isFunction(args[args.length - 1])) {
  4051          return args.pop(); // modify the args array!
  4052      }
  4053  };
  4054  
  4055  SolidityFunction.prototype.extractDefaultBlock = function (args) {
  4056      if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) {
  4057          return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array!
  4058      }
  4059  };
  4060  
  4061  /**
  4062   * Should be called to check if the number of arguments is correct
  4063   *
  4064   * @method validateArgs
  4065   * @param {Array} arguments
  4066   * @throws {Error} if it is not
  4067   */
  4068  SolidityFunction.prototype.validateArgs = function (args) {
  4069      var inputArgs = args.filter(function (a) {
  4070        // filter the options object but not arguments that are arrays
  4071        return !( (utils.isObject(a) === true) &&
  4072                  (utils.isArray(a) === false) &&
  4073                  (utils.isBigNumber(a) === false)
  4074                );
  4075      });
  4076      if (inputArgs.length !== this._inputTypes.length) {
  4077          throw errors.InvalidNumberOfSolidityArgs();
  4078      }
  4079  };
  4080  
  4081  /**
  4082   * Should be used to create payload from arguments
  4083   *
  4084   * @method toPayload
  4085   * @param {Array} solidity function params
  4086   * @param {Object} optional payload options
  4087   */
  4088  SolidityFunction.prototype.toPayload = function (args) {
  4089      var options = {};
  4090      if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
  4091          options = args[args.length - 1];
  4092      }
  4093      this.validateArgs(args);
  4094      options.to = this._address;
  4095      options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
  4096      return options;
  4097  };
  4098  
  4099  /**
  4100   * Should be used to get function signature
  4101   *
  4102   * @method signature
  4103   * @return {String} function signature
  4104   */
  4105  SolidityFunction.prototype.signature = function () {
  4106      return sha3(this._name).slice(0, 8);
  4107  };
  4108  
  4109  
  4110  SolidityFunction.prototype.unpackOutput = function (output) {
  4111      if (!output) {
  4112          return;
  4113      }
  4114  
  4115      output = output.length >= 2 ? output.slice(2) : output;
  4116      var result = coder.decodeParams(this._outputTypes, output);
  4117      return result.length === 1 ? result[0] : result;
  4118  };
  4119  
  4120  /**
  4121   * Calls a contract function.
  4122   *
  4123   * @method call
  4124   * @param {...Object} Contract function arguments
  4125   * @param {function} If the last argument is a function, the contract function
  4126   *   call will be asynchronous, and the callback will be passed the
  4127   *   error and result.
  4128   * @return {String} output bytes
  4129   */
  4130  SolidityFunction.prototype.call = function () {
  4131      var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
  4132      var callback = this.extractCallback(args);
  4133      var defaultBlock = this.extractDefaultBlock(args);
  4134      var payload = this.toPayload(args);
  4135  
  4136  
  4137      if (!callback) {
  4138          var output = this._eth.call(payload, defaultBlock);
  4139          return this.unpackOutput(output);
  4140      }
  4141  
  4142      var self = this;
  4143      this._eth.call(payload, defaultBlock, function (error, output) {
  4144          if (error) return callback(error, null);
  4145  
  4146          var unpacked = null;
  4147          try {
  4148              unpacked = self.unpackOutput(output);
  4149          }
  4150          catch (e) {
  4151              error = e;
  4152          }
  4153  
  4154          callback(error, unpacked);
  4155      });
  4156  };
  4157  
  4158  /**
  4159   * Should be used to sendTransaction to solidity function
  4160   *
  4161   * @method sendTransaction
  4162   */
  4163  SolidityFunction.prototype.sendTransaction = function () {
  4164      var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
  4165      var callback = this.extractCallback(args);
  4166      var payload = this.toPayload(args);
  4167  
  4168      if (payload.value > 0 && !this._payable) {
  4169          throw new Error('Cannot send value to non-payable function');
  4170      }
  4171  
  4172      if (!callback) {
  4173          return this._eth.sendTransaction(payload);
  4174      }
  4175  
  4176      this._eth.sendTransaction(payload, callback);
  4177  };
  4178  
  4179  /**
  4180   * Should be used to estimateGas of solidity function
  4181   *
  4182   * @method estimateGas
  4183   */
  4184  SolidityFunction.prototype.estimateGas = function () {
  4185      var args = Array.prototype.slice.call(arguments);
  4186      var callback = this.extractCallback(args);
  4187      var payload = this.toPayload(args);
  4188  
  4189      if (!callback) {
  4190          return this._eth.estimateGas(payload);
  4191      }
  4192  
  4193      this._eth.estimateGas(payload, callback);
  4194  };
  4195  
  4196  /**
  4197   * Return the encoded data of the call
  4198   *
  4199   * @method getData
  4200   * @return {String} the encoded data
  4201   */
  4202  SolidityFunction.prototype.getData = function () {
  4203      var args = Array.prototype.slice.call(arguments);
  4204      var payload = this.toPayload(args);
  4205  
  4206      return payload.data;
  4207  };
  4208  
  4209  /**
  4210   * Should be used to get function display name
  4211   *
  4212   * @method displayName
  4213   * @return {String} display name of the function
  4214   */
  4215  SolidityFunction.prototype.displayName = function () {
  4216      return utils.extractDisplayName(this._name);
  4217  };
  4218  
  4219  /**
  4220   * Should be used to get function type name
  4221   *
  4222   * @method typeName
  4223   * @return {String} type name of the function
  4224   */
  4225  SolidityFunction.prototype.typeName = function () {
  4226      return utils.extractTypeName(this._name);
  4227  };
  4228  
  4229  /**
  4230   * Should be called to get rpc requests from solidity function
  4231   *
  4232   * @method request
  4233   * @returns {Object}
  4234   */
  4235  SolidityFunction.prototype.request = function () {
  4236      var args = Array.prototype.slice.call(arguments);
  4237      var callback = this.extractCallback(args);
  4238      var payload = this.toPayload(args);
  4239      var format = this.unpackOutput.bind(this);
  4240  
  4241      return {
  4242          method: this._constant ? 'eth_call' : 'eth_sendTransaction',
  4243          callback: callback,
  4244          params: [payload],
  4245          format: format
  4246      };
  4247  };
  4248  
  4249  /**
  4250   * Should be called to execute function
  4251   *
  4252   * @method execute
  4253   */
  4254  SolidityFunction.prototype.execute = function () {
  4255      var transaction = !this._constant;
  4256  
  4257      // send transaction
  4258      if (transaction) {
  4259          return this.sendTransaction.apply(this, Array.prototype.slice.call(arguments));
  4260      }
  4261  
  4262      // call
  4263      return this.call.apply(this, Array.prototype.slice.call(arguments));
  4264  };
  4265  
  4266  /**
  4267   * Should be called to attach function to contract
  4268   *
  4269   * @method attachToContract
  4270   * @param {Contract}
  4271   */
  4272  SolidityFunction.prototype.attachToContract = function (contract) {
  4273      var execute = this.execute.bind(this);
  4274      execute.request = this.request.bind(this);
  4275      execute.call = this.call.bind(this);
  4276      execute.sendTransaction = this.sendTransaction.bind(this);
  4277      execute.estimateGas = this.estimateGas.bind(this);
  4278      execute.getData = this.getData.bind(this);
  4279      var displayName = this.displayName();
  4280      if (!contract[displayName]) {
  4281          contract[displayName] = execute;
  4282      }
  4283      contract[displayName][this.typeName()] = execute; // circular!!!!
  4284  };
  4285  
  4286  module.exports = SolidityFunction;
  4287  
  4288  },{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(require,module,exports){
  4289  /*
  4290      This file is part of web3.js.
  4291  
  4292      web3.js is free software: you can redistribute it and/or modify
  4293      it under the terms of the GNU Lesser General Public License as published by
  4294      the Free Software Foundation, either version 3 of the License, or
  4295      (at your option) any later version.
  4296  
  4297      web3.js is distributed in the hope that it will be useful,
  4298      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4299      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4300      GNU Lesser General Public License for more details.
  4301  
  4302      You should have received a copy of the GNU Lesser General Public License
  4303      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4304  */
  4305  /** @file httpprovider.js
  4306   * @authors:
  4307   *   Marek Kotewicz <marek@ethdev.com>
  4308   *   Marian Oancea <marian@ethdev.com>
  4309   *   Fabian Vogelsteller <fabian@ethdev.com>
  4310   * @date 2015
  4311   */
  4312  
  4313  var errors = require('./errors');
  4314  
  4315  // workaround to use httpprovider in different envs
  4316  
  4317  // browser
  4318  if (typeof window !== 'undefined' && window.XMLHttpRequest) {
  4319    XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line
  4320  // node
  4321  } else {
  4322    XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line
  4323  }
  4324  
  4325  var XHR2 = require('xhr2'); // jshint ignore: line
  4326  
  4327  /**
  4328   * HttpProvider should be used to send rpc calls over http
  4329   */
  4330  var HttpProvider = function (host, timeout, user, password) {
  4331    this.host = host || 'http://localhost:8545';
  4332    this.timeout = timeout || 0;
  4333    this.user = user;
  4334    this.password = password;
  4335  };
  4336  
  4337  /**
  4338   * Should be called to prepare new XMLHttpRequest
  4339   *
  4340   * @method prepareRequest
  4341   * @param {Boolean} true if request should be async
  4342   * @return {XMLHttpRequest} object
  4343   */
  4344  HttpProvider.prototype.prepareRequest = function (async) {
  4345    var request;
  4346  
  4347    if (async) {
  4348      request = new XHR2();
  4349      request.timeout = this.timeout;
  4350    } else {
  4351      request = new XMLHttpRequest();
  4352    }
  4353  
  4354    request.open('POST', this.host, async);
  4355    if (this.user && this.password) {
  4356      var auth = 'Basic ' + new Buffer(this.user + ':' + this.password).toString('base64');
  4357      request.setRequestHeader('Authorization', auth);
  4358    } request.setRequestHeader('Content-Type', 'application/json');
  4359    return request;
  4360  };
  4361  
  4362  /**
  4363   * Should be called to make sync request
  4364   *
  4365   * @method send
  4366   * @param {Object} payload
  4367   * @return {Object} result
  4368   */
  4369  HttpProvider.prototype.send = function (payload) {
  4370    var request = this.prepareRequest(false);
  4371  
  4372    try {
  4373      request.send(JSON.stringify(payload));
  4374    } catch (error) {
  4375      throw errors.InvalidConnection(this.host);
  4376    }
  4377  
  4378    var result = request.responseText;
  4379  
  4380    try {
  4381      result = JSON.parse(result);
  4382    } catch (e) {
  4383      throw errors.InvalidResponse(request.responseText);
  4384    }
  4385  
  4386    return result;
  4387  };
  4388  
  4389  /**
  4390   * Should be used to make async request
  4391   *
  4392   * @method sendAsync
  4393   * @param {Object} payload
  4394   * @param {Function} callback triggered on end with (err, result)
  4395   */
  4396  HttpProvider.prototype.sendAsync = function (payload, callback) {
  4397    var request = this.prepareRequest(true);
  4398  
  4399    request.onreadystatechange = function () {
  4400      if (request.readyState === 4 && request.timeout !== 1) {
  4401        var result = request.responseText;
  4402        var error = null;
  4403  
  4404        try {
  4405          result = JSON.parse(result);
  4406        } catch (e) {
  4407          error = errors.InvalidResponse(request.responseText);
  4408        }
  4409  
  4410        callback(error, result);
  4411      }
  4412    };
  4413  
  4414    request.ontimeout = function () {
  4415      callback(errors.ConnectionTimeout(this.timeout));
  4416    };
  4417  
  4418    try {
  4419      request.send(JSON.stringify(payload));
  4420    } catch (error) {
  4421      callback(errors.InvalidConnection(this.host));
  4422    }
  4423  };
  4424  
  4425  /**
  4426   * Synchronously tries to make Http request
  4427   *
  4428   * @method isConnected
  4429   * @return {Boolean} returns true if request haven't failed. Otherwise false
  4430   */
  4431  HttpProvider.prototype.isConnected = function () {
  4432    try {
  4433      this.send({
  4434        id: 9999999999,
  4435        jsonrpc: '2.0',
  4436        method: 'net_listening',
  4437        params: []
  4438      });
  4439      return true;
  4440    } catch (e) {
  4441      return false;
  4442    }
  4443  };
  4444  
  4445  module.exports = HttpProvider;
  4446  
  4447  },{"./errors":26,"xhr2":86,"xmlhttprequest":17}],33:[function(require,module,exports){
  4448  /*
  4449      This file is part of web3.js.
  4450  
  4451      web3.js is free software: you can redistribute it and/or modify
  4452      it under the terms of the GNU Lesser General Public License as published by
  4453      the Free Software Foundation, either version 3 of the License, or
  4454      (at your option) any later version.
  4455  
  4456      web3.js is distributed in the hope that it will be useful,
  4457      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4458      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4459      GNU Lesser General Public License for more details.
  4460  
  4461      You should have received a copy of the GNU Lesser General Public License
  4462      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4463  */
  4464  /** 
  4465   * @file iban.js
  4466   * @author Marek Kotewicz <marek@ethdev.com>
  4467   * @date 2015
  4468   */
  4469  
  4470  var BigNumber = require('bignumber.js');
  4471  
  4472  var padLeft = function (string, bytes) {
  4473      var result = string;
  4474      while (result.length < bytes * 2) {
  4475          result = '0' + result;
  4476      }
  4477      return result;
  4478  };
  4479  
  4480  /**
  4481   * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to
  4482   * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.
  4483   *
  4484   * @method iso13616Prepare
  4485   * @param {String} iban the IBAN
  4486   * @returns {String} the prepared IBAN
  4487   */
  4488  var iso13616Prepare = function (iban) {
  4489      var A = 'A'.charCodeAt(0);
  4490      var Z = 'Z'.charCodeAt(0);
  4491  
  4492      iban = iban.toUpperCase();
  4493      iban = iban.substr(4) + iban.substr(0,4);
  4494  
  4495      return iban.split('').map(function(n){
  4496          var code = n.charCodeAt(0);
  4497          if (code >= A && code <= Z){
  4498              // A = 10, B = 11, ... Z = 35
  4499              return code - A + 10;
  4500          } else {
  4501              return n;
  4502          }
  4503      }).join('');
  4504  };
  4505  
  4506  /**
  4507   * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.
  4508   *
  4509   * @method mod9710
  4510   * @param {String} iban
  4511   * @returns {Number}
  4512   */
  4513  var mod9710 = function (iban) {
  4514      var remainder = iban,
  4515          block;
  4516  
  4517      while (remainder.length > 2){
  4518          block = remainder.slice(0, 9);
  4519          remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);
  4520      }
  4521  
  4522      return parseInt(remainder, 10) % 97;
  4523  };
  4524  
  4525  /**
  4526   * This prototype should be used to create iban object from iban correct string
  4527   *
  4528   * @param {String} iban
  4529   */
  4530  var Iban = function (iban) {
  4531      this._iban = iban;
  4532  };
  4533  
  4534  /**
  4535   * This method should be used to create iban object from ethereum address
  4536   *
  4537   * @method fromAddress
  4538   * @param {String} address
  4539   * @return {Iban} the IBAN object
  4540   */
  4541  Iban.fromAddress = function (address) {
  4542      var asBn = new BigNumber(address, 16);
  4543      var base36 = asBn.toString(36);
  4544      var padded = padLeft(base36, 15);
  4545      return Iban.fromBban(padded.toUpperCase());
  4546  };
  4547  
  4548  /**
  4549   * Convert the passed BBAN to an IBAN for this country specification.
  4550   * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
  4551   * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
  4552   *
  4553   * @method fromBban
  4554   * @param {String} bban the BBAN to convert to IBAN
  4555   * @returns {Iban} the IBAN object
  4556   */
  4557  Iban.fromBban = function (bban) {
  4558      var countryCode = 'XE';
  4559  
  4560      var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban));
  4561      var checkDigit = ('0' + (98 - remainder)).slice(-2);
  4562  
  4563      return new Iban(countryCode + checkDigit + bban);
  4564  };
  4565  
  4566  /**
  4567   * Should be used to create IBAN object for given institution and identifier
  4568   *
  4569   * @method createIndirect
  4570   * @param {Object} options, required options are "institution" and "identifier"
  4571   * @return {Iban} the IBAN object
  4572   */
  4573  Iban.createIndirect = function (options) {
  4574      return Iban.fromBban('ETH' + options.institution + options.identifier);
  4575  };
  4576  
  4577  /**
  4578   * Thos method should be used to check if given string is valid iban object
  4579   *
  4580   * @method isValid
  4581   * @param {String} iban string
  4582   * @return {Boolean} true if it is valid IBAN
  4583   */
  4584  Iban.isValid = function (iban) {
  4585      var i = new Iban(iban);
  4586      return i.isValid();
  4587  };
  4588  
  4589  /**
  4590   * Should be called to check if iban is correct
  4591   *
  4592   * @method isValid
  4593   * @returns {Boolean} true if it is, otherwise false
  4594   */
  4595  Iban.prototype.isValid = function () {
  4596      return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) &&
  4597          mod9710(iso13616Prepare(this._iban)) === 1;
  4598  };
  4599  
  4600  /**
  4601   * Should be called to check if iban number is direct
  4602   *
  4603   * @method isDirect
  4604   * @returns {Boolean} true if it is, otherwise false
  4605   */
  4606  Iban.prototype.isDirect = function () {
  4607      return this._iban.length === 34 || this._iban.length === 35;
  4608  };
  4609  
  4610  /**
  4611   * Should be called to check if iban number if indirect
  4612   *
  4613   * @method isIndirect
  4614   * @returns {Boolean} true if it is, otherwise false
  4615   */
  4616  Iban.prototype.isIndirect = function () {
  4617      return this._iban.length === 20;
  4618  };
  4619  
  4620  /**
  4621   * Should be called to get iban checksum
  4622   * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003)
  4623   *
  4624   * @method checksum
  4625   * @returns {String} checksum
  4626   */
  4627  Iban.prototype.checksum = function () {
  4628      return this._iban.substr(2, 2);
  4629  };
  4630  
  4631  /**
  4632   * Should be called to get institution identifier
  4633   * eg. XREG
  4634   *
  4635   * @method institution
  4636   * @returns {String} institution identifier
  4637   */
  4638  Iban.prototype.institution = function () {
  4639      return this.isIndirect() ? this._iban.substr(7, 4) : '';
  4640  };
  4641  
  4642  /**
  4643   * Should be called to get client identifier within institution
  4644   * eg. GAVOFYORK
  4645   *
  4646   * @method client
  4647   * @returns {String} client identifier
  4648   */
  4649  Iban.prototype.client = function () {
  4650      return this.isIndirect() ? this._iban.substr(11) : '';
  4651  };
  4652  
  4653  /**
  4654   * Should be called to get client direct address
  4655   *
  4656   * @method address
  4657   * @returns {String} client direct address
  4658   */
  4659  Iban.prototype.address = function () {
  4660      if (this.isDirect()) {
  4661          var base36 = this._iban.substr(4);
  4662          var asBn = new BigNumber(base36, 36);
  4663          return padLeft(asBn.toString(16), 20);
  4664      } 
  4665  
  4666      return '';
  4667  };
  4668  
  4669  Iban.prototype.toString = function () {
  4670      return this._iban;
  4671  };
  4672  
  4673  module.exports = Iban;
  4674  
  4675  
  4676  },{"bignumber.js":"bignumber.js"}],34:[function(require,module,exports){
  4677  /*
  4678      This file is part of web3.js.
  4679  
  4680      web3.js is free software: you can redistribute it and/or modify
  4681      it under the terms of the GNU Lesser General Public License as published by
  4682      the Free Software Foundation, either version 3 of the License, or
  4683      (at your option) any later version.
  4684  
  4685      web3.js is distributed in the hope that it will be useful,
  4686      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4687      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4688      GNU Lesser General Public License for more details.
  4689  
  4690      You should have received a copy of the GNU Lesser General Public License
  4691      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4692  */
  4693  /** @file ipcprovider.js
  4694   * @authors:
  4695   *   Fabian Vogelsteller <fabian@ethdev.com>
  4696   * @date 2015
  4697   */
  4698  
  4699  "use strict";
  4700  
  4701  var utils = require('../utils/utils');
  4702  var errors = require('./errors');
  4703  
  4704  
  4705  var IpcProvider = function (path, net) {
  4706      var _this = this;
  4707      this.responseCallbacks = {};
  4708      this.path = path;
  4709      
  4710      this.connection = net.connect({path: this.path});
  4711  
  4712      this.connection.on('error', function(e){
  4713          console.error('IPC Connection Error', e);
  4714          _this._timeout();
  4715      });
  4716  
  4717      this.connection.on('end', function(){
  4718          _this._timeout();
  4719      }); 
  4720  
  4721  
  4722      // LISTEN FOR CONNECTION RESPONSES
  4723      this.connection.on('data', function(data) {
  4724          /*jshint maxcomplexity: 6 */
  4725  
  4726          _this._parseResponse(data.toString()).forEach(function(result){
  4727  
  4728              var id = null;
  4729  
  4730              // get the id which matches the returned id
  4731              if(utils.isArray(result)) {
  4732                  result.forEach(function(load){
  4733                      if(_this.responseCallbacks[load.id])
  4734                          id = load.id;
  4735                  });
  4736              } else {
  4737                  id = result.id;
  4738              }
  4739  
  4740              // fire the callback
  4741              if(_this.responseCallbacks[id]) {
  4742                  _this.responseCallbacks[id](null, result);
  4743                  delete _this.responseCallbacks[id];
  4744              }
  4745          });
  4746      });
  4747  };
  4748  
  4749  /**
  4750  Will parse the response and make an array out of it.
  4751  
  4752  @method _parseResponse
  4753  @param {String} data
  4754  */
  4755  IpcProvider.prototype._parseResponse = function(data) {
  4756      var _this = this,
  4757          returnValues = [];
  4758      
  4759      // DE-CHUNKER
  4760      var dechunkedData = data
  4761          .replace(/\}[\n\r]?\{/g,'}|--|{') // }{
  4762          .replace(/\}\][\n\r]?\[\{/g,'}]|--|[{') // }][{
  4763          .replace(/\}[\n\r]?\[\{/g,'}|--|[{') // }[{
  4764          .replace(/\}\][\n\r]?\{/g,'}]|--|{') // }]{
  4765          .split('|--|');
  4766  
  4767      dechunkedData.forEach(function(data){
  4768  
  4769          // prepend the last chunk
  4770          if(_this.lastChunk)
  4771              data = _this.lastChunk + data;
  4772  
  4773          var result = null;
  4774  
  4775          try {
  4776              result = JSON.parse(data);
  4777  
  4778          } catch(e) {
  4779  
  4780              _this.lastChunk = data;
  4781  
  4782              // start timeout to cancel all requests
  4783              clearTimeout(_this.lastChunkTimeout);
  4784              _this.lastChunkTimeout = setTimeout(function(){
  4785                  _this._timeout();
  4786                  throw errors.InvalidResponse(data);
  4787              }, 1000 * 15);
  4788  
  4789              return;
  4790          }
  4791  
  4792          // cancel timeout and set chunk to null
  4793          clearTimeout(_this.lastChunkTimeout);
  4794          _this.lastChunk = null;
  4795  
  4796          if(result)
  4797              returnValues.push(result);
  4798      });
  4799  
  4800      return returnValues;
  4801  };
  4802  
  4803  
  4804  /**
  4805  Get the adds a callback to the responseCallbacks object,
  4806  which will be called if a response matching the response Id will arrive.
  4807  
  4808  @method _addResponseCallback
  4809  */
  4810  IpcProvider.prototype._addResponseCallback = function(payload, callback) {
  4811      var id = payload.id || payload[0].id;
  4812      var method = payload.method || payload[0].method;
  4813  
  4814      this.responseCallbacks[id] = callback;
  4815      this.responseCallbacks[id].method = method;
  4816  };
  4817  
  4818  /**
  4819  Timeout all requests when the end/error event is fired
  4820  
  4821  @method _timeout
  4822  */
  4823  IpcProvider.prototype._timeout = function() {
  4824      for(var key in this.responseCallbacks) {
  4825          if(this.responseCallbacks.hasOwnProperty(key)){
  4826              this.responseCallbacks[key](errors.InvalidConnection('on IPC'));
  4827              delete this.responseCallbacks[key];
  4828          }
  4829      }
  4830  };
  4831  
  4832  
  4833  /**
  4834  Check if the current connection is still valid.
  4835  
  4836  @method isConnected
  4837  */
  4838  IpcProvider.prototype.isConnected = function() {
  4839      var _this = this;
  4840  
  4841      // try reconnect, when connection is gone
  4842      if(!_this.connection.writable)
  4843          _this.connection.connect({path: _this.path});
  4844  
  4845      return !!this.connection.writable;
  4846  };
  4847  
  4848  IpcProvider.prototype.send = function (payload) {
  4849  
  4850      if(this.connection.writeSync) {
  4851          var result;
  4852  
  4853          // try reconnect, when connection is gone
  4854          if(!this.connection.writable)
  4855              this.connection.connect({path: this.path});
  4856  
  4857          var data = this.connection.writeSync(JSON.stringify(payload));
  4858  
  4859          try {
  4860              result = JSON.parse(data);
  4861          } catch(e) {
  4862              throw errors.InvalidResponse(data);                
  4863          }
  4864  
  4865          return result;
  4866  
  4867      } else {
  4868          throw new Error('You tried to send "'+ payload.method +'" synchronously. Synchronous requests are not supported by the IPC provider.');
  4869      }
  4870  };
  4871  
  4872  IpcProvider.prototype.sendAsync = function (payload, callback) {
  4873      // try reconnect, when connection is gone
  4874      if(!this.connection.writable)
  4875          this.connection.connect({path: this.path});
  4876  
  4877  
  4878      this.connection.write(JSON.stringify(payload));
  4879      this._addResponseCallback(payload, callback);
  4880  };
  4881  
  4882  module.exports = IpcProvider;
  4883  
  4884  
  4885  },{"../utils/utils":20,"./errors":26}],35:[function(require,module,exports){
  4886  /*
  4887      This file is part of web3.js.
  4888  
  4889      web3.js is free software: you can redistribute it and/or modify
  4890      it under the terms of the GNU Lesser General Public License as published by
  4891      the Free Software Foundation, either version 3 of the License, or
  4892      (at your option) any later version.
  4893  
  4894      web3.js is distributed in the hope that it will be useful,
  4895      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4896      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4897      GNU Lesser General Public License for more details.
  4898  
  4899      You should have received a copy of the GNU Lesser General Public License
  4900      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4901  */
  4902  /** @file jsonrpc.js
  4903   * @authors:
  4904   *   Marek Kotewicz <marek@ethdev.com>
  4905   *   Aaron Kumavis <aaron@kumavis.me>
  4906   * @date 2015
  4907   */
  4908  
  4909  // Initialize Jsonrpc as a simple object with utility functions.
  4910  var Jsonrpc = {
  4911      messageId: 0
  4912  };
  4913  
  4914  /**
  4915   * Should be called to valid json create payload object
  4916   *
  4917   * @method toPayload
  4918   * @param {Function} method of jsonrpc call, required
  4919   * @param {Array} params, an array of method params, optional
  4920   * @returns {Object} valid jsonrpc payload object
  4921   */
  4922  Jsonrpc.toPayload = function (method, params) {
  4923      if (!method)
  4924          console.error('jsonrpc method should be specified!');
  4925  
  4926      // advance message ID
  4927      Jsonrpc.messageId++;
  4928  
  4929      return {
  4930          jsonrpc: '2.0',
  4931          id: Jsonrpc.messageId,
  4932          method: method,
  4933          params: params || []
  4934      };
  4935  };
  4936  
  4937  /**
  4938   * Should be called to check if jsonrpc response is valid
  4939   *
  4940   * @method isValidResponse
  4941   * @param {Object}
  4942   * @returns {Boolean} true if response is valid, otherwise false
  4943   */
  4944  Jsonrpc.isValidResponse = function (response) {
  4945      return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response);
  4946  
  4947      function validateSingleMessage(message){
  4948        return !!message &&
  4949          !message.error &&
  4950          message.jsonrpc === '2.0' &&
  4951          typeof message.id === 'number' &&
  4952          message.result !== undefined; // only undefined is not valid json object
  4953      }
  4954  };
  4955  
  4956  /**
  4957   * Should be called to create batch payload object
  4958   *
  4959   * @method toBatchPayload
  4960   * @param {Array} messages, an array of objects with method (required) and params (optional) fields
  4961   * @returns {Array} batch payload
  4962   */
  4963  Jsonrpc.toBatchPayload = function (messages) {
  4964      return messages.map(function (message) {
  4965          return Jsonrpc.toPayload(message.method, message.params);
  4966      });
  4967  };
  4968  
  4969  module.exports = Jsonrpc;
  4970  
  4971  
  4972  },{}],36:[function(require,module,exports){
  4973  /*
  4974      This file is part of web3.js.
  4975  
  4976      web3.js is free software: you can redistribute it and/or modify
  4977      it under the terms of the GNU Lesser General Public License as published by
  4978      the Free Software Foundation, either version 3 of the License, or
  4979      (at your option) any later version.
  4980  
  4981      web3.js is distributed in the hope that it will be useful,
  4982      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4983      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4984      GNU Lesser General Public License for more details.
  4985  
  4986      You should have received a copy of the GNU Lesser General Public License
  4987      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4988  */
  4989  /**
  4990   * @file method.js
  4991   * @author Marek Kotewicz <marek@ethdev.com>
  4992   * @date 2015
  4993   */
  4994  
  4995  var utils = require('../utils/utils');
  4996  var errors = require('./errors');
  4997  
  4998  var Method = function (options) {
  4999      this.name = options.name;
  5000      this.call = options.call;
  5001      this.params = options.params || 0;
  5002      this.inputFormatter = options.inputFormatter;
  5003      this.outputFormatter = options.outputFormatter;
  5004      this.requestManager = null;
  5005  };
  5006  
  5007  Method.prototype.setRequestManager = function (rm) {
  5008      this.requestManager = rm;
  5009  };
  5010  
  5011  /**
  5012   * Should be used to determine name of the jsonrpc method based on arguments
  5013   *
  5014   * @method getCall
  5015   * @param {Array} arguments
  5016   * @return {String} name of jsonrpc method
  5017   */
  5018  Method.prototype.getCall = function (args) {
  5019      return utils.isFunction(this.call) ? this.call(args) : this.call;
  5020  };
  5021  
  5022  /**
  5023   * Should be used to extract callback from array of arguments. Modifies input param
  5024   *
  5025   * @method extractCallback
  5026   * @param {Array} arguments
  5027   * @return {Function|Null} callback, if exists
  5028   */
  5029  Method.prototype.extractCallback = function (args) {
  5030      if (utils.isFunction(args[args.length - 1])) {
  5031          return args.pop(); // modify the args array!
  5032      }
  5033  };
  5034  
  5035  /**
  5036   * Should be called to check if the number of arguments is correct
  5037   * 
  5038   * @method validateArgs
  5039   * @param {Array} arguments
  5040   * @throws {Error} if it is not
  5041   */
  5042  Method.prototype.validateArgs = function (args) {
  5043      if (args.length !== this.params) {
  5044          throw errors.InvalidNumberOfRPCParams();
  5045      }
  5046  };
  5047  
  5048  /**
  5049   * Should be called to format input args of method
  5050   * 
  5051   * @method formatInput
  5052   * @param {Array}
  5053   * @return {Array}
  5054   */
  5055  Method.prototype.formatInput = function (args) {
  5056      if (!this.inputFormatter) {
  5057          return args;
  5058      }
  5059  
  5060      return this.inputFormatter.map(function (formatter, index) {
  5061          return formatter ? formatter(args[index]) : args[index];
  5062      });
  5063  };
  5064  
  5065  /**
  5066   * Should be called to format output(result) of method
  5067   *
  5068   * @method formatOutput
  5069   * @param {Object}
  5070   * @return {Object}
  5071   */
  5072  Method.prototype.formatOutput = function (result) {
  5073      return this.outputFormatter && result ? this.outputFormatter(result) : result;
  5074  };
  5075  
  5076  /**
  5077   * Should create payload from given input args
  5078   *
  5079   * @method toPayload
  5080   * @param {Array} args
  5081   * @return {Object}
  5082   */
  5083  Method.prototype.toPayload = function (args) {
  5084      var call = this.getCall(args);
  5085      var callback = this.extractCallback(args);
  5086      var params = this.formatInput(args);
  5087      this.validateArgs(params);
  5088  
  5089      return {
  5090          method: call,
  5091          params: params,
  5092          callback: callback
  5093      };
  5094  };
  5095  
  5096  Method.prototype.attachToObject = function (obj) {
  5097      var func = this.buildCall();
  5098      func.call = this.call; // TODO!!! that's ugly. filter.js uses it
  5099      var name = this.name.split('.');
  5100      if (name.length > 1) {
  5101          obj[name[0]] = obj[name[0]] || {};
  5102          obj[name[0]][name[1]] = func;
  5103      } else {
  5104          obj[name[0]] = func; 
  5105      }
  5106  };
  5107  
  5108  Method.prototype.buildCall = function() {
  5109      var method = this;
  5110      var send = function () {
  5111          var payload = method.toPayload(Array.prototype.slice.call(arguments));
  5112          if (payload.callback) {
  5113              return method.requestManager.sendAsync(payload, function (err, result) {
  5114                  payload.callback(err, method.formatOutput(result));
  5115              });
  5116          }
  5117          return method.formatOutput(method.requestManager.send(payload));
  5118      };
  5119      send.request = this.request.bind(this);
  5120      return send;
  5121  };
  5122  
  5123  /**
  5124   * Should be called to create pure JSONRPC request which can be used in batch request
  5125   *
  5126   * @method request
  5127   * @param {...} params
  5128   * @return {Object} jsonrpc request
  5129   */
  5130  Method.prototype.request = function () {
  5131      var payload = this.toPayload(Array.prototype.slice.call(arguments));
  5132      payload.format = this.formatOutput.bind(this);
  5133      return payload;
  5134  };
  5135  
  5136  module.exports = Method;
  5137  
  5138  },{"../utils/utils":20,"./errors":26}],37:[function(require,module,exports){
  5139  /*
  5140      This file is part of web3.js.
  5141  
  5142      web3.js is free software: you can redistribute it and/or modify
  5143      it under the terms of the GNU Lesser General Public License as published by
  5144      the Free Software Foundation, either version 3 of the License, or
  5145      (at your option) any later version.
  5146  
  5147      web3.js is distributed in the hope that it will be useful,
  5148      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5149      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5150      GNU Lesser General Public License for more details.
  5151  
  5152      You should have received a copy of the GNU Lesser General Public License
  5153      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5154  */
  5155  /** @file db.js
  5156   * @authors:
  5157   *   Marek Kotewicz <marek@ethdev.com>
  5158   * @date 2015
  5159   */
  5160  
  5161  var Method = require('../method');
  5162  
  5163  var DB = function (web3) {
  5164      this._requestManager = web3._requestManager;
  5165  
  5166      var self = this;
  5167      
  5168      methods().forEach(function(method) { 
  5169          method.attachToObject(self);
  5170          method.setRequestManager(web3._requestManager);
  5171      });
  5172  };
  5173  
  5174  var methods = function () {
  5175      var putString = new Method({
  5176          name: 'putString',
  5177          call: 'db_putString',
  5178          params: 3
  5179      });
  5180  
  5181      var getString = new Method({
  5182          name: 'getString',
  5183          call: 'db_getString',
  5184          params: 2
  5185      });
  5186  
  5187      var putHex = new Method({
  5188          name: 'putHex',
  5189          call: 'db_putHex',
  5190          params: 3
  5191      });
  5192  
  5193      var getHex = new Method({
  5194          name: 'getHex',
  5195          call: 'db_getHex',
  5196          params: 2
  5197      });
  5198  
  5199      return [
  5200          putString, getString, putHex, getHex
  5201      ];
  5202  };
  5203  
  5204  module.exports = DB;
  5205  
  5206  },{"../method":36}],38:[function(require,module,exports){
  5207  /*
  5208      This file is part of web3.js.
  5209  
  5210      web3.js is free software: you can redistribute it and/or modify
  5211      it under the terms of the GNU Lesser General Public License as published by
  5212      the Free Software Foundation, either version 3 of the License, or
  5213      (at your option) any later version.
  5214  
  5215      web3.js is distributed in the hope that it will be useful,
  5216      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5217      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5218      GNU Lesser General Public License for more details.
  5219  
  5220      You should have received a copy of the GNU Lesser General Public License
  5221      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5222  */
  5223  /**
  5224   * @file eth.js
  5225   * @author Marek Kotewicz <marek@ethdev.com>
  5226   * @author Fabian Vogelsteller <fabian@ethdev.com>
  5227   * @date 2015
  5228   */
  5229  
  5230  "use strict";
  5231  
  5232  var formatters = require('../formatters');
  5233  var utils = require('../../utils/utils');
  5234  var Method = require('../method');
  5235  var Property = require('../property');
  5236  var c = require('../../utils/config');
  5237  var Contract = require('../contract');
  5238  var watches = require('./watches');
  5239  var Filter = require('../filter');
  5240  var IsSyncing = require('../syncing');
  5241  var namereg = require('../namereg');
  5242  var Iban = require('../iban');
  5243  var transfer = require('../transfer');
  5244  
  5245  var blockCall = function (args) {
  5246      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber";
  5247  };
  5248  
  5249  var transactionFromBlockCall = function (args) {
  5250      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';
  5251  };
  5252  
  5253  var uncleCall = function (args) {
  5254      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';
  5255  };
  5256  
  5257  var getBlockTransactionCountCall = function (args) {
  5258      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';
  5259  };
  5260  
  5261  var uncleCountCall = function (args) {
  5262      return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';
  5263  };
  5264  
  5265  function Eth(web3) {
  5266      this._requestManager = web3._requestManager;
  5267  
  5268      var self = this;
  5269  
  5270      methods().forEach(function(method) {
  5271          method.attachToObject(self);
  5272          method.setRequestManager(self._requestManager);
  5273      });
  5274  
  5275      properties().forEach(function(p) {
  5276          p.attachToObject(self);
  5277          p.setRequestManager(self._requestManager);
  5278      });
  5279  
  5280  
  5281      this.iban = Iban;
  5282      this.sendIBANTransaction = transfer.bind(null, this);
  5283  }
  5284  
  5285  Object.defineProperty(Eth.prototype, 'defaultBlock', {
  5286      get: function () {
  5287          return c.defaultBlock;
  5288      },
  5289      set: function (val) {
  5290          c.defaultBlock = val;
  5291          return val;
  5292      }
  5293  });
  5294  
  5295  Object.defineProperty(Eth.prototype, 'defaultAccount', {
  5296      get: function () {
  5297          return c.defaultAccount;
  5298      },
  5299      set: function (val) {
  5300          c.defaultAccount = val;
  5301          return val;
  5302      }
  5303  });
  5304  
  5305  var methods = function () {
  5306      var getBalance = new Method({
  5307          name: 'getBalance',
  5308          call: 'eth_getBalance',
  5309          params: 2,
  5310          inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
  5311          outputFormatter: formatters.outputBigNumberFormatter
  5312      });
  5313  
  5314      var getStorageAt = new Method({
  5315          name: 'getStorageAt',
  5316          call: 'eth_getStorageAt',
  5317          params: 3,
  5318          inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
  5319      });
  5320  
  5321      var getCode = new Method({
  5322          name: 'getCode',
  5323          call: 'eth_getCode',
  5324          params: 2,
  5325          inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
  5326      });
  5327  
  5328      var getBlock = new Method({
  5329          name: 'getBlock',
  5330          call: blockCall,
  5331          params: 2,
  5332          inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
  5333          outputFormatter: formatters.outputBlockFormatter
  5334      });
  5335  
  5336      var getUncle = new Method({
  5337          name: 'getUncle',
  5338          call: uncleCall,
  5339          params: 2,
  5340          inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],
  5341          outputFormatter: formatters.outputBlockFormatter,
  5342  
  5343      });
  5344  
  5345      var getCompilers = new Method({
  5346          name: 'getCompilers',
  5347          call: 'eth_getCompilers',
  5348          params: 0
  5349      });
  5350  
  5351      var getBlockTransactionCount = new Method({
  5352          name: 'getBlockTransactionCount',
  5353          call: getBlockTransactionCountCall,
  5354          params: 1,
  5355          inputFormatter: [formatters.inputBlockNumberFormatter],
  5356          outputFormatter: utils.toDecimal
  5357      });
  5358  
  5359      var getBlockUncleCount = new Method({
  5360          name: 'getBlockUncleCount',
  5361          call: uncleCountCall,
  5362          params: 1,
  5363          inputFormatter: [formatters.inputBlockNumberFormatter],
  5364          outputFormatter: utils.toDecimal
  5365      });
  5366  
  5367      var getTransaction = new Method({
  5368          name: 'getTransaction',
  5369          call: 'eth_getTransactionByHash',
  5370          params: 1,
  5371          outputFormatter: formatters.outputTransactionFormatter
  5372      });
  5373  
  5374      var getTransactionFromBlock = new Method({
  5375          name: 'getTransactionFromBlock',
  5376          call: transactionFromBlockCall,
  5377          params: 2,
  5378          inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],
  5379          outputFormatter: formatters.outputTransactionFormatter
  5380      });
  5381  
  5382      var getTransactionDataAndReceipt = new Method({
  5383        name: 'getTransactionDataAndReceipt',
  5384        call: 'eth_getTransactionDataAndReceipt',
  5385        params: 1,
  5386        outputFormatter: formatters.outputTransactionDataAndReceiptFormatter
  5387      });
  5388  
  5389      var getTransactionsByBlockNumber = new Method({
  5390        name: 'getTransactionsByBlockNumber',
  5391        call: 'eth_getTransactionsByBlockNumber',
  5392        params: 1,
  5393        outputFormatter: formatters.outputTransactionFormatter
  5394      });
  5395  
  5396      var getTransactionReceiptsByBlockNumber = new Method({
  5397        name: 'getTransactionReceiptsByBlockNumber',
  5398        call: 'eth_getTransactionReceiptsByBlockNumber',
  5399        params: 1,
  5400        outputFormatter: formatters.outputTransactionReceiptFormatter
  5401      });
  5402  
  5403      var getTransactionReceipt = new Method({
  5404          name: 'getTransactionReceipt',
  5405          call: 'eth_getTransactionReceipt',
  5406          params: 1,
  5407          outputFormatter: formatters.outputTransactionReceiptFormatter
  5408      });
  5409  
  5410      var getTransactionCount = new Method({
  5411          name: 'getTransactionCount',
  5412          call: 'eth_getTransactionCount',
  5413          params: 2,
  5414          inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
  5415          outputFormatter: utils.toDecimal
  5416      });
  5417  
  5418      var sendRawTransaction = new Method({
  5419          name: 'sendRawTransaction',
  5420          call: 'eth_sendRawTransaction',
  5421          params: 1,
  5422          inputFormatter: [null]
  5423      });
  5424  
  5425      var sendTransaction = new Method({
  5426          name: 'sendTransaction',
  5427          call: 'eth_sendTransaction',
  5428          params: 1,
  5429          inputFormatter: [formatters.inputTransactionFormatter]
  5430      });
  5431  
  5432      var signTransaction = new Method({
  5433          name: 'signTransaction',
  5434          call: 'eth_signTransaction',
  5435          params: 1,
  5436          inputFormatter: [formatters.inputTransactionFormatter]
  5437      });
  5438  
  5439      var sign = new Method({
  5440          name: 'sign',
  5441          call: 'eth_sign',
  5442          params: 2,
  5443          inputFormatter: [formatters.inputAddressFormatter, null]
  5444      });
  5445  
  5446      var call = new Method({
  5447          name: 'call',
  5448          call: 'eth_call',
  5449          params: 2,
  5450          inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
  5451      });
  5452  
  5453      var estimateGas = new Method({
  5454          name: 'estimateGas',
  5455          call: 'eth_estimateGas',
  5456          params: 1,
  5457          inputFormatter: [formatters.inputCallFormatter],
  5458          outputFormatter: utils.toDecimal
  5459      });
  5460  
  5461      var compileSolidity = new Method({
  5462          name: 'compile.solidity',
  5463          call: 'eth_compileSolidity',
  5464          params: 1
  5465      });
  5466  
  5467      var compileLLL = new Method({
  5468          name: 'compile.lll',
  5469          call: 'eth_compileLLL',
  5470          params: 1
  5471      });
  5472  
  5473      var compileSerpent = new Method({
  5474          name: 'compile.serpent',
  5475          call: 'eth_compileSerpent',
  5476          params: 1
  5477      });
  5478  
  5479      var submitWork = new Method({
  5480          name: 'submitWork',
  5481          call: 'eth_submitWork',
  5482          params: 3
  5483      });
  5484  
  5485      var getWork = new Method({
  5486          name: 'getWork',
  5487          call: 'eth_getWork',
  5488          params: 0
  5489      });
  5490  
  5491      return [
  5492          getBalance,
  5493          getStorageAt,
  5494          getCode,
  5495          getBlock,
  5496          getUncle,
  5497          getCompilers,
  5498          getBlockTransactionCount,
  5499          getBlockUncleCount,
  5500          getTransaction,
  5501          getTransactionFromBlock,
  5502          getTransactionsByBlockNumber,
  5503          getTransactionReceiptsByBlockNumber,
  5504          getTransactionDataAndReceipt,
  5505          getTransactionReceipt,
  5506          getTransactionCount,
  5507          call,
  5508          estimateGas,
  5509          sendRawTransaction,
  5510          signTransaction,
  5511          sendTransaction,
  5512          sign,
  5513          compileSolidity,
  5514          compileLLL,
  5515          compileSerpent,
  5516          submitWork,
  5517          getWork
  5518      ];
  5519  };
  5520  
  5521  
  5522  var properties = function () {
  5523      return [
  5524          new Property({
  5525              name: 'coinbase',
  5526              getter: 'eth_coinbase'
  5527          }),
  5528          new Property({
  5529              name: 'mining',
  5530              getter: 'eth_mining'
  5531          }),
  5532          new Property({
  5533              name: 'hashrate',
  5534              getter: 'eth_hashrate',
  5535              outputFormatter: utils.toDecimal
  5536          }),
  5537          new Property({
  5538              name: 'syncing',
  5539              getter: 'eth_syncing',
  5540              outputFormatter: formatters.outputSyncingFormatter
  5541          }),
  5542          new Property({
  5543              name: 'gasPrice',
  5544              getter: 'eth_gasPrice',
  5545              outputFormatter: formatters.outputBigNumberFormatter
  5546          }),
  5547          new Property({
  5548              name: 'accounts',
  5549              getter: 'eth_accounts'
  5550          }),
  5551          new Property({
  5552              name: 'blockNumber',
  5553              getter: 'eth_blockNumber',
  5554              outputFormatter: utils.toDecimal
  5555          }),
  5556          new Property({
  5557              name: 'protocolVersion',
  5558              getter: 'eth_protocolVersion'
  5559          })
  5560      ];
  5561  };
  5562  
  5563  Eth.prototype.contract = function (abi) {
  5564      var factory = new Contract(this, abi);
  5565      return factory;
  5566  };
  5567  
  5568  Eth.prototype.filter = function (options, callback, filterCreationErrorCallback) {
  5569      return new Filter(options, 'eth', this._requestManager, watches.eth(), formatters.outputLogFormatter, callback, filterCreationErrorCallback);
  5570  };
  5571  
  5572  Eth.prototype.namereg = function () {
  5573      return this.contract(namereg.global.abi).at(namereg.global.address);
  5574  };
  5575  
  5576  Eth.prototype.icapNamereg = function () {
  5577      return this.contract(namereg.icap.abi).at(namereg.icap.address);
  5578  };
  5579  
  5580  Eth.prototype.isSyncing = function (callback) {
  5581      return new IsSyncing(this._requestManager, callback);
  5582  };
  5583  
  5584  module.exports = Eth;
  5585  
  5586  },{"../../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){
  5587  /*
  5588      This file is part of web3.js.
  5589  
  5590      web3.js is free software: you can redistribute it and/or modify
  5591      it under the terms of the GNU Lesser General Public License as published by
  5592      the Free Software Foundation, either version 3 of the License, or
  5593      (at your option) any later version.
  5594  
  5595      web3.js is distributed in the hope that it will be useful,
  5596      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5597      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5598      GNU Lesser General Public License for more details.
  5599  
  5600      You should have received a copy of the GNU Lesser General Public License
  5601      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5602  */
  5603  /** @file eth.js
  5604   * @authors:
  5605   *   Marek Kotewicz <marek@ethdev.com>
  5606   * @date 2015
  5607   */
  5608  
  5609  var utils = require('../../utils/utils');
  5610  var Property = require('../property');
  5611  
  5612  var Net = function (web3) {
  5613      this._requestManager = web3._requestManager;
  5614  
  5615      var self = this;
  5616  
  5617      properties().forEach(function(p) { 
  5618          p.attachToObject(self);
  5619          p.setRequestManager(web3._requestManager);
  5620      });
  5621  };
  5622  
  5623  /// @returns an array of objects describing web3.eth api properties
  5624  var properties = function () {
  5625      return [
  5626          new Property({
  5627              name: 'listening',
  5628              getter: 'net_listening'
  5629          }),
  5630          new Property({
  5631              name: 'peerCount',
  5632              getter: 'net_peerCount',
  5633              outputFormatter: utils.toDecimal
  5634          })
  5635      ];
  5636  };
  5637  
  5638  module.exports = Net;
  5639  
  5640  },{"../../utils/utils":20,"../property":45}],40:[function(require,module,exports){
  5641  /*
  5642      This file is part of web3.js.
  5643  
  5644      web3.js is free software: you can redistribute it and/or modify
  5645      it under the terms of the GNU Lesser General Public License as published by
  5646      the Free Software Foundation, either version 3 of the License, or
  5647      (at your option) any later version.
  5648  
  5649      web3.js is distributed in the hope that it will be useful,
  5650      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5651      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5652      GNU Lesser General Public License for more details.
  5653  
  5654      You should have received a copy of the GNU Lesser General Public License
  5655      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5656  */
  5657  /**
  5658   * @file eth.js
  5659   * @author Marek Kotewicz <marek@ethdev.com>
  5660   * @author Fabian Vogelsteller <fabian@ethdev.com>
  5661   * @date 2015
  5662   */
  5663  
  5664  "use strict";
  5665  
  5666  var Method = require('../method');
  5667  var Property = require('../property');
  5668  var formatters = require('../formatters');
  5669  
  5670  function Personal(web3) {
  5671      this._requestManager = web3._requestManager;
  5672  
  5673      var self = this;
  5674  
  5675      methods().forEach(function(method) {
  5676          method.attachToObject(self);
  5677          method.setRequestManager(self._requestManager);
  5678      });
  5679  
  5680      properties().forEach(function(p) {
  5681          p.attachToObject(self);
  5682          p.setRequestManager(self._requestManager);
  5683      });
  5684  }
  5685  
  5686  var methods = function () {
  5687      var newAccount = new Method({
  5688          name: 'newAccount',
  5689          call: 'personal_newAccount',
  5690          params: 1,
  5691          inputFormatter: [null]
  5692      });
  5693  
  5694      var importRawKey = new Method({
  5695          name: 'importRawKey',
  5696  		call: 'personal_importRawKey',
  5697  		params: 2
  5698      });
  5699  
  5700      var sign = new Method({
  5701          name: 'sign',
  5702  		call: 'personal_sign',
  5703  		params: 3,
  5704  		inputFormatter: [null, formatters.inputAddressFormatter, null]
  5705      });
  5706  
  5707      var ecRecover = new Method({
  5708          name: 'ecRecover',
  5709  		call: 'personal_ecRecover',
  5710  		params: 2
  5711      });
  5712  
  5713      var unlockAccount = new Method({
  5714          name: 'unlockAccount',
  5715          call: 'personal_unlockAccount',
  5716          params: 3,
  5717          inputFormatter: [formatters.inputAddressFormatter, null, null]
  5718      });
  5719  
  5720      var sendTransaction = new Method({
  5721          name: 'sendTransaction',
  5722          call: 'personal_sendTransaction',
  5723          params: 2,
  5724          inputFormatter: [formatters.inputTransactionFormatter, null]
  5725      });
  5726  
  5727      var lockAccount = new Method({
  5728          name: 'lockAccount',
  5729          call: 'personal_lockAccount',
  5730          params: 1,
  5731          inputFormatter: [formatters.inputAddressFormatter]
  5732      });
  5733  
  5734      return [
  5735          newAccount,
  5736          importRawKey,
  5737          unlockAccount,
  5738          ecRecover,
  5739          sign,
  5740          sendTransaction,
  5741          lockAccount
  5742      ];
  5743  };
  5744  
  5745  var properties = function () {
  5746      return [
  5747          new Property({
  5748              name: 'listAccounts',
  5749              getter: 'personal_listAccounts'
  5750          })
  5751      ];
  5752  };
  5753  
  5754  
  5755  module.exports = Personal;
  5756  
  5757  },{"../formatters":30,"../method":36,"../property":45}],41:[function(require,module,exports){
  5758  /*
  5759      This file is part of web3.js.
  5760  
  5761      web3.js is free software: you can redistribute it and/or modify
  5762      it under the terms of the GNU Lesser General Public License as published by
  5763      the Free Software Foundation, either version 3 of the License, or
  5764      (at your option) any later version.
  5765  
  5766      web3.js is distributed in the hope that it will be useful,
  5767      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5768      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5769      GNU Lesser General Public License for more details.
  5770  
  5771      You should have received a copy of the GNU Lesser General Public License
  5772      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5773  */
  5774  /** @file shh.js
  5775   * @authors:
  5776   *   Fabian Vogelsteller <fabian@ethereum.org>
  5777   *   Marek Kotewicz <marek@ethcore.io>
  5778   * @date 2017
  5779   */
  5780  
  5781  var Method = require('../method');
  5782  var Filter = require('../filter');
  5783  var watches = require('./watches');
  5784  
  5785  var Shh = function (web3) {
  5786      this._requestManager = web3._requestManager;
  5787  
  5788      var self = this;
  5789  
  5790      methods().forEach(function(method) {
  5791          method.attachToObject(self);
  5792          method.setRequestManager(self._requestManager);
  5793      });
  5794  };
  5795  
  5796  Shh.prototype.newMessageFilter = function (options, callback, filterCreationErrorCallback) {
  5797      return new Filter(options, 'shh', this._requestManager, watches.shh(), null, callback, filterCreationErrorCallback);
  5798  };
  5799  
  5800  var methods = function () {
  5801  
  5802      return [
  5803          new Method({
  5804              name: 'version',
  5805              call: 'shh_version',
  5806              params: 0
  5807          }),
  5808          new Method({
  5809              name: 'info',
  5810              call: 'shh_info',
  5811              params: 0
  5812          }),
  5813          new Method({
  5814              name: 'setMaxMessageSize',
  5815              call: 'shh_setMaxMessageSize',
  5816              params: 1
  5817          }),
  5818          new Method({
  5819              name: 'setMinPoW',
  5820              call: 'shh_setMinPoW',
  5821              params: 1
  5822          }),
  5823          new Method({
  5824              name: 'markTrustedPeer',
  5825              call: 'shh_markTrustedPeer',
  5826              params: 1
  5827          }),
  5828          new Method({
  5829              name: 'newKeyPair',
  5830              call: 'shh_newKeyPair',
  5831              params: 0
  5832          }),
  5833          new Method({
  5834              name: 'addPrivateKey',
  5835              call: 'shh_addPrivateKey',
  5836              params: 1
  5837          }),
  5838          new Method({
  5839              name: 'deleteKeyPair',
  5840              call: 'shh_deleteKeyPair',
  5841              params: 1
  5842          }),
  5843          new Method({
  5844              name: 'hasKeyPair',
  5845              call: 'shh_hasKeyPair',
  5846              params: 1
  5847          }),
  5848          new Method({
  5849              name: 'getPublicKey',
  5850              call: 'shh_getPublicKey',
  5851              params: 1
  5852          }),
  5853          new Method({
  5854              name: 'getPrivateKey',
  5855              call: 'shh_getPrivateKey',
  5856              params: 1
  5857          }),
  5858          new Method({
  5859              name: 'newSymKey',
  5860              call: 'shh_newSymKey',
  5861              params: 0
  5862          }),
  5863          new Method({
  5864              name: 'addSymKey',
  5865              call: 'shh_addSymKey',
  5866              params: 1
  5867          }),
  5868          new Method({
  5869              name: 'generateSymKeyFromPassword',
  5870              call: 'shh_generateSymKeyFromPassword',
  5871              params: 1
  5872          }),
  5873          new Method({
  5874              name: 'hasSymKey',
  5875              call: 'shh_hasSymKey',
  5876              params: 1
  5877          }),
  5878          new Method({
  5879              name: 'getSymKey',
  5880              call: 'shh_getSymKey',
  5881              params: 1
  5882          }),
  5883          new Method({
  5884              name: 'deleteSymKey',
  5885              call: 'shh_deleteSymKey',
  5886              params: 1
  5887          }),
  5888  
  5889          // subscribe and unsubscribe missing
  5890  
  5891          new Method({
  5892              name: 'post',
  5893              call: 'shh_post',
  5894              params: 1,
  5895              inputFormatter: [null]
  5896          })
  5897      ];
  5898  };
  5899  
  5900  module.exports = Shh;
  5901  
  5902  
  5903  },{"../filter":29,"../method":36,"./watches":43}],42:[function(require,module,exports){
  5904  /*
  5905      This file is part of web3.js.
  5906  
  5907      web3.js is free software: you can redistribute it and/or modify
  5908      it under the terms of the GNU Lesser General Public License as published by
  5909      the Free Software Foundation, either version 3 of the License, or
  5910      (at your option) any later version.
  5911  
  5912      web3.js is distributed in the hope that it will be useful,
  5913      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5914      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5915      GNU Lesser General Public License for more details.
  5916  
  5917      You should have received a copy of the GNU Lesser General Public License
  5918      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5919  */
  5920  /**
  5921   * @file bzz.js
  5922   * @author Alex Beregszaszi <alex@rtfs.hu>
  5923   * @date 2016
  5924   *
  5925   * Reference: https://github.com/fff-chain/go-fff/blob/swarm/internal/web3ext/web3ext.go#L33
  5926   */
  5927  
  5928  "use strict";
  5929  
  5930  var Method = require('../method');
  5931  var Property = require('../property');
  5932  
  5933  function Swarm(web3) {
  5934      this._requestManager = web3._requestManager;
  5935  
  5936      var self = this;
  5937  
  5938      methods().forEach(function(method) {
  5939          method.attachToObject(self);
  5940          method.setRequestManager(self._requestManager);
  5941      });
  5942  
  5943      properties().forEach(function(p) {
  5944          p.attachToObject(self);
  5945          p.setRequestManager(self._requestManager);
  5946      });
  5947  }
  5948  
  5949  var methods = function () {
  5950      var blockNetworkRead = new Method({
  5951          name: 'blockNetworkRead',
  5952          call: 'bzz_blockNetworkRead',
  5953          params: 1,
  5954          inputFormatter: [null]
  5955      });
  5956  
  5957      var syncEnabled = new Method({
  5958          name: 'syncEnabled',
  5959          call: 'bzz_syncEnabled',
  5960          params: 1,
  5961          inputFormatter: [null]
  5962      });
  5963  
  5964      var swapEnabled = new Method({
  5965          name: 'swapEnabled',
  5966          call: 'bzz_swapEnabled',
  5967          params: 1,
  5968          inputFormatter: [null]
  5969      });
  5970  
  5971      var download = new Method({
  5972          name: 'download',
  5973          call: 'bzz_download',
  5974          params: 2,
  5975          inputFormatter: [null, null]
  5976      });
  5977  
  5978      var upload = new Method({
  5979          name: 'upload',
  5980          call: 'bzz_upload',
  5981          params: 2,
  5982          inputFormatter: [null, null]
  5983      });
  5984  
  5985      var retrieve = new Method({
  5986          name: 'retrieve',
  5987          call: 'bzz_retrieve',
  5988          params: 1,
  5989          inputFormatter: [null]
  5990      });
  5991  
  5992      var store = new Method({
  5993          name: 'store',
  5994          call: 'bzz_store',
  5995          params: 2,
  5996          inputFormatter: [null, null]
  5997      });
  5998  
  5999      var get = new Method({
  6000          name: 'get',
  6001          call: 'bzz_get',
  6002          params: 1,
  6003          inputFormatter: [null]
  6004      });
  6005  
  6006      var put = new Method({
  6007          name: 'put',
  6008          call: 'bzz_put',
  6009          params: 2,
  6010          inputFormatter: [null, null]
  6011      });
  6012  
  6013      var modify = new Method({
  6014          name: 'modify',
  6015          call: 'bzz_modify',
  6016          params: 4,
  6017          inputFormatter: [null, null, null, null]
  6018      });
  6019  
  6020      return [
  6021          blockNetworkRead,
  6022          syncEnabled,
  6023          swapEnabled,
  6024          download,
  6025          upload,
  6026          retrieve,
  6027          store,
  6028          get,
  6029          put,
  6030          modify
  6031      ];
  6032  };
  6033  
  6034  var properties = function () {
  6035      return [
  6036          new Property({
  6037              name: 'hive',
  6038              getter: 'bzz_hive'
  6039          }),
  6040          new Property({
  6041              name: 'info',
  6042              getter: 'bzz_info'
  6043          })
  6044      ];
  6045  };
  6046  
  6047  
  6048  module.exports = Swarm;
  6049  
  6050  },{"../method":36,"../property":45}],43:[function(require,module,exports){
  6051  /*
  6052      This file is part of web3.js.
  6053  
  6054      web3.js is free software: you can redistribute it and/or modify
  6055      it under the terms of the GNU Lesser General Public License as published by
  6056      the Free Software Foundation, either version 3 of the License, or
  6057      (at your option) any later version.
  6058  
  6059      web3.js is distributed in the hope that it will be useful,
  6060      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6061      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6062      GNU Lesser General Public License for more details.
  6063  
  6064      You should have received a copy of the GNU Lesser General Public License
  6065      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6066  */
  6067  /** @file watches.js
  6068   * @authors:
  6069   *   Marek Kotewicz <marek@ethdev.com>
  6070   * @date 2015
  6071   */
  6072  
  6073  var Method = require('../method');
  6074  
  6075  /// @returns an array of objects describing web3.eth.filter api methods
  6076  var eth = function () {
  6077      var newFilterCall = function (args) {
  6078          var type = args[0];
  6079  
  6080          switch(type) {
  6081              case 'latest':
  6082                  args.shift();
  6083                  this.params = 0;
  6084                  return 'eth_newBlockFilter';
  6085              case 'pending':
  6086                  args.shift();
  6087                  this.params = 0;
  6088                  return 'eth_newPendingTransactionFilter';
  6089              default:
  6090                  return 'eth_newFilter';
  6091          }
  6092      };
  6093  
  6094      var newFilter = new Method({
  6095          name: 'newFilter',
  6096          call: newFilterCall,
  6097          params: 1
  6098      });
  6099  
  6100      var uninstallFilter = new Method({
  6101          name: 'uninstallFilter',
  6102          call: 'eth_uninstallFilter',
  6103          params: 1
  6104      });
  6105  
  6106      var getLogs = new Method({
  6107          name: 'getLogs',
  6108          call: 'eth_getFilterLogs',
  6109          params: 1
  6110      });
  6111  
  6112      var poll = new Method({
  6113          name: 'poll',
  6114          call: 'eth_getFilterChanges',
  6115          params: 1
  6116      });
  6117  
  6118      return [
  6119          newFilter,
  6120          uninstallFilter,
  6121          getLogs,
  6122          poll
  6123      ];
  6124  };
  6125  
  6126  /// @returns an array of objects describing web3.shh.watch api methods
  6127  var shh = function () {
  6128  
  6129      return [
  6130          new Method({
  6131              name: 'newFilter',
  6132              call: 'shh_newMessageFilter',
  6133              params: 1
  6134          }),
  6135          new Method({
  6136              name: 'uninstallFilter',
  6137              call: 'shh_deleteMessageFilter',
  6138              params: 1
  6139          }),
  6140          new Method({
  6141              name: 'getLogs',
  6142              call: 'shh_getFilterMessages',
  6143              params: 1
  6144          }),
  6145          new Method({
  6146              name: 'poll',
  6147              call: 'shh_getFilterMessages',
  6148              params: 1
  6149          })
  6150      ];
  6151  };
  6152  
  6153  module.exports = {
  6154      eth: eth,
  6155      shh: shh
  6156  };
  6157  
  6158  
  6159  },{"../method":36}],44:[function(require,module,exports){
  6160  /*
  6161      This file is part of web3.js.
  6162  
  6163      web3.js is free software: you can redistribute it and/or modify
  6164      it under the terms of the GNU Lesser General Public License as published by
  6165      the Free Software Foundation, either version 3 of the License, or
  6166      (at your option) any later version.
  6167  
  6168      web3.js is distributed in the hope that it will be useful,
  6169      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6170      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6171      GNU Lesser General Public License for more details.
  6172  
  6173      You should have received a copy of the GNU Lesser General Public License
  6174      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6175  */
  6176  /** 
  6177   * @file namereg.js
  6178   * @author Marek Kotewicz <marek@ethdev.com>
  6179   * @date 2015
  6180   */
  6181  
  6182  var globalRegistrarAbi = require('../contracts/GlobalRegistrar.json');
  6183  var icapRegistrarAbi= require('../contracts/ICAPRegistrar.json');
  6184  
  6185  var globalNameregAddress = '0xc6d9d2cd449a754c494264e1809c50e34d64562b';
  6186  var icapNameregAddress = '0xa1a111bc074c9cfa781f0c38e63bd51c91b8af00';
  6187  
  6188  module.exports = {
  6189      global: {
  6190          abi: globalRegistrarAbi,
  6191          address: globalNameregAddress
  6192      },
  6193      icap: {
  6194          abi: icapRegistrarAbi,
  6195          address: icapNameregAddress
  6196      }
  6197  };
  6198  
  6199  
  6200  },{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2}],45:[function(require,module,exports){
  6201  /*
  6202      This file is part of web3.js.
  6203  
  6204      web3.js is free software: you can redistribute it and/or modify
  6205      it under the terms of the GNU Lesser General Public License as published by
  6206      the Free Software Foundation, either version 3 of the License, or
  6207      (at your option) any later version.
  6208  
  6209      web3.js is distributed in the hope that it will be useful,
  6210      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6211      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6212      GNU Lesser General Public License for more details.
  6213  
  6214      You should have received a copy of the GNU Lesser General Public License
  6215      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6216  */
  6217  /**
  6218   * @file property.js
  6219   * @author Fabian Vogelsteller <fabian@frozeman.de>
  6220   * @author Marek Kotewicz <marek@ethdev.com>
  6221   * @date 2015
  6222   */
  6223  
  6224  var utils = require('../utils/utils');
  6225  
  6226  var Property = function (options) {
  6227      this.name = options.name;
  6228      this.getter = options.getter;
  6229      this.setter = options.setter;
  6230      this.outputFormatter = options.outputFormatter;
  6231      this.inputFormatter = options.inputFormatter;
  6232      this.requestManager = null;
  6233  };
  6234  
  6235  Property.prototype.setRequestManager = function (rm) {
  6236      this.requestManager = rm;
  6237  };
  6238  
  6239  /**
  6240   * Should be called to format input args of method
  6241   *
  6242   * @method formatInput
  6243   * @param {Array}
  6244   * @return {Array}
  6245   */
  6246  Property.prototype.formatInput = function (arg) {
  6247      return this.inputFormatter ? this.inputFormatter(arg) : arg;
  6248  };
  6249  
  6250  /**
  6251   * Should be called to format output(result) of method
  6252   *
  6253   * @method formatOutput
  6254   * @param {Object}
  6255   * @return {Object}
  6256   */
  6257  Property.prototype.formatOutput = function (result) {
  6258      return this.outputFormatter && result !== null && result !== undefined ? this.outputFormatter(result) : result;
  6259  };
  6260  
  6261  /**
  6262   * Should be used to extract callback from array of arguments. Modifies input param
  6263   *
  6264   * @method extractCallback
  6265   * @param {Array} arguments
  6266   * @return {Function|Null} callback, if exists
  6267   */
  6268  Property.prototype.extractCallback = function (args) {
  6269      if (utils.isFunction(args[args.length - 1])) {
  6270          return args.pop(); // modify the args array!
  6271      }
  6272  };
  6273  
  6274  
  6275  /**
  6276   * Should attach function to method
  6277   *
  6278   * @method attachToObject
  6279   * @param {Object}
  6280   * @param {Function}
  6281   */
  6282  Property.prototype.attachToObject = function (obj) {
  6283      var proto = {
  6284          get: this.buildGet(),
  6285          enumerable: true
  6286      };
  6287  
  6288      var names = this.name.split('.');
  6289      var name = names[0];
  6290      if (names.length > 1) {
  6291          obj[names[0]] = obj[names[0]] || {};
  6292          obj = obj[names[0]];
  6293          name = names[1];
  6294      }
  6295  
  6296      Object.defineProperty(obj, name, proto);
  6297      obj[asyncGetterName(name)] = this.buildAsyncGet();
  6298  };
  6299  
  6300  var asyncGetterName = function (name) {
  6301      return 'get' + name.charAt(0).toUpperCase() + name.slice(1);
  6302  };
  6303  
  6304  Property.prototype.buildGet = function () {
  6305      var property = this;
  6306      return function get() {
  6307          return property.formatOutput(property.requestManager.send({
  6308              method: property.getter
  6309          }));
  6310      };
  6311  };
  6312  
  6313  Property.prototype.buildAsyncGet = function () {
  6314      var property = this;
  6315      var get = function (callback) {
  6316          property.requestManager.sendAsync({
  6317              method: property.getter
  6318          }, function (err, result) {
  6319              callback(err, property.formatOutput(result));
  6320          });
  6321      };
  6322      get.request = this.request.bind(this);
  6323      return get;
  6324  };
  6325  
  6326  /**
  6327   * Should be called to create pure JSONRPC request which can be used in batch request
  6328   *
  6329   * @method request
  6330   * @param {...} params
  6331   * @return {Object} jsonrpc request
  6332   */
  6333  Property.prototype.request = function () {
  6334      var payload = {
  6335          method: this.getter,
  6336          params: [],
  6337          callback: this.extractCallback(Array.prototype.slice.call(arguments))
  6338      };
  6339      payload.format = this.formatOutput.bind(this);
  6340      return payload;
  6341  };
  6342  
  6343  module.exports = Property;
  6344  
  6345  
  6346  },{"../utils/utils":20}],46:[function(require,module,exports){
  6347  /*
  6348      This file is part of web3.js.
  6349  
  6350      web3.js is free software: you can redistribute it and/or modify
  6351      it under the terms of the GNU Lesser General Public License as published by
  6352      the Free Software Foundation, either version 3 of the License, or
  6353      (at your option) any later version.
  6354  
  6355      web3.js is distributed in the hope that it will be useful,
  6356      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6357      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6358      GNU Lesser General Public License for more details.
  6359  
  6360      You should have received a copy of the GNU Lesser General Public License
  6361      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6362  */
  6363  /** 
  6364   * @file requestmanager.js
  6365   * @author Jeffrey Wilcke <jeff@ethdev.com>
  6366   * @author Marek Kotewicz <marek@ethdev.com>
  6367   * @author Marian Oancea <marian@ethdev.com>
  6368   * @author Fabian Vogelsteller <fabian@ethdev.com>
  6369   * @author Gav Wood <g@ethdev.com>
  6370   * @date 2014
  6371   */
  6372  
  6373  var Jsonrpc = require('./jsonrpc');
  6374  var utils = require('../utils/utils');
  6375  var c = require('../utils/config');
  6376  var errors = require('./errors');
  6377  
  6378  /**
  6379   * It's responsible for passing messages to providers
  6380   * It's also responsible for polling the ethereum node for incoming messages
  6381   * Default poll timeout is 1 second
  6382   * Singleton
  6383   */
  6384  var RequestManager = function (provider) {
  6385      this.provider = provider;
  6386      this.polls = {};
  6387      this.timeout = null;
  6388  };
  6389  
  6390  /**
  6391   * Should be used to synchronously send request
  6392   *
  6393   * @method send
  6394   * @param {Object} data
  6395   * @return {Object}
  6396   */
  6397  RequestManager.prototype.send = function (data) {
  6398      if (!this.provider) {
  6399          console.error(errors.InvalidProvider());
  6400          return null;
  6401      }
  6402  
  6403      var payload = Jsonrpc.toPayload(data.method, data.params);
  6404      var result = this.provider.send(payload);
  6405  
  6406      if (!Jsonrpc.isValidResponse(result)) {
  6407          throw errors.InvalidResponse(result);
  6408      }
  6409  
  6410      return result.result;
  6411  };
  6412  
  6413  /**
  6414   * Should be used to asynchronously send request
  6415   *
  6416   * @method sendAsync
  6417   * @param {Object} data
  6418   * @param {Function} callback
  6419   */
  6420  RequestManager.prototype.sendAsync = function (data, callback) {
  6421      if (!this.provider) {
  6422          return callback(errors.InvalidProvider());
  6423      }
  6424  
  6425      var payload = Jsonrpc.toPayload(data.method, data.params);
  6426      this.provider.sendAsync(payload, function (err, result) {
  6427          if (err) {
  6428              return callback(err);
  6429          }
  6430          
  6431          if (!Jsonrpc.isValidResponse(result)) {
  6432              return callback(errors.InvalidResponse(result));
  6433          }
  6434  
  6435          callback(null, result.result);
  6436      });
  6437  };
  6438  
  6439  /**
  6440   * Should be called to asynchronously send batch request
  6441   *
  6442   * @method sendBatch
  6443   * @param {Array} batch data
  6444   * @param {Function} callback
  6445   */
  6446  RequestManager.prototype.sendBatch = function (data, callback) {
  6447      if (!this.provider) {
  6448          return callback(errors.InvalidProvider());
  6449      }
  6450  
  6451      var payload = Jsonrpc.toBatchPayload(data);
  6452  
  6453      this.provider.sendAsync(payload, function (err, results) {
  6454          if (err) {
  6455              return callback(err);
  6456          }
  6457  
  6458          if (!utils.isArray(results)) {
  6459              return callback(errors.InvalidResponse(results));
  6460          }
  6461  
  6462          callback(err, results);
  6463      }); 
  6464  };
  6465  
  6466  /**
  6467   * Should be used to set provider of request manager
  6468   *
  6469   * @method setProvider
  6470   * @param {Object}
  6471   */
  6472  RequestManager.prototype.setProvider = function (p) {
  6473      this.provider = p;
  6474  };
  6475  
  6476  /**
  6477   * Should be used to start polling
  6478   *
  6479   * @method startPolling
  6480   * @param {Object} data
  6481   * @param {Number} pollId
  6482   * @param {Function} callback
  6483   * @param {Function} uninstall
  6484   *
  6485   * @todo cleanup number of params
  6486   */
  6487  RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) {
  6488      this.polls[pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall};
  6489  
  6490  
  6491      // start polling
  6492      if (!this.timeout) {
  6493          this.poll();
  6494      }
  6495  };
  6496  
  6497  /**
  6498   * Should be used to stop polling for filter with given id
  6499   *
  6500   * @method stopPolling
  6501   * @param {Number} pollId
  6502   */
  6503  RequestManager.prototype.stopPolling = function (pollId) {
  6504      delete this.polls[pollId];
  6505  
  6506      // stop polling
  6507      if(Object.keys(this.polls).length === 0 && this.timeout) {
  6508          clearTimeout(this.timeout);
  6509          this.timeout = null;
  6510      }
  6511  };
  6512  
  6513  /**
  6514   * Should be called to reset the polling mechanism of the request manager
  6515   *
  6516   * @method reset
  6517   */
  6518  RequestManager.prototype.reset = function (keepIsSyncing) {
  6519      /*jshint maxcomplexity:5 */
  6520  
  6521      for (var key in this.polls) {
  6522          // remove all polls, except sync polls,
  6523          // they need to be removed manually by calling syncing.stopWatching()
  6524          if(!keepIsSyncing || key.indexOf('syncPoll_') === -1) {
  6525              this.polls[key].uninstall();
  6526              delete this.polls[key];
  6527          }
  6528      }
  6529  
  6530      // stop polling
  6531      if(Object.keys(this.polls).length === 0 && this.timeout) {
  6532          clearTimeout(this.timeout);
  6533          this.timeout = null;
  6534      }
  6535  };
  6536  
  6537  /**
  6538   * Should be called to poll for changes on filter with given id
  6539   *
  6540   * @method poll
  6541   */
  6542  RequestManager.prototype.poll = function () {
  6543      /*jshint maxcomplexity: 6 */
  6544      this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);
  6545  
  6546      if (Object.keys(this.polls).length === 0) {
  6547          return;
  6548      }
  6549  
  6550      if (!this.provider) {
  6551          console.error(errors.InvalidProvider());
  6552          return;
  6553      }
  6554  
  6555      var pollsData = [];
  6556      var pollsIds = [];
  6557      for (var key in this.polls) {
  6558          pollsData.push(this.polls[key].data);
  6559          pollsIds.push(key);
  6560      }
  6561  
  6562      if (pollsData.length === 0) {
  6563          return;
  6564      }
  6565  
  6566      var payload = Jsonrpc.toBatchPayload(pollsData);
  6567      
  6568      // map the request id to they poll id
  6569      var pollsIdMap = {};
  6570      payload.forEach(function(load, index){
  6571          pollsIdMap[load.id] = pollsIds[index];
  6572      });
  6573  
  6574  
  6575      var self = this;
  6576      this.provider.sendAsync(payload, function (error, results) {
  6577  
  6578  
  6579          // TODO: console log?
  6580          if (error) {
  6581              return;
  6582          }
  6583  
  6584          if (!utils.isArray(results)) {
  6585              throw errors.InvalidResponse(results);
  6586          }
  6587          results.map(function (result) {
  6588              var id = pollsIdMap[result.id];
  6589  
  6590              // make sure the filter is still installed after arrival of the request
  6591              if (self.polls[id]) {
  6592                  result.callback = self.polls[id].callback;
  6593                  return result;
  6594              } else
  6595                  return false;
  6596          }).filter(function (result) {
  6597              return !!result; 
  6598          }).filter(function (result) {
  6599              var valid = Jsonrpc.isValidResponse(result);
  6600              if (!valid) {
  6601                  result.callback(errors.InvalidResponse(result));
  6602              }
  6603              return valid;
  6604          }).forEach(function (result) {
  6605              result.callback(null, result.result);
  6606          });
  6607      });
  6608  };
  6609  
  6610  module.exports = RequestManager;
  6611  
  6612  
  6613  },{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":35}],47:[function(require,module,exports){
  6614  
  6615  
  6616  var Settings = function () {
  6617      this.defaultBlock = 'latest';
  6618      this.defaultAccount = undefined;
  6619  };
  6620  
  6621  module.exports = Settings;
  6622  
  6623  
  6624  },{}],48:[function(require,module,exports){
  6625  /*
  6626      This file is part of web3.js.
  6627  
  6628      web3.js is free software: you can redistribute it and/or modify
  6629      it under the terms of the GNU Lesser General Public License as published by
  6630      the Free Software Foundation, either version 3 of the License, or
  6631      (at your option) any later version.
  6632  
  6633      web3.js is distributed in the hope that it will be useful,
  6634      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6635      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6636      GNU Lesser General Public License for more details.
  6637  
  6638      You should have received a copy of the GNU Lesser General Public License
  6639      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6640  */
  6641  /** @file syncing.js
  6642   * @authors:
  6643   *   Fabian Vogelsteller <fabian@ethdev.com>
  6644   * @date 2015
  6645   */
  6646  
  6647  var formatters = require('./formatters');
  6648  var utils = require('../utils/utils');
  6649  
  6650  var count = 1;
  6651  
  6652  /**
  6653  Adds the callback and sets up the methods, to iterate over the results.
  6654  
  6655  @method pollSyncing
  6656  @param {Object} self
  6657  */
  6658  var pollSyncing = function(self) {
  6659  
  6660      var onMessage = function (error, sync) {
  6661          if (error) {
  6662              return self.callbacks.forEach(function (callback) {
  6663                  callback(error);
  6664              });
  6665          }
  6666  
  6667          if(utils.isObject(sync) && sync.startingBlock)
  6668              sync = formatters.outputSyncingFormatter(sync);
  6669  
  6670          self.callbacks.forEach(function (callback) {
  6671              if (self.lastSyncState !== sync) {
  6672                  
  6673                  // call the callback with true first so the app can stop anything, before receiving the sync data
  6674                  if(!self.lastSyncState && utils.isObject(sync))
  6675                      callback(null, true);
  6676                  
  6677                  // call on the next CPU cycle, so the actions of the sync stop can be processes first
  6678                  setTimeout(function() {
  6679                      callback(null, sync);
  6680                  }, 0);
  6681                  
  6682                  self.lastSyncState = sync;
  6683              }
  6684          });
  6685      };
  6686  
  6687      self.requestManager.startPolling({
  6688          method: 'eth_syncing',
  6689          params: [],
  6690      }, self.pollId, onMessage, self.stopWatching.bind(self));
  6691  
  6692  };
  6693  
  6694  var IsSyncing = function (requestManager, callback) {
  6695      this.requestManager = requestManager;
  6696      this.pollId = 'syncPoll_'+ count++;
  6697      this.callbacks = [];
  6698      this.addCallback(callback);
  6699      this.lastSyncState = false;
  6700      pollSyncing(this);
  6701  
  6702      return this;
  6703  };
  6704  
  6705  IsSyncing.prototype.addCallback = function (callback) {
  6706      if(callback)
  6707          this.callbacks.push(callback);
  6708      return this;
  6709  };
  6710  
  6711  IsSyncing.prototype.stopWatching = function () {
  6712      this.requestManager.stopPolling(this.pollId);
  6713      this.callbacks = [];
  6714  };
  6715  
  6716  module.exports = IsSyncing;
  6717  
  6718  
  6719  },{"../utils/utils":20,"./formatters":30}],49:[function(require,module,exports){
  6720  /*
  6721      This file is part of web3.js.
  6722  
  6723      web3.js is free software: you can redistribute it and/or modify
  6724      it under the terms of the GNU Lesser General Public License as published by
  6725      the Free Software Foundation, either version 3 of the License, or
  6726      (at your option) any later version.
  6727  
  6728      web3.js is distributed in the hope that it will be useful,
  6729      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6730      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6731      GNU Lesser General Public License for more details.
  6732  
  6733      You should have received a copy of the GNU Lesser General Public License
  6734      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6735  */
  6736  /** 
  6737   * @file transfer.js
  6738   * @author Marek Kotewicz <marek@ethdev.com>
  6739   * @date 2015
  6740   */
  6741  
  6742  var Iban = require('./iban');
  6743  var exchangeAbi = require('../contracts/SmartExchange.json');
  6744  
  6745  /**
  6746   * Should be used to make Iban transfer
  6747   *
  6748   * @method transfer
  6749   * @param {String} from
  6750   * @param {String} to iban
  6751   * @param {Value} value to be tranfered
  6752   * @param {Function} callback, callback
  6753   */
  6754  var transfer = function (eth, from, to, value, callback) {
  6755      var iban = new Iban(to); 
  6756      if (!iban.isValid()) {
  6757          throw new Error('invalid iban address');
  6758      }
  6759  
  6760      if (iban.isDirect()) {
  6761          return transferToAddress(eth, from, iban.address(), value, callback);
  6762      }
  6763      
  6764      if (!callback) {
  6765          var address = eth.icapNamereg().addr(iban.institution());
  6766          return deposit(eth, from, address, value, iban.client());
  6767      }
  6768  
  6769      eth.icapNamereg().addr(iban.institution(), function (err, address) {
  6770          return deposit(eth, from, address, value, iban.client(), callback);
  6771      });
  6772      
  6773  };
  6774  
  6775  /**
  6776   * Should be used to transfer funds to certain address
  6777   *
  6778   * @method transferToAddress
  6779   * @param {String} from
  6780   * @param {String} to
  6781   * @param {Value} value to be tranfered
  6782   * @param {Function} callback, callback
  6783   */
  6784  var transferToAddress = function (eth, from, to, value, callback) {
  6785      return eth.sendTransaction({
  6786          address: to,
  6787          from: from,
  6788          value: value
  6789      }, callback);
  6790  };
  6791  
  6792  /**
  6793   * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!)
  6794   *
  6795   * @method deposit
  6796   * @param {String} from
  6797   * @param {String} to
  6798   * @param {Value} value to be transferred
  6799   * @param {String} client unique identifier
  6800   * @param {Function} callback, callback
  6801   */
  6802  var deposit = function (eth, from, to, value, client, callback) {
  6803      var abi = exchangeAbi;
  6804      return eth.contract(abi).at(to).deposit(client, {
  6805          from: from,
  6806          value: value
  6807      }, callback);
  6808  };
  6809  
  6810  module.exports = transfer;
  6811  
  6812  
  6813  },{"../contracts/SmartExchange.json":3,"./iban":33}],50:[function(require,module,exports){
  6814  
  6815  },{}],51:[function(require,module,exports){
  6816  ;(function (root, factory, undef) {
  6817  	if (typeof exports === "object") {
  6818  		// CommonJS
  6819  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  6820  	}
  6821  	else if (typeof define === "function" && define.amd) {
  6822  		// AMD
  6823  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  6824  	}
  6825  	else {
  6826  		// Global (browser)
  6827  		factory(root.CryptoJS);
  6828  	}
  6829  }(this, function (CryptoJS) {
  6830  
  6831  	(function () {
  6832  	    // Shortcuts
  6833  	    var C = CryptoJS;
  6834  	    var C_lib = C.lib;
  6835  	    var BlockCipher = C_lib.BlockCipher;
  6836  	    var C_algo = C.algo;
  6837  
  6838  	    // Lookup tables
  6839  	    var SBOX = [];
  6840  	    var INV_SBOX = [];
  6841  	    var SUB_MIX_0 = [];
  6842  	    var SUB_MIX_1 = [];
  6843  	    var SUB_MIX_2 = [];
  6844  	    var SUB_MIX_3 = [];
  6845  	    var INV_SUB_MIX_0 = [];
  6846  	    var INV_SUB_MIX_1 = [];
  6847  	    var INV_SUB_MIX_2 = [];
  6848  	    var INV_SUB_MIX_3 = [];
  6849  
  6850  	    // Compute lookup tables
  6851  	    (function () {
  6852  	        // Compute double table
  6853  	        var d = [];
  6854  	        for (var i = 0; i < 256; i++) {
  6855  	            if (i < 128) {
  6856  	                d[i] = i << 1;
  6857  	            } else {
  6858  	                d[i] = (i << 1) ^ 0x11b;
  6859  	            }
  6860  	        }
  6861  
  6862  	        // Walk GF(2^8)
  6863  	        var x = 0;
  6864  	        var xi = 0;
  6865  	        for (var i = 0; i < 256; i++) {
  6866  	            // Compute sbox
  6867  	            var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  6868  	            sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  6869  	            SBOX[x] = sx;
  6870  	            INV_SBOX[sx] = x;
  6871  
  6872  	            // Compute multiplication
  6873  	            var x2 = d[x];
  6874  	            var x4 = d[x2];
  6875  	            var x8 = d[x4];
  6876  
  6877  	            // Compute sub bytes, mix columns tables
  6878  	            var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  6879  	            SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  6880  	            SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  6881  	            SUB_MIX_2[x] = (t << 8)  | (t >>> 24);
  6882  	            SUB_MIX_3[x] = t;
  6883  
  6884  	            // Compute inv sub bytes, inv mix columns tables
  6885  	            var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  6886  	            INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  6887  	            INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  6888  	            INV_SUB_MIX_2[sx] = (t << 8)  | (t >>> 24);
  6889  	            INV_SUB_MIX_3[sx] = t;
  6890  
  6891  	            // Compute next counter
  6892  	            if (!x) {
  6893  	                x = xi = 1;
  6894  	            } else {
  6895  	                x = x2 ^ d[d[d[x8 ^ x2]]];
  6896  	                xi ^= d[d[xi]];
  6897  	            }
  6898  	        }
  6899  	    }());
  6900  
  6901  	    // Precomputed Rcon lookup
  6902  	    var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  6903  
  6904  	    /**
  6905  	     * AES block cipher algorithm.
  6906  	     */
  6907  	    var AES = C_algo.AES = BlockCipher.extend({
  6908  	        _doReset: function () {
  6909  	            // Skip reset of nRounds has been set before and key did not change
  6910  	            if (this._nRounds && this._keyPriorReset === this._key) {
  6911  	                return;
  6912  	            }
  6913  
  6914  	            // Shortcuts
  6915  	            var key = this._keyPriorReset = this._key;
  6916  	            var keyWords = key.words;
  6917  	            var keySize = key.sigBytes / 4;
  6918  
  6919  	            // Compute number of rounds
  6920  	            var nRounds = this._nRounds = keySize + 6;
  6921  
  6922  	            // Compute number of key schedule rows
  6923  	            var ksRows = (nRounds + 1) * 4;
  6924  
  6925  	            // Compute key schedule
  6926  	            var keySchedule = this._keySchedule = [];
  6927  	            for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  6928  	                if (ksRow < keySize) {
  6929  	                    keySchedule[ksRow] = keyWords[ksRow];
  6930  	                } else {
  6931  	                    var t = keySchedule[ksRow - 1];
  6932  
  6933  	                    if (!(ksRow % keySize)) {
  6934  	                        // Rot word
  6935  	                        t = (t << 8) | (t >>> 24);
  6936  
  6937  	                        // Sub word
  6938  	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  6939  
  6940  	                        // Mix Rcon
  6941  	                        t ^= RCON[(ksRow / keySize) | 0] << 24;
  6942  	                    } else if (keySize > 6 && ksRow % keySize == 4) {
  6943  	                        // Sub word
  6944  	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  6945  	                    }
  6946  
  6947  	                    keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  6948  	                }
  6949  	            }
  6950  
  6951  	            // Compute inv key schedule
  6952  	            var invKeySchedule = this._invKeySchedule = [];
  6953  	            for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  6954  	                var ksRow = ksRows - invKsRow;
  6955  
  6956  	                if (invKsRow % 4) {
  6957  	                    var t = keySchedule[ksRow];
  6958  	                } else {
  6959  	                    var t = keySchedule[ksRow - 4];
  6960  	                }
  6961  
  6962  	                if (invKsRow < 4 || ksRow <= 4) {
  6963  	                    invKeySchedule[invKsRow] = t;
  6964  	                } else {
  6965  	                    invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  6966  	                                               INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  6967  	                }
  6968  	            }
  6969  	        },
  6970  
  6971  	        encryptBlock: function (M, offset) {
  6972  	            this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  6973  	        },
  6974  
  6975  	        decryptBlock: function (M, offset) {
  6976  	            // Swap 2nd and 4th rows
  6977  	            var t = M[offset + 1];
  6978  	            M[offset + 1] = M[offset + 3];
  6979  	            M[offset + 3] = t;
  6980  
  6981  	            this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  6982  
  6983  	            // Inv swap 2nd and 4th rows
  6984  	            var t = M[offset + 1];
  6985  	            M[offset + 1] = M[offset + 3];
  6986  	            M[offset + 3] = t;
  6987  	        },
  6988  
  6989  	        _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  6990  	            // Shortcut
  6991  	            var nRounds = this._nRounds;
  6992  
  6993  	            // Get input, add round key
  6994  	            var s0 = M[offset]     ^ keySchedule[0];
  6995  	            var s1 = M[offset + 1] ^ keySchedule[1];
  6996  	            var s2 = M[offset + 2] ^ keySchedule[2];
  6997  	            var s3 = M[offset + 3] ^ keySchedule[3];
  6998  
  6999  	            // Key schedule row counter
  7000  	            var ksRow = 4;
  7001  
  7002  	            // Rounds
  7003  	            for (var round = 1; round < nRounds; round++) {
  7004  	                // Shift rows, sub bytes, mix columns, add round key
  7005  	                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++];
  7006  	                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++];
  7007  	                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++];
  7008  	                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++];
  7009  
  7010  	                // Update state
  7011  	                s0 = t0;
  7012  	                s1 = t1;
  7013  	                s2 = t2;
  7014  	                s3 = t3;
  7015  	            }
  7016  
  7017  	            // Shift rows, sub bytes, add round key
  7018  	            var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  7019  	            var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  7020  	            var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  7021  	            var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  7022  
  7023  	            // Set output
  7024  	            M[offset]     = t0;
  7025  	            M[offset + 1] = t1;
  7026  	            M[offset + 2] = t2;
  7027  	            M[offset + 3] = t3;
  7028  	        },
  7029  
  7030  	        keySize: 256/32
  7031  	    });
  7032  
  7033  	    /**
  7034  	     * Shortcut functions to the cipher's object interface.
  7035  	     *
  7036  	     * @example
  7037  	     *
  7038  	     *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  7039  	     *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  7040  	     */
  7041  	    C.AES = BlockCipher._createHelper(AES);
  7042  	}());
  7043  
  7044  
  7045  	return CryptoJS.AES;
  7046  
  7047  }));
  7048  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],52:[function(require,module,exports){
  7049  ;(function (root, factory) {
  7050  	if (typeof exports === "object") {
  7051  		// CommonJS
  7052  		module.exports = exports = factory(require("./core"));
  7053  	}
  7054  	else if (typeof define === "function" && define.amd) {
  7055  		// AMD
  7056  		define(["./core"], factory);
  7057  	}
  7058  	else {
  7059  		// Global (browser)
  7060  		factory(root.CryptoJS);
  7061  	}
  7062  }(this, function (CryptoJS) {
  7063  
  7064  	/**
  7065  	 * Cipher core components.
  7066  	 */
  7067  	CryptoJS.lib.Cipher || (function (undefined) {
  7068  	    // Shortcuts
  7069  	    var C = CryptoJS;
  7070  	    var C_lib = C.lib;
  7071  	    var Base = C_lib.Base;
  7072  	    var WordArray = C_lib.WordArray;
  7073  	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  7074  	    var C_enc = C.enc;
  7075  	    var Utf8 = C_enc.Utf8;
  7076  	    var Base64 = C_enc.Base64;
  7077  	    var C_algo = C.algo;
  7078  	    var EvpKDF = C_algo.EvpKDF;
  7079  
  7080  	    /**
  7081  	     * Abstract base cipher template.
  7082  	     *
  7083  	     * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  7084  	     * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  7085  	     * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  7086  	     * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  7087  	     */
  7088  	    var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  7089  	        /**
  7090  	         * Configuration options.
  7091  	         *
  7092  	         * @property {WordArray} iv The IV to use for this operation.
  7093  	         */
  7094  	        cfg: Base.extend(),
  7095  
  7096  	        /**
  7097  	         * Creates this cipher in encryption mode.
  7098  	         *
  7099  	         * @param {WordArray} key The key.
  7100  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7101  	         *
  7102  	         * @return {Cipher} A cipher instance.
  7103  	         *
  7104  	         * @static
  7105  	         *
  7106  	         * @example
  7107  	         *
  7108  	         *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  7109  	         */
  7110  	        createEncryptor: function (key, cfg) {
  7111  	            return this.create(this._ENC_XFORM_MODE, key, cfg);
  7112  	        },
  7113  
  7114  	        /**
  7115  	         * Creates this cipher in decryption mode.
  7116  	         *
  7117  	         * @param {WordArray} key The key.
  7118  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7119  	         *
  7120  	         * @return {Cipher} A cipher instance.
  7121  	         *
  7122  	         * @static
  7123  	         *
  7124  	         * @example
  7125  	         *
  7126  	         *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  7127  	         */
  7128  	        createDecryptor: function (key, cfg) {
  7129  	            return this.create(this._DEC_XFORM_MODE, key, cfg);
  7130  	        },
  7131  
  7132  	        /**
  7133  	         * Initializes a newly created cipher.
  7134  	         *
  7135  	         * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  7136  	         * @param {WordArray} key The key.
  7137  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7138  	         *
  7139  	         * @example
  7140  	         *
  7141  	         *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  7142  	         */
  7143  	        init: function (xformMode, key, cfg) {
  7144  	            // Apply config defaults
  7145  	            this.cfg = this.cfg.extend(cfg);
  7146  
  7147  	            // Store transform mode and key
  7148  	            this._xformMode = xformMode;
  7149  	            this._key = key;
  7150  
  7151  	            // Set initial values
  7152  	            this.reset();
  7153  	        },
  7154  
  7155  	        /**
  7156  	         * Resets this cipher to its initial state.
  7157  	         *
  7158  	         * @example
  7159  	         *
  7160  	         *     cipher.reset();
  7161  	         */
  7162  	        reset: function () {
  7163  	            // Reset data buffer
  7164  	            BufferedBlockAlgorithm.reset.call(this);
  7165  
  7166  	            // Perform concrete-cipher logic
  7167  	            this._doReset();
  7168  	        },
  7169  
  7170  	        /**
  7171  	         * Adds data to be encrypted or decrypted.
  7172  	         *
  7173  	         * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  7174  	         *
  7175  	         * @return {WordArray} The data after processing.
  7176  	         *
  7177  	         * @example
  7178  	         *
  7179  	         *     var encrypted = cipher.process('data');
  7180  	         *     var encrypted = cipher.process(wordArray);
  7181  	         */
  7182  	        process: function (dataUpdate) {
  7183  	            // Append
  7184  	            this._append(dataUpdate);
  7185  
  7186  	            // Process available blocks
  7187  	            return this._process();
  7188  	        },
  7189  
  7190  	        /**
  7191  	         * Finalizes the encryption or decryption process.
  7192  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  7193  	         *
  7194  	         * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  7195  	         *
  7196  	         * @return {WordArray} The data after final processing.
  7197  	         *
  7198  	         * @example
  7199  	         *
  7200  	         *     var encrypted = cipher.finalize();
  7201  	         *     var encrypted = cipher.finalize('data');
  7202  	         *     var encrypted = cipher.finalize(wordArray);
  7203  	         */
  7204  	        finalize: function (dataUpdate) {
  7205  	            // Final data update
  7206  	            if (dataUpdate) {
  7207  	                this._append(dataUpdate);
  7208  	            }
  7209  
  7210  	            // Perform concrete-cipher logic
  7211  	            var finalProcessedData = this._doFinalize();
  7212  
  7213  	            return finalProcessedData;
  7214  	        },
  7215  
  7216  	        keySize: 128/32,
  7217  
  7218  	        ivSize: 128/32,
  7219  
  7220  	        _ENC_XFORM_MODE: 1,
  7221  
  7222  	        _DEC_XFORM_MODE: 2,
  7223  
  7224  	        /**
  7225  	         * Creates shortcut functions to a cipher's object interface.
  7226  	         *
  7227  	         * @param {Cipher} cipher The cipher to create a helper for.
  7228  	         *
  7229  	         * @return {Object} An object with encrypt and decrypt shortcut functions.
  7230  	         *
  7231  	         * @static
  7232  	         *
  7233  	         * @example
  7234  	         *
  7235  	         *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  7236  	         */
  7237  	        _createHelper: (function () {
  7238  	            function selectCipherStrategy(key) {
  7239  	                if (typeof key == 'string') {
  7240  	                    return PasswordBasedCipher;
  7241  	                } else {
  7242  	                    return SerializableCipher;
  7243  	                }
  7244  	            }
  7245  
  7246  	            return function (cipher) {
  7247  	                return {
  7248  	                    encrypt: function (message, key, cfg) {
  7249  	                        return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  7250  	                    },
  7251  
  7252  	                    decrypt: function (ciphertext, key, cfg) {
  7253  	                        return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  7254  	                    }
  7255  	                };
  7256  	            };
  7257  	        }())
  7258  	    });
  7259  
  7260  	    /**
  7261  	     * Abstract base stream cipher template.
  7262  	     *
  7263  	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  7264  	     */
  7265  	    var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  7266  	        _doFinalize: function () {
  7267  	            // Process partial blocks
  7268  	            var finalProcessedBlocks = this._process(!!'flush');
  7269  
  7270  	            return finalProcessedBlocks;
  7271  	        },
  7272  
  7273  	        blockSize: 1
  7274  	    });
  7275  
  7276  	    /**
  7277  	     * Mode namespace.
  7278  	     */
  7279  	    var C_mode = C.mode = {};
  7280  
  7281  	    /**
  7282  	     * Abstract base block cipher mode template.
  7283  	     */
  7284  	    var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  7285  	        /**
  7286  	         * Creates this mode for encryption.
  7287  	         *
  7288  	         * @param {Cipher} cipher A block cipher instance.
  7289  	         * @param {Array} iv The IV words.
  7290  	         *
  7291  	         * @static
  7292  	         *
  7293  	         * @example
  7294  	         *
  7295  	         *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  7296  	         */
  7297  	        createEncryptor: function (cipher, iv) {
  7298  	            return this.Encryptor.create(cipher, iv);
  7299  	        },
  7300  
  7301  	        /**
  7302  	         * Creates this mode for decryption.
  7303  	         *
  7304  	         * @param {Cipher} cipher A block cipher instance.
  7305  	         * @param {Array} iv The IV words.
  7306  	         *
  7307  	         * @static
  7308  	         *
  7309  	         * @example
  7310  	         *
  7311  	         *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  7312  	         */
  7313  	        createDecryptor: function (cipher, iv) {
  7314  	            return this.Decryptor.create(cipher, iv);
  7315  	        },
  7316  
  7317  	        /**
  7318  	         * Initializes a newly created mode.
  7319  	         *
  7320  	         * @param {Cipher} cipher A block cipher instance.
  7321  	         * @param {Array} iv The IV words.
  7322  	         *
  7323  	         * @example
  7324  	         *
  7325  	         *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  7326  	         */
  7327  	        init: function (cipher, iv) {
  7328  	            this._cipher = cipher;
  7329  	            this._iv = iv;
  7330  	        }
  7331  	    });
  7332  
  7333  	    /**
  7334  	     * Cipher Block Chaining mode.
  7335  	     */
  7336  	    var CBC = C_mode.CBC = (function () {
  7337  	        /**
  7338  	         * Abstract base CBC mode.
  7339  	         */
  7340  	        var CBC = BlockCipherMode.extend();
  7341  
  7342  	        /**
  7343  	         * CBC encryptor.
  7344  	         */
  7345  	        CBC.Encryptor = CBC.extend({
  7346  	            /**
  7347  	             * Processes the data block at offset.
  7348  	             *
  7349  	             * @param {Array} words The data words to operate on.
  7350  	             * @param {number} offset The offset where the block starts.
  7351  	             *
  7352  	             * @example
  7353  	             *
  7354  	             *     mode.processBlock(data.words, offset);
  7355  	             */
  7356  	            processBlock: function (words, offset) {
  7357  	                // Shortcuts
  7358  	                var cipher = this._cipher;
  7359  	                var blockSize = cipher.blockSize;
  7360  
  7361  	                // XOR and encrypt
  7362  	                xorBlock.call(this, words, offset, blockSize);
  7363  	                cipher.encryptBlock(words, offset);
  7364  
  7365  	                // Remember this block to use with next block
  7366  	                this._prevBlock = words.slice(offset, offset + blockSize);
  7367  	            }
  7368  	        });
  7369  
  7370  	        /**
  7371  	         * CBC decryptor.
  7372  	         */
  7373  	        CBC.Decryptor = CBC.extend({
  7374  	            /**
  7375  	             * Processes the data block at offset.
  7376  	             *
  7377  	             * @param {Array} words The data words to operate on.
  7378  	             * @param {number} offset The offset where the block starts.
  7379  	             *
  7380  	             * @example
  7381  	             *
  7382  	             *     mode.processBlock(data.words, offset);
  7383  	             */
  7384  	            processBlock: function (words, offset) {
  7385  	                // Shortcuts
  7386  	                var cipher = this._cipher;
  7387  	                var blockSize = cipher.blockSize;
  7388  
  7389  	                // Remember this block to use with next block
  7390  	                var thisBlock = words.slice(offset, offset + blockSize);
  7391  
  7392  	                // Decrypt and XOR
  7393  	                cipher.decryptBlock(words, offset);
  7394  	                xorBlock.call(this, words, offset, blockSize);
  7395  
  7396  	                // This block becomes the previous block
  7397  	                this._prevBlock = thisBlock;
  7398  	            }
  7399  	        });
  7400  
  7401  	        function xorBlock(words, offset, blockSize) {
  7402  	            // Shortcut
  7403  	            var iv = this._iv;
  7404  
  7405  	            // Choose mixing block
  7406  	            if (iv) {
  7407  	                var block = iv;
  7408  
  7409  	                // Remove IV for subsequent blocks
  7410  	                this._iv = undefined;
  7411  	            } else {
  7412  	                var block = this._prevBlock;
  7413  	            }
  7414  
  7415  	            // XOR blocks
  7416  	            for (var i = 0; i < blockSize; i++) {
  7417  	                words[offset + i] ^= block[i];
  7418  	            }
  7419  	        }
  7420  
  7421  	        return CBC;
  7422  	    }());
  7423  
  7424  	    /**
  7425  	     * Padding namespace.
  7426  	     */
  7427  	    var C_pad = C.pad = {};
  7428  
  7429  	    /**
  7430  	     * PKCS #5/7 padding strategy.
  7431  	     */
  7432  	    var Pkcs7 = C_pad.Pkcs7 = {
  7433  	        /**
  7434  	         * Pads data using the algorithm defined in PKCS #5/7.
  7435  	         *
  7436  	         * @param {WordArray} data The data to pad.
  7437  	         * @param {number} blockSize The multiple that the data should be padded to.
  7438  	         *
  7439  	         * @static
  7440  	         *
  7441  	         * @example
  7442  	         *
  7443  	         *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  7444  	         */
  7445  	        pad: function (data, blockSize) {
  7446  	            // Shortcut
  7447  	            var blockSizeBytes = blockSize * 4;
  7448  
  7449  	            // Count padding bytes
  7450  	            var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  7451  
  7452  	            // Create padding word
  7453  	            var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
  7454  
  7455  	            // Create padding
  7456  	            var paddingWords = [];
  7457  	            for (var i = 0; i < nPaddingBytes; i += 4) {
  7458  	                paddingWords.push(paddingWord);
  7459  	            }
  7460  	            var padding = WordArray.create(paddingWords, nPaddingBytes);
  7461  
  7462  	            // Add padding
  7463  	            data.concat(padding);
  7464  	        },
  7465  
  7466  	        /**
  7467  	         * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  7468  	         *
  7469  	         * @param {WordArray} data The data to unpad.
  7470  	         *
  7471  	         * @static
  7472  	         *
  7473  	         * @example
  7474  	         *
  7475  	         *     CryptoJS.pad.Pkcs7.unpad(wordArray);
  7476  	         */
  7477  	        unpad: function (data) {
  7478  	            // Get number of padding bytes from last byte
  7479  	            var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  7480  
  7481  	            // Remove padding
  7482  	            data.sigBytes -= nPaddingBytes;
  7483  	        }
  7484  	    };
  7485  
  7486  	    /**
  7487  	     * Abstract base block cipher template.
  7488  	     *
  7489  	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  7490  	     */
  7491  	    var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  7492  	        /**
  7493  	         * Configuration options.
  7494  	         *
  7495  	         * @property {Mode} mode The block mode to use. Default: CBC
  7496  	         * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  7497  	         */
  7498  	        cfg: Cipher.cfg.extend({
  7499  	            mode: CBC,
  7500  	            padding: Pkcs7
  7501  	        }),
  7502  
  7503  	        reset: function () {
  7504  	            // Reset cipher
  7505  	            Cipher.reset.call(this);
  7506  
  7507  	            // Shortcuts
  7508  	            var cfg = this.cfg;
  7509  	            var iv = cfg.iv;
  7510  	            var mode = cfg.mode;
  7511  
  7512  	            // Reset block mode
  7513  	            if (this._xformMode == this._ENC_XFORM_MODE) {
  7514  	                var modeCreator = mode.createEncryptor;
  7515  	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  7516  	                var modeCreator = mode.createDecryptor;
  7517  
  7518  	                // Keep at least one block in the buffer for unpadding
  7519  	                this._minBufferSize = 1;
  7520  	            }
  7521  	            this._mode = modeCreator.call(mode, this, iv && iv.words);
  7522  	        },
  7523  
  7524  	        _doProcessBlock: function (words, offset) {
  7525  	            this._mode.processBlock(words, offset);
  7526  	        },
  7527  
  7528  	        _doFinalize: function () {
  7529  	            // Shortcut
  7530  	            var padding = this.cfg.padding;
  7531  
  7532  	            // Finalize
  7533  	            if (this._xformMode == this._ENC_XFORM_MODE) {
  7534  	                // Pad data
  7535  	                padding.pad(this._data, this.blockSize);
  7536  
  7537  	                // Process final blocks
  7538  	                var finalProcessedBlocks = this._process(!!'flush');
  7539  	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  7540  	                // Process final blocks
  7541  	                var finalProcessedBlocks = this._process(!!'flush');
  7542  
  7543  	                // Unpad data
  7544  	                padding.unpad(finalProcessedBlocks);
  7545  	            }
  7546  
  7547  	            return finalProcessedBlocks;
  7548  	        },
  7549  
  7550  	        blockSize: 128/32
  7551  	    });
  7552  
  7553  	    /**
  7554  	     * A collection of cipher parameters.
  7555  	     *
  7556  	     * @property {WordArray} ciphertext The raw ciphertext.
  7557  	     * @property {WordArray} key The key to this ciphertext.
  7558  	     * @property {WordArray} iv The IV used in the ciphering operation.
  7559  	     * @property {WordArray} salt The salt used with a key derivation function.
  7560  	     * @property {Cipher} algorithm The cipher algorithm.
  7561  	     * @property {Mode} mode The block mode used in the ciphering operation.
  7562  	     * @property {Padding} padding The padding scheme used in the ciphering operation.
  7563  	     * @property {number} blockSize The block size of the cipher.
  7564  	     * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  7565  	     */
  7566  	    var CipherParams = C_lib.CipherParams = Base.extend({
  7567  	        /**
  7568  	         * Initializes a newly created cipher params object.
  7569  	         *
  7570  	         * @param {Object} cipherParams An object with any of the possible cipher parameters.
  7571  	         *
  7572  	         * @example
  7573  	         *
  7574  	         *     var cipherParams = CryptoJS.lib.CipherParams.create({
  7575  	         *         ciphertext: ciphertextWordArray,
  7576  	         *         key: keyWordArray,
  7577  	         *         iv: ivWordArray,
  7578  	         *         salt: saltWordArray,
  7579  	         *         algorithm: CryptoJS.algo.AES,
  7580  	         *         mode: CryptoJS.mode.CBC,
  7581  	         *         padding: CryptoJS.pad.PKCS7,
  7582  	         *         blockSize: 4,
  7583  	         *         formatter: CryptoJS.format.OpenSSL
  7584  	         *     });
  7585  	         */
  7586  	        init: function (cipherParams) {
  7587  	            this.mixIn(cipherParams);
  7588  	        },
  7589  
  7590  	        /**
  7591  	         * Converts this cipher params object to a string.
  7592  	         *
  7593  	         * @param {Format} formatter (Optional) The formatting strategy to use.
  7594  	         *
  7595  	         * @return {string} The stringified cipher params.
  7596  	         *
  7597  	         * @throws Error If neither the formatter nor the default formatter is set.
  7598  	         *
  7599  	         * @example
  7600  	         *
  7601  	         *     var string = cipherParams + '';
  7602  	         *     var string = cipherParams.toString();
  7603  	         *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  7604  	         */
  7605  	        toString: function (formatter) {
  7606  	            return (formatter || this.formatter).stringify(this);
  7607  	        }
  7608  	    });
  7609  
  7610  	    /**
  7611  	     * Format namespace.
  7612  	     */
  7613  	    var C_format = C.format = {};
  7614  
  7615  	    /**
  7616  	     * OpenSSL formatting strategy.
  7617  	     */
  7618  	    var OpenSSLFormatter = C_format.OpenSSL = {
  7619  	        /**
  7620  	         * Converts a cipher params object to an OpenSSL-compatible string.
  7621  	         *
  7622  	         * @param {CipherParams} cipherParams The cipher params object.
  7623  	         *
  7624  	         * @return {string} The OpenSSL-compatible string.
  7625  	         *
  7626  	         * @static
  7627  	         *
  7628  	         * @example
  7629  	         *
  7630  	         *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  7631  	         */
  7632  	        stringify: function (cipherParams) {
  7633  	            // Shortcuts
  7634  	            var ciphertext = cipherParams.ciphertext;
  7635  	            var salt = cipherParams.salt;
  7636  
  7637  	            // Format
  7638  	            if (salt) {
  7639  	                var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  7640  	            } else {
  7641  	                var wordArray = ciphertext;
  7642  	            }
  7643  
  7644  	            return wordArray.toString(Base64);
  7645  	        },
  7646  
  7647  	        /**
  7648  	         * Converts an OpenSSL-compatible string to a cipher params object.
  7649  	         *
  7650  	         * @param {string} openSSLStr The OpenSSL-compatible string.
  7651  	         *
  7652  	         * @return {CipherParams} The cipher params object.
  7653  	         *
  7654  	         * @static
  7655  	         *
  7656  	         * @example
  7657  	         *
  7658  	         *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  7659  	         */
  7660  	        parse: function (openSSLStr) {
  7661  	            // Parse base64
  7662  	            var ciphertext = Base64.parse(openSSLStr);
  7663  
  7664  	            // Shortcut
  7665  	            var ciphertextWords = ciphertext.words;
  7666  
  7667  	            // Test for salt
  7668  	            if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  7669  	                // Extract salt
  7670  	                var salt = WordArray.create(ciphertextWords.slice(2, 4));
  7671  
  7672  	                // Remove salt from ciphertext
  7673  	                ciphertextWords.splice(0, 4);
  7674  	                ciphertext.sigBytes -= 16;
  7675  	            }
  7676  
  7677  	            return CipherParams.create({ ciphertext: ciphertext, salt: salt });
  7678  	        }
  7679  	    };
  7680  
  7681  	    /**
  7682  	     * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  7683  	     */
  7684  	    var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  7685  	        /**
  7686  	         * Configuration options.
  7687  	         *
  7688  	         * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  7689  	         */
  7690  	        cfg: Base.extend({
  7691  	            format: OpenSSLFormatter
  7692  	        }),
  7693  
  7694  	        /**
  7695  	         * Encrypts a message.
  7696  	         *
  7697  	         * @param {Cipher} cipher The cipher algorithm to use.
  7698  	         * @param {WordArray|string} message The message to encrypt.
  7699  	         * @param {WordArray} key The key.
  7700  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7701  	         *
  7702  	         * @return {CipherParams} A cipher params object.
  7703  	         *
  7704  	         * @static
  7705  	         *
  7706  	         * @example
  7707  	         *
  7708  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  7709  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  7710  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7711  	         */
  7712  	        encrypt: function (cipher, message, key, cfg) {
  7713  	            // Apply config defaults
  7714  	            cfg = this.cfg.extend(cfg);
  7715  
  7716  	            // Encrypt
  7717  	            var encryptor = cipher.createEncryptor(key, cfg);
  7718  	            var ciphertext = encryptor.finalize(message);
  7719  
  7720  	            // Shortcut
  7721  	            var cipherCfg = encryptor.cfg;
  7722  
  7723  	            // Create and return serializable cipher params
  7724  	            return CipherParams.create({
  7725  	                ciphertext: ciphertext,
  7726  	                key: key,
  7727  	                iv: cipherCfg.iv,
  7728  	                algorithm: cipher,
  7729  	                mode: cipherCfg.mode,
  7730  	                padding: cipherCfg.padding,
  7731  	                blockSize: cipher.blockSize,
  7732  	                formatter: cfg.format
  7733  	            });
  7734  	        },
  7735  
  7736  	        /**
  7737  	         * Decrypts serialized ciphertext.
  7738  	         *
  7739  	         * @param {Cipher} cipher The cipher algorithm to use.
  7740  	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  7741  	         * @param {WordArray} key The key.
  7742  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7743  	         *
  7744  	         * @return {WordArray} The plaintext.
  7745  	         *
  7746  	         * @static
  7747  	         *
  7748  	         * @example
  7749  	         *
  7750  	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7751  	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  7752  	         */
  7753  	        decrypt: function (cipher, ciphertext, key, cfg) {
  7754  	            // Apply config defaults
  7755  	            cfg = this.cfg.extend(cfg);
  7756  
  7757  	            // Convert string to CipherParams
  7758  	            ciphertext = this._parse(ciphertext, cfg.format);
  7759  
  7760  	            // Decrypt
  7761  	            var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  7762  
  7763  	            return plaintext;
  7764  	        },
  7765  
  7766  	        /**
  7767  	         * Converts serialized ciphertext to CipherParams,
  7768  	         * else assumed CipherParams already and returns ciphertext unchanged.
  7769  	         *
  7770  	         * @param {CipherParams|string} ciphertext The ciphertext.
  7771  	         * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  7772  	         *
  7773  	         * @return {CipherParams} The unserialized ciphertext.
  7774  	         *
  7775  	         * @static
  7776  	         *
  7777  	         * @example
  7778  	         *
  7779  	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  7780  	         */
  7781  	        _parse: function (ciphertext, format) {
  7782  	            if (typeof ciphertext == 'string') {
  7783  	                return format.parse(ciphertext, this);
  7784  	            } else {
  7785  	                return ciphertext;
  7786  	            }
  7787  	        }
  7788  	    });
  7789  
  7790  	    /**
  7791  	     * Key derivation function namespace.
  7792  	     */
  7793  	    var C_kdf = C.kdf = {};
  7794  
  7795  	    /**
  7796  	     * OpenSSL key derivation function.
  7797  	     */
  7798  	    var OpenSSLKdf = C_kdf.OpenSSL = {
  7799  	        /**
  7800  	         * Derives a key and IV from a password.
  7801  	         *
  7802  	         * @param {string} password The password to derive from.
  7803  	         * @param {number} keySize The size in words of the key to generate.
  7804  	         * @param {number} ivSize The size in words of the IV to generate.
  7805  	         * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  7806  	         *
  7807  	         * @return {CipherParams} A cipher params object with the key, IV, and salt.
  7808  	         *
  7809  	         * @static
  7810  	         *
  7811  	         * @example
  7812  	         *
  7813  	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  7814  	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  7815  	         */
  7816  	        execute: function (password, keySize, ivSize, salt) {
  7817  	            // Generate random salt
  7818  	            if (!salt) {
  7819  	                salt = WordArray.random(64/8);
  7820  	            }
  7821  
  7822  	            // Derive key and IV
  7823  	            var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
  7824  
  7825  	            // Separate key and IV
  7826  	            var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  7827  	            key.sigBytes = keySize * 4;
  7828  
  7829  	            // Return params
  7830  	            return CipherParams.create({ key: key, iv: iv, salt: salt });
  7831  	        }
  7832  	    };
  7833  
  7834  	    /**
  7835  	     * A serializable cipher wrapper that derives the key from a password,
  7836  	     * and returns ciphertext as a serializable cipher params object.
  7837  	     */
  7838  	    var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  7839  	        /**
  7840  	         * Configuration options.
  7841  	         *
  7842  	         * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  7843  	         */
  7844  	        cfg: SerializableCipher.cfg.extend({
  7845  	            kdf: OpenSSLKdf
  7846  	        }),
  7847  
  7848  	        /**
  7849  	         * Encrypts a message using a password.
  7850  	         *
  7851  	         * @param {Cipher} cipher The cipher algorithm to use.
  7852  	         * @param {WordArray|string} message The message to encrypt.
  7853  	         * @param {string} password The password.
  7854  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7855  	         *
  7856  	         * @return {CipherParams} A cipher params object.
  7857  	         *
  7858  	         * @static
  7859  	         *
  7860  	         * @example
  7861  	         *
  7862  	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  7863  	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  7864  	         */
  7865  	        encrypt: function (cipher, message, password, cfg) {
  7866  	            // Apply config defaults
  7867  	            cfg = this.cfg.extend(cfg);
  7868  
  7869  	            // Derive key and other params
  7870  	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
  7871  
  7872  	            // Add IV to config
  7873  	            cfg.iv = derivedParams.iv;
  7874  
  7875  	            // Encrypt
  7876  	            var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  7877  
  7878  	            // Mix in derived params
  7879  	            ciphertext.mixIn(derivedParams);
  7880  
  7881  	            return ciphertext;
  7882  	        },
  7883  
  7884  	        /**
  7885  	         * Decrypts serialized ciphertext using a password.
  7886  	         *
  7887  	         * @param {Cipher} cipher The cipher algorithm to use.
  7888  	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  7889  	         * @param {string} password The password.
  7890  	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7891  	         *
  7892  	         * @return {WordArray} The plaintext.
  7893  	         *
  7894  	         * @static
  7895  	         *
  7896  	         * @example
  7897  	         *
  7898  	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  7899  	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  7900  	         */
  7901  	        decrypt: function (cipher, ciphertext, password, cfg) {
  7902  	            // Apply config defaults
  7903  	            cfg = this.cfg.extend(cfg);
  7904  
  7905  	            // Convert string to CipherParams
  7906  	            ciphertext = this._parse(ciphertext, cfg.format);
  7907  
  7908  	            // Derive key and other params
  7909  	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
  7910  
  7911  	            // Add IV to config
  7912  	            cfg.iv = derivedParams.iv;
  7913  
  7914  	            // Decrypt
  7915  	            var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  7916  
  7917  	            return plaintext;
  7918  	        }
  7919  	    });
  7920  	}());
  7921  
  7922  
  7923  }));
  7924  },{"./core":53}],53:[function(require,module,exports){
  7925  ;(function (root, factory) {
  7926  	if (typeof exports === "object") {
  7927  		// CommonJS
  7928  		module.exports = exports = factory();
  7929  	}
  7930  	else if (typeof define === "function" && define.amd) {
  7931  		// AMD
  7932  		define([], factory);
  7933  	}
  7934  	else {
  7935  		// Global (browser)
  7936  		root.CryptoJS = factory();
  7937  	}
  7938  }(this, function () {
  7939  
  7940  	/**
  7941  	 * CryptoJS core components.
  7942  	 */
  7943  	var CryptoJS = CryptoJS || (function (Math, undefined) {
  7944  	    /*
  7945  	     * Local polyfil of Object.create
  7946  	     */
  7947  	    var create = Object.create || (function () {
  7948  	        function F() {};
  7949  
  7950  	        return function (obj) {
  7951  	            var subtype;
  7952  
  7953  	            F.prototype = obj;
  7954  
  7955  	            subtype = new F();
  7956  
  7957  	            F.prototype = null;
  7958  
  7959  	            return subtype;
  7960  	        };
  7961  	    }())
  7962  
  7963  	    /**
  7964  	     * CryptoJS namespace.
  7965  	     */
  7966  	    var C = {};
  7967  
  7968  	    /**
  7969  	     * Library namespace.
  7970  	     */
  7971  	    var C_lib = C.lib = {};
  7972  
  7973  	    /**
  7974  	     * Base object for prototypal inheritance.
  7975  	     */
  7976  	    var Base = C_lib.Base = (function () {
  7977  
  7978  
  7979  	        return {
  7980  	            /**
  7981  	             * Creates a new object that inherits from this object.
  7982  	             *
  7983  	             * @param {Object} overrides Properties to copy into the new object.
  7984  	             *
  7985  	             * @return {Object} The new object.
  7986  	             *
  7987  	             * @static
  7988  	             *
  7989  	             * @example
  7990  	             *
  7991  	             *     var MyType = CryptoJS.lib.Base.extend({
  7992  	             *         field: 'value',
  7993  	             *
  7994  	             *         method: function () {
  7995  	             *         }
  7996  	             *     });
  7997  	             */
  7998  	            extend: function (overrides) {
  7999  	                // Spawn
  8000  	                var subtype = create(this);
  8001  
  8002  	                // Augment
  8003  	                if (overrides) {
  8004  	                    subtype.mixIn(overrides);
  8005  	                }
  8006  
  8007  	                // Create default initializer
  8008  	                if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  8009  	                    subtype.init = function () {
  8010  	                        subtype.$super.init.apply(this, arguments);
  8011  	                    };
  8012  	                }
  8013  
  8014  	                // Initializer's prototype is the subtype object
  8015  	                subtype.init.prototype = subtype;
  8016  
  8017  	                // Reference supertype
  8018  	                subtype.$super = this;
  8019  
  8020  	                return subtype;
  8021  	            },
  8022  
  8023  	            /**
  8024  	             * Extends this object and runs the init method.
  8025  	             * Arguments to create() will be passed to init().
  8026  	             *
  8027  	             * @return {Object} The new object.
  8028  	             *
  8029  	             * @static
  8030  	             *
  8031  	             * @example
  8032  	             *
  8033  	             *     var instance = MyType.create();
  8034  	             */
  8035  	            create: function () {
  8036  	                var instance = this.extend();
  8037  	                instance.init.apply(instance, arguments);
  8038  
  8039  	                return instance;
  8040  	            },
  8041  
  8042  	            /**
  8043  	             * Initializes a newly created object.
  8044  	             * Override this method to add some logic when your objects are created.
  8045  	             *
  8046  	             * @example
  8047  	             *
  8048  	             *     var MyType = CryptoJS.lib.Base.extend({
  8049  	             *         init: function () {
  8050  	             *             // ...
  8051  	             *         }
  8052  	             *     });
  8053  	             */
  8054  	            init: function () {
  8055  	            },
  8056  
  8057  	            /**
  8058  	             * Copies properties into this object.
  8059  	             *
  8060  	             * @param {Object} properties The properties to mix in.
  8061  	             *
  8062  	             * @example
  8063  	             *
  8064  	             *     MyType.mixIn({
  8065  	             *         field: 'value'
  8066  	             *     });
  8067  	             */
  8068  	            mixIn: function (properties) {
  8069  	                for (var propertyName in properties) {
  8070  	                    if (properties.hasOwnProperty(propertyName)) {
  8071  	                        this[propertyName] = properties[propertyName];
  8072  	                    }
  8073  	                }
  8074  
  8075  	                // IE won't copy toString using the loop above
  8076  	                if (properties.hasOwnProperty('toString')) {
  8077  	                    this.toString = properties.toString;
  8078  	                }
  8079  	            },
  8080  
  8081  	            /**
  8082  	             * Creates a copy of this object.
  8083  	             *
  8084  	             * @return {Object} The clone.
  8085  	             *
  8086  	             * @example
  8087  	             *
  8088  	             *     var clone = instance.clone();
  8089  	             */
  8090  	            clone: function () {
  8091  	                return this.init.prototype.extend(this);
  8092  	            }
  8093  	        };
  8094  	    }());
  8095  
  8096  	    /**
  8097  	     * An array of 32-bit words.
  8098  	     *
  8099  	     * @property {Array} words The array of 32-bit words.
  8100  	     * @property {number} sigBytes The number of significant bytes in this word array.
  8101  	     */
  8102  	    var WordArray = C_lib.WordArray = Base.extend({
  8103  	        /**
  8104  	         * Initializes a newly created word array.
  8105  	         *
  8106  	         * @param {Array} words (Optional) An array of 32-bit words.
  8107  	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  8108  	         *
  8109  	         * @example
  8110  	         *
  8111  	         *     var wordArray = CryptoJS.lib.WordArray.create();
  8112  	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  8113  	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  8114  	         */
  8115  	        init: function (words, sigBytes) {
  8116  	            words = this.words = words || [];
  8117  
  8118  	            if (sigBytes != undefined) {
  8119  	                this.sigBytes = sigBytes;
  8120  	            } else {
  8121  	                this.sigBytes = words.length * 4;
  8122  	            }
  8123  	        },
  8124  
  8125  	        /**
  8126  	         * Converts this word array to a string.
  8127  	         *
  8128  	         * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  8129  	         *
  8130  	         * @return {string} The stringified word array.
  8131  	         *
  8132  	         * @example
  8133  	         *
  8134  	         *     var string = wordArray + '';
  8135  	         *     var string = wordArray.toString();
  8136  	         *     var string = wordArray.toString(CryptoJS.enc.Utf8);
  8137  	         */
  8138  	        toString: function (encoder) {
  8139  	            return (encoder || Hex).stringify(this);
  8140  	        },
  8141  
  8142  	        /**
  8143  	         * Concatenates a word array to this word array.
  8144  	         *
  8145  	         * @param {WordArray} wordArray The word array to append.
  8146  	         *
  8147  	         * @return {WordArray} This word array.
  8148  	         *
  8149  	         * @example
  8150  	         *
  8151  	         *     wordArray1.concat(wordArray2);
  8152  	         */
  8153  	        concat: function (wordArray) {
  8154  	            // Shortcuts
  8155  	            var thisWords = this.words;
  8156  	            var thatWords = wordArray.words;
  8157  	            var thisSigBytes = this.sigBytes;
  8158  	            var thatSigBytes = wordArray.sigBytes;
  8159  
  8160  	            // Clamp excess bits
  8161  	            this.clamp();
  8162  
  8163  	            // Concat
  8164  	            if (thisSigBytes % 4) {
  8165  	                // Copy one byte at a time
  8166  	                for (var i = 0; i < thatSigBytes; i++) {
  8167  	                    var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  8168  	                    thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  8169  	                }
  8170  	            } else {
  8171  	                // Copy one word at a time
  8172  	                for (var i = 0; i < thatSigBytes; i += 4) {
  8173  	                    thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
  8174  	                }
  8175  	            }
  8176  	            this.sigBytes += thatSigBytes;
  8177  
  8178  	            // Chainable
  8179  	            return this;
  8180  	        },
  8181  
  8182  	        /**
  8183  	         * Removes insignificant bits.
  8184  	         *
  8185  	         * @example
  8186  	         *
  8187  	         *     wordArray.clamp();
  8188  	         */
  8189  	        clamp: function () {
  8190  	            // Shortcuts
  8191  	            var words = this.words;
  8192  	            var sigBytes = this.sigBytes;
  8193  
  8194  	            // Clamp
  8195  	            words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
  8196  	            words.length = Math.ceil(sigBytes / 4);
  8197  	        },
  8198  
  8199  	        /**
  8200  	         * Creates a copy of this word array.
  8201  	         *
  8202  	         * @return {WordArray} The clone.
  8203  	         *
  8204  	         * @example
  8205  	         *
  8206  	         *     var clone = wordArray.clone();
  8207  	         */
  8208  	        clone: function () {
  8209  	            var clone = Base.clone.call(this);
  8210  	            clone.words = this.words.slice(0);
  8211  
  8212  	            return clone;
  8213  	        },
  8214  
  8215  	        /**
  8216  	         * Creates a word array filled with random bytes.
  8217  	         *
  8218  	         * @param {number} nBytes The number of random bytes to generate.
  8219  	         *
  8220  	         * @return {WordArray} The random word array.
  8221  	         *
  8222  	         * @static
  8223  	         *
  8224  	         * @example
  8225  	         *
  8226  	         *     var wordArray = CryptoJS.lib.WordArray.random(16);
  8227  	         */
  8228  	        random: function (nBytes) {
  8229  	            var words = [];
  8230  
  8231  	            var r = (function (m_w) {
  8232  	                var m_w = m_w;
  8233  	                var m_z = 0x3ade68b1;
  8234  	                var mask = 0xffffffff;
  8235  
  8236  	                return function () {
  8237  	                    m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
  8238  	                    m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
  8239  	                    var result = ((m_z << 0x10) + m_w) & mask;
  8240  	                    result /= 0x100000000;
  8241  	                    result += 0.5;
  8242  	                    return result * (Math.random() > .5 ? 1 : -1);
  8243  	                }
  8244  	            });
  8245  
  8246  	            for (var i = 0, rcache; i < nBytes; i += 4) {
  8247  	                var _r = r((rcache || Math.random()) * 0x100000000);
  8248  
  8249  	                rcache = _r() * 0x3ade67b7;
  8250  	                words.push((_r() * 0x100000000) | 0);
  8251  	            }
  8252  
  8253  	            return new WordArray.init(words, nBytes);
  8254  	        }
  8255  	    });
  8256  
  8257  	    /**
  8258  	     * Encoder namespace.
  8259  	     */
  8260  	    var C_enc = C.enc = {};
  8261  
  8262  	    /**
  8263  	     * Hex encoding strategy.
  8264  	     */
  8265  	    var Hex = C_enc.Hex = {
  8266  	        /**
  8267  	         * Converts a word array to a hex string.
  8268  	         *
  8269  	         * @param {WordArray} wordArray The word array.
  8270  	         *
  8271  	         * @return {string} The hex string.
  8272  	         *
  8273  	         * @static
  8274  	         *
  8275  	         * @example
  8276  	         *
  8277  	         *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  8278  	         */
  8279  	        stringify: function (wordArray) {
  8280  	            // Shortcuts
  8281  	            var words = wordArray.words;
  8282  	            var sigBytes = wordArray.sigBytes;
  8283  
  8284  	            // Convert
  8285  	            var hexChars = [];
  8286  	            for (var i = 0; i < sigBytes; i++) {
  8287  	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  8288  	                hexChars.push((bite >>> 4).toString(16));
  8289  	                hexChars.push((bite & 0x0f).toString(16));
  8290  	            }
  8291  
  8292  	            return hexChars.join('');
  8293  	        },
  8294  
  8295  	        /**
  8296  	         * Converts a hex string to a word array.
  8297  	         *
  8298  	         * @param {string} hexStr The hex string.
  8299  	         *
  8300  	         * @return {WordArray} The word array.
  8301  	         *
  8302  	         * @static
  8303  	         *
  8304  	         * @example
  8305  	         *
  8306  	         *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
  8307  	         */
  8308  	        parse: function (hexStr) {
  8309  	            // Shortcut
  8310  	            var hexStrLength = hexStr.length;
  8311  
  8312  	            // Convert
  8313  	            var words = [];
  8314  	            for (var i = 0; i < hexStrLength; i += 2) {
  8315  	                words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  8316  	            }
  8317  
  8318  	            return new WordArray.init(words, hexStrLength / 2);
  8319  	        }
  8320  	    };
  8321  
  8322  	    /**
  8323  	     * Latin1 encoding strategy.
  8324  	     */
  8325  	    var Latin1 = C_enc.Latin1 = {
  8326  	        /**
  8327  	         * Converts a word array to a Latin1 string.
  8328  	         *
  8329  	         * @param {WordArray} wordArray The word array.
  8330  	         *
  8331  	         * @return {string} The Latin1 string.
  8332  	         *
  8333  	         * @static
  8334  	         *
  8335  	         * @example
  8336  	         *
  8337  	         *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  8338  	         */
  8339  	        stringify: function (wordArray) {
  8340  	            // Shortcuts
  8341  	            var words = wordArray.words;
  8342  	            var sigBytes = wordArray.sigBytes;
  8343  
  8344  	            // Convert
  8345  	            var latin1Chars = [];
  8346  	            for (var i = 0; i < sigBytes; i++) {
  8347  	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  8348  	                latin1Chars.push(String.fromCharCode(bite));
  8349  	            }
  8350  
  8351  	            return latin1Chars.join('');
  8352  	        },
  8353  
  8354  	        /**
  8355  	         * Converts a Latin1 string to a word array.
  8356  	         *
  8357  	         * @param {string} latin1Str The Latin1 string.
  8358  	         *
  8359  	         * @return {WordArray} The word array.
  8360  	         *
  8361  	         * @static
  8362  	         *
  8363  	         * @example
  8364  	         *
  8365  	         *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  8366  	         */
  8367  	        parse: function (latin1Str) {
  8368  	            // Shortcut
  8369  	            var latin1StrLength = latin1Str.length;
  8370  
  8371  	            // Convert
  8372  	            var words = [];
  8373  	            for (var i = 0; i < latin1StrLength; i++) {
  8374  	                words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  8375  	            }
  8376  
  8377  	            return new WordArray.init(words, latin1StrLength);
  8378  	        }
  8379  	    };
  8380  
  8381  	    /**
  8382  	     * UTF-8 encoding strategy.
  8383  	     */
  8384  	    var Utf8 = C_enc.Utf8 = {
  8385  	        /**
  8386  	         * Converts a word array to a UTF-8 string.
  8387  	         *
  8388  	         * @param {WordArray} wordArray The word array.
  8389  	         *
  8390  	         * @return {string} The UTF-8 string.
  8391  	         *
  8392  	         * @static
  8393  	         *
  8394  	         * @example
  8395  	         *
  8396  	         *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  8397  	         */
  8398  	        stringify: function (wordArray) {
  8399  	            try {
  8400  	                return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  8401  	            } catch (e) {
  8402  	                throw new Error('Malformed UTF-8 data');
  8403  	            }
  8404  	        },
  8405  
  8406  	        /**
  8407  	         * Converts a UTF-8 string to a word array.
  8408  	         *
  8409  	         * @param {string} utf8Str The UTF-8 string.
  8410  	         *
  8411  	         * @return {WordArray} The word array.
  8412  	         *
  8413  	         * @static
  8414  	         *
  8415  	         * @example
  8416  	         *
  8417  	         *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  8418  	         */
  8419  	        parse: function (utf8Str) {
  8420  	            return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  8421  	        }
  8422  	    };
  8423  
  8424  	    /**
  8425  	     * Abstract buffered block algorithm template.
  8426  	     *
  8427  	     * The property blockSize must be implemented in a concrete subtype.
  8428  	     *
  8429  	     * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  8430  	     */
  8431  	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  8432  	        /**
  8433  	         * Resets this block algorithm's data buffer to its initial state.
  8434  	         *
  8435  	         * @example
  8436  	         *
  8437  	         *     bufferedBlockAlgorithm.reset();
  8438  	         */
  8439  	        reset: function () {
  8440  	            // Initial values
  8441  	            this._data = new WordArray.init();
  8442  	            this._nDataBytes = 0;
  8443  	        },
  8444  
  8445  	        /**
  8446  	         * Adds new data to this block algorithm's buffer.
  8447  	         *
  8448  	         * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  8449  	         *
  8450  	         * @example
  8451  	         *
  8452  	         *     bufferedBlockAlgorithm._append('data');
  8453  	         *     bufferedBlockAlgorithm._append(wordArray);
  8454  	         */
  8455  	        _append: function (data) {
  8456  	            // Convert string to WordArray, else assume WordArray already
  8457  	            if (typeof data == 'string') {
  8458  	                data = Utf8.parse(data);
  8459  	            }
  8460  
  8461  	            // Append
  8462  	            this._data.concat(data);
  8463  	            this._nDataBytes += data.sigBytes;
  8464  	        },
  8465  
  8466  	        /**
  8467  	         * Processes available data blocks.
  8468  	         *
  8469  	         * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  8470  	         *
  8471  	         * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  8472  	         *
  8473  	         * @return {WordArray} The processed data.
  8474  	         *
  8475  	         * @example
  8476  	         *
  8477  	         *     var processedData = bufferedBlockAlgorithm._process();
  8478  	         *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
  8479  	         */
  8480  	        _process: function (doFlush) {
  8481  	            // Shortcuts
  8482  	            var data = this._data;
  8483  	            var dataWords = data.words;
  8484  	            var dataSigBytes = data.sigBytes;
  8485  	            var blockSize = this.blockSize;
  8486  	            var blockSizeBytes = blockSize * 4;
  8487  
  8488  	            // Count blocks ready
  8489  	            var nBlocksReady = dataSigBytes / blockSizeBytes;
  8490  	            if (doFlush) {
  8491  	                // Round up to include partial blocks
  8492  	                nBlocksReady = Math.ceil(nBlocksReady);
  8493  	            } else {
  8494  	                // Round down to include only full blocks,
  8495  	                // less the number of blocks that must remain in the buffer
  8496  	                nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  8497  	            }
  8498  
  8499  	            // Count words ready
  8500  	            var nWordsReady = nBlocksReady * blockSize;
  8501  
  8502  	            // Count bytes ready
  8503  	            var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  8504  
  8505  	            // Process blocks
  8506  	            if (nWordsReady) {
  8507  	                for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  8508  	                    // Perform concrete-algorithm logic
  8509  	                    this._doProcessBlock(dataWords, offset);
  8510  	                }
  8511  
  8512  	                // Remove processed words
  8513  	                var processedWords = dataWords.splice(0, nWordsReady);
  8514  	                data.sigBytes -= nBytesReady;
  8515  	            }
  8516  
  8517  	            // Return processed words
  8518  	            return new WordArray.init(processedWords, nBytesReady);
  8519  	        },
  8520  
  8521  	        /**
  8522  	         * Creates a copy of this object.
  8523  	         *
  8524  	         * @return {Object} The clone.
  8525  	         *
  8526  	         * @example
  8527  	         *
  8528  	         *     var clone = bufferedBlockAlgorithm.clone();
  8529  	         */
  8530  	        clone: function () {
  8531  	            var clone = Base.clone.call(this);
  8532  	            clone._data = this._data.clone();
  8533  
  8534  	            return clone;
  8535  	        },
  8536  
  8537  	        _minBufferSize: 0
  8538  	    });
  8539  
  8540  	    /**
  8541  	     * Abstract hasher template.
  8542  	     *
  8543  	     * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  8544  	     */
  8545  	    var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  8546  	        /**
  8547  	         * Configuration options.
  8548  	         */
  8549  	        cfg: Base.extend(),
  8550  
  8551  	        /**
  8552  	         * Initializes a newly created hasher.
  8553  	         *
  8554  	         * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  8555  	         *
  8556  	         * @example
  8557  	         *
  8558  	         *     var hasher = CryptoJS.algo.SHA256.create();
  8559  	         */
  8560  	        init: function (cfg) {
  8561  	            // Apply config defaults
  8562  	            this.cfg = this.cfg.extend(cfg);
  8563  
  8564  	            // Set initial values
  8565  	            this.reset();
  8566  	        },
  8567  
  8568  	        /**
  8569  	         * Resets this hasher to its initial state.
  8570  	         *
  8571  	         * @example
  8572  	         *
  8573  	         *     hasher.reset();
  8574  	         */
  8575  	        reset: function () {
  8576  	            // Reset data buffer
  8577  	            BufferedBlockAlgorithm.reset.call(this);
  8578  
  8579  	            // Perform concrete-hasher logic
  8580  	            this._doReset();
  8581  	        },
  8582  
  8583  	        /**
  8584  	         * Updates this hasher with a message.
  8585  	         *
  8586  	         * @param {WordArray|string} messageUpdate The message to append.
  8587  	         *
  8588  	         * @return {Hasher} This hasher.
  8589  	         *
  8590  	         * @example
  8591  	         *
  8592  	         *     hasher.update('message');
  8593  	         *     hasher.update(wordArray);
  8594  	         */
  8595  	        update: function (messageUpdate) {
  8596  	            // Append
  8597  	            this._append(messageUpdate);
  8598  
  8599  	            // Update the hash
  8600  	            this._process();
  8601  
  8602  	            // Chainable
  8603  	            return this;
  8604  	        },
  8605  
  8606  	        /**
  8607  	         * Finalizes the hash computation.
  8608  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  8609  	         *
  8610  	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
  8611  	         *
  8612  	         * @return {WordArray} The hash.
  8613  	         *
  8614  	         * @example
  8615  	         *
  8616  	         *     var hash = hasher.finalize();
  8617  	         *     var hash = hasher.finalize('message');
  8618  	         *     var hash = hasher.finalize(wordArray);
  8619  	         */
  8620  	        finalize: function (messageUpdate) {
  8621  	            // Final message update
  8622  	            if (messageUpdate) {
  8623  	                this._append(messageUpdate);
  8624  	            }
  8625  
  8626  	            // Perform concrete-hasher logic
  8627  	            var hash = this._doFinalize();
  8628  
  8629  	            return hash;
  8630  	        },
  8631  
  8632  	        blockSize: 512/32,
  8633  
  8634  	        /**
  8635  	         * Creates a shortcut function to a hasher's object interface.
  8636  	         *
  8637  	         * @param {Hasher} hasher The hasher to create a helper for.
  8638  	         *
  8639  	         * @return {Function} The shortcut function.
  8640  	         *
  8641  	         * @static
  8642  	         *
  8643  	         * @example
  8644  	         *
  8645  	         *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  8646  	         */
  8647  	        _createHelper: function (hasher) {
  8648  	            return function (message, cfg) {
  8649  	                return new hasher.init(cfg).finalize(message);
  8650  	            };
  8651  	        },
  8652  
  8653  	        /**
  8654  	         * Creates a shortcut function to the HMAC's object interface.
  8655  	         *
  8656  	         * @param {Hasher} hasher The hasher to use in this HMAC helper.
  8657  	         *
  8658  	         * @return {Function} The shortcut function.
  8659  	         *
  8660  	         * @static
  8661  	         *
  8662  	         * @example
  8663  	         *
  8664  	         *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  8665  	         */
  8666  	        _createHmacHelper: function (hasher) {
  8667  	            return function (message, key) {
  8668  	                return new C_algo.HMAC.init(hasher, key).finalize(message);
  8669  	            };
  8670  	        }
  8671  	    });
  8672  
  8673  	    /**
  8674  	     * Algorithm namespace.
  8675  	     */
  8676  	    var C_algo = C.algo = {};
  8677  
  8678  	    return C;
  8679  	}(Math));
  8680  
  8681  
  8682  	return CryptoJS;
  8683  
  8684  }));
  8685  },{}],54:[function(require,module,exports){
  8686  ;(function (root, factory) {
  8687  	if (typeof exports === "object") {
  8688  		// CommonJS
  8689  		module.exports = exports = factory(require("./core"));
  8690  	}
  8691  	else if (typeof define === "function" && define.amd) {
  8692  		// AMD
  8693  		define(["./core"], factory);
  8694  	}
  8695  	else {
  8696  		// Global (browser)
  8697  		factory(root.CryptoJS);
  8698  	}
  8699  }(this, function (CryptoJS) {
  8700  
  8701  	(function () {
  8702  	    // Shortcuts
  8703  	    var C = CryptoJS;
  8704  	    var C_lib = C.lib;
  8705  	    var WordArray = C_lib.WordArray;
  8706  	    var C_enc = C.enc;
  8707  
  8708  	    /**
  8709  	     * Base64 encoding strategy.
  8710  	     */
  8711  	    var Base64 = C_enc.Base64 = {
  8712  	        /**
  8713  	         * Converts a word array to a Base64 string.
  8714  	         *
  8715  	         * @param {WordArray} wordArray The word array.
  8716  	         *
  8717  	         * @return {string} The Base64 string.
  8718  	         *
  8719  	         * @static
  8720  	         *
  8721  	         * @example
  8722  	         *
  8723  	         *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  8724  	         */
  8725  	        stringify: function (wordArray) {
  8726  	            // Shortcuts
  8727  	            var words = wordArray.words;
  8728  	            var sigBytes = wordArray.sigBytes;
  8729  	            var map = this._map;
  8730  
  8731  	            // Clamp excess bits
  8732  	            wordArray.clamp();
  8733  
  8734  	            // Convert
  8735  	            var base64Chars = [];
  8736  	            for (var i = 0; i < sigBytes; i += 3) {
  8737  	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
  8738  	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  8739  	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  8740  
  8741  	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  8742  
  8743  	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  8744  	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  8745  	                }
  8746  	            }
  8747  
  8748  	            // Add padding
  8749  	            var paddingChar = map.charAt(64);
  8750  	            if (paddingChar) {
  8751  	                while (base64Chars.length % 4) {
  8752  	                    base64Chars.push(paddingChar);
  8753  	                }
  8754  	            }
  8755  
  8756  	            return base64Chars.join('');
  8757  	        },
  8758  
  8759  	        /**
  8760  	         * Converts a Base64 string to a word array.
  8761  	         *
  8762  	         * @param {string} base64Str The Base64 string.
  8763  	         *
  8764  	         * @return {WordArray} The word array.
  8765  	         *
  8766  	         * @static
  8767  	         *
  8768  	         * @example
  8769  	         *
  8770  	         *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
  8771  	         */
  8772  	        parse: function (base64Str) {
  8773  	            // Shortcuts
  8774  	            var base64StrLength = base64Str.length;
  8775  	            var map = this._map;
  8776  	            var reverseMap = this._reverseMap;
  8777  
  8778  	            if (!reverseMap) {
  8779  	                    reverseMap = this._reverseMap = [];
  8780  	                    for (var j = 0; j < map.length; j++) {
  8781  	                        reverseMap[map.charCodeAt(j)] = j;
  8782  	                    }
  8783  	            }
  8784  
  8785  	            // Ignore padding
  8786  	            var paddingChar = map.charAt(64);
  8787  	            if (paddingChar) {
  8788  	                var paddingIndex = base64Str.indexOf(paddingChar);
  8789  	                if (paddingIndex !== -1) {
  8790  	                    base64StrLength = paddingIndex;
  8791  	                }
  8792  	            }
  8793  
  8794  	            // Convert
  8795  	            return parseLoop(base64Str, base64StrLength, reverseMap);
  8796  
  8797  	        },
  8798  
  8799  	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  8800  	    };
  8801  
  8802  	    function parseLoop(base64Str, base64StrLength, reverseMap) {
  8803  	      var words = [];
  8804  	      var nBytes = 0;
  8805  	      for (var i = 0; i < base64StrLength; i++) {
  8806  	          if (i % 4) {
  8807  	              var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  8808  	              var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  8809  	              words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
  8810  	              nBytes++;
  8811  	          }
  8812  	      }
  8813  	      return WordArray.create(words, nBytes);
  8814  	    }
  8815  	}());
  8816  
  8817  
  8818  	return CryptoJS.enc.Base64;
  8819  
  8820  }));
  8821  },{"./core":53}],55:[function(require,module,exports){
  8822  ;(function (root, factory) {
  8823  	if (typeof exports === "object") {
  8824  		// CommonJS
  8825  		module.exports = exports = factory(require("./core"));
  8826  	}
  8827  	else if (typeof define === "function" && define.amd) {
  8828  		// AMD
  8829  		define(["./core"], factory);
  8830  	}
  8831  	else {
  8832  		// Global (browser)
  8833  		factory(root.CryptoJS);
  8834  	}
  8835  }(this, function (CryptoJS) {
  8836  
  8837  	(function () {
  8838  	    // Shortcuts
  8839  	    var C = CryptoJS;
  8840  	    var C_lib = C.lib;
  8841  	    var WordArray = C_lib.WordArray;
  8842  	    var C_enc = C.enc;
  8843  
  8844  	    /**
  8845  	     * UTF-16 BE encoding strategy.
  8846  	     */
  8847  	    var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
  8848  	        /**
  8849  	         * Converts a word array to a UTF-16 BE string.
  8850  	         *
  8851  	         * @param {WordArray} wordArray The word array.
  8852  	         *
  8853  	         * @return {string} The UTF-16 BE string.
  8854  	         *
  8855  	         * @static
  8856  	         *
  8857  	         * @example
  8858  	         *
  8859  	         *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  8860  	         */
  8861  	        stringify: function (wordArray) {
  8862  	            // Shortcuts
  8863  	            var words = wordArray.words;
  8864  	            var sigBytes = wordArray.sigBytes;
  8865  
  8866  	            // Convert
  8867  	            var utf16Chars = [];
  8868  	            for (var i = 0; i < sigBytes; i += 2) {
  8869  	                var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
  8870  	                utf16Chars.push(String.fromCharCode(codePoint));
  8871  	            }
  8872  
  8873  	            return utf16Chars.join('');
  8874  	        },
  8875  
  8876  	        /**
  8877  	         * Converts a UTF-16 BE string to a word array.
  8878  	         *
  8879  	         * @param {string} utf16Str The UTF-16 BE string.
  8880  	         *
  8881  	         * @return {WordArray} The word array.
  8882  	         *
  8883  	         * @static
  8884  	         *
  8885  	         * @example
  8886  	         *
  8887  	         *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  8888  	         */
  8889  	        parse: function (utf16Str) {
  8890  	            // Shortcut
  8891  	            var utf16StrLength = utf16Str.length;
  8892  
  8893  	            // Convert
  8894  	            var words = [];
  8895  	            for (var i = 0; i < utf16StrLength; i++) {
  8896  	                words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
  8897  	            }
  8898  
  8899  	            return WordArray.create(words, utf16StrLength * 2);
  8900  	        }
  8901  	    };
  8902  
  8903  	    /**
  8904  	     * UTF-16 LE encoding strategy.
  8905  	     */
  8906  	    C_enc.Utf16LE = {
  8907  	        /**
  8908  	         * Converts a word array to a UTF-16 LE string.
  8909  	         *
  8910  	         * @param {WordArray} wordArray The word array.
  8911  	         *
  8912  	         * @return {string} The UTF-16 LE string.
  8913  	         *
  8914  	         * @static
  8915  	         *
  8916  	         * @example
  8917  	         *
  8918  	         *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  8919  	         */
  8920  	        stringify: function (wordArray) {
  8921  	            // Shortcuts
  8922  	            var words = wordArray.words;
  8923  	            var sigBytes = wordArray.sigBytes;
  8924  
  8925  	            // Convert
  8926  	            var utf16Chars = [];
  8927  	            for (var i = 0; i < sigBytes; i += 2) {
  8928  	                var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
  8929  	                utf16Chars.push(String.fromCharCode(codePoint));
  8930  	            }
  8931  
  8932  	            return utf16Chars.join('');
  8933  	        },
  8934  
  8935  	        /**
  8936  	         * Converts a UTF-16 LE string to a word array.
  8937  	         *
  8938  	         * @param {string} utf16Str The UTF-16 LE string.
  8939  	         *
  8940  	         * @return {WordArray} The word array.
  8941  	         *
  8942  	         * @static
  8943  	         *
  8944  	         * @example
  8945  	         *
  8946  	         *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  8947  	         */
  8948  	        parse: function (utf16Str) {
  8949  	            // Shortcut
  8950  	            var utf16StrLength = utf16Str.length;
  8951  
  8952  	            // Convert
  8953  	            var words = [];
  8954  	            for (var i = 0; i < utf16StrLength; i++) {
  8955  	                words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
  8956  	            }
  8957  
  8958  	            return WordArray.create(words, utf16StrLength * 2);
  8959  	        }
  8960  	    };
  8961  
  8962  	    function swapEndian(word) {
  8963  	        return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
  8964  	    }
  8965  	}());
  8966  
  8967  
  8968  	return CryptoJS.enc.Utf16;
  8969  
  8970  }));
  8971  },{"./core":53}],56:[function(require,module,exports){
  8972  ;(function (root, factory, undef) {
  8973  	if (typeof exports === "object") {
  8974  		// CommonJS
  8975  		module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  8976  	}
  8977  	else if (typeof define === "function" && define.amd) {
  8978  		// AMD
  8979  		define(["./core", "./sha1", "./hmac"], factory);
  8980  	}
  8981  	else {
  8982  		// Global (browser)
  8983  		factory(root.CryptoJS);
  8984  	}
  8985  }(this, function (CryptoJS) {
  8986  
  8987  	(function () {
  8988  	    // Shortcuts
  8989  	    var C = CryptoJS;
  8990  	    var C_lib = C.lib;
  8991  	    var Base = C_lib.Base;
  8992  	    var WordArray = C_lib.WordArray;
  8993  	    var C_algo = C.algo;
  8994  	    var MD5 = C_algo.MD5;
  8995  
  8996  	    /**
  8997  	     * This key derivation function is meant to conform with EVP_BytesToKey.
  8998  	     * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  8999  	     */
  9000  	    var EvpKDF = C_algo.EvpKDF = Base.extend({
  9001  	        /**
  9002  	         * Configuration options.
  9003  	         *
  9004  	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  9005  	         * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  9006  	         * @property {number} iterations The number of iterations to perform. Default: 1
  9007  	         */
  9008  	        cfg: Base.extend({
  9009  	            keySize: 128/32,
  9010  	            hasher: MD5,
  9011  	            iterations: 1
  9012  	        }),
  9013  
  9014  	        /**
  9015  	         * Initializes a newly created key derivation function.
  9016  	         *
  9017  	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  9018  	         *
  9019  	         * @example
  9020  	         *
  9021  	         *     var kdf = CryptoJS.algo.EvpKDF.create();
  9022  	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  9023  	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  9024  	         */
  9025  	        init: function (cfg) {
  9026  	            this.cfg = this.cfg.extend(cfg);
  9027  	        },
  9028  
  9029  	        /**
  9030  	         * Derives a key from a password.
  9031  	         *
  9032  	         * @param {WordArray|string} password The password.
  9033  	         * @param {WordArray|string} salt A salt.
  9034  	         *
  9035  	         * @return {WordArray} The derived key.
  9036  	         *
  9037  	         * @example
  9038  	         *
  9039  	         *     var key = kdf.compute(password, salt);
  9040  	         */
  9041  	        compute: function (password, salt) {
  9042  	            // Shortcut
  9043  	            var cfg = this.cfg;
  9044  
  9045  	            // Init hasher
  9046  	            var hasher = cfg.hasher.create();
  9047  
  9048  	            // Initial values
  9049  	            var derivedKey = WordArray.create();
  9050  
  9051  	            // Shortcuts
  9052  	            var derivedKeyWords = derivedKey.words;
  9053  	            var keySize = cfg.keySize;
  9054  	            var iterations = cfg.iterations;
  9055  
  9056  	            // Generate key
  9057  	            while (derivedKeyWords.length < keySize) {
  9058  	                if (block) {
  9059  	                    hasher.update(block);
  9060  	                }
  9061  	                var block = hasher.update(password).finalize(salt);
  9062  	                hasher.reset();
  9063  
  9064  	                // Iterations
  9065  	                for (var i = 1; i < iterations; i++) {
  9066  	                    block = hasher.finalize(block);
  9067  	                    hasher.reset();
  9068  	                }
  9069  
  9070  	                derivedKey.concat(block);
  9071  	            }
  9072  	            derivedKey.sigBytes = keySize * 4;
  9073  
  9074  	            return derivedKey;
  9075  	        }
  9076  	    });
  9077  
  9078  	    /**
  9079  	     * Derives a key from a password.
  9080  	     *
  9081  	     * @param {WordArray|string} password The password.
  9082  	     * @param {WordArray|string} salt A salt.
  9083  	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
  9084  	     *
  9085  	     * @return {WordArray} The derived key.
  9086  	     *
  9087  	     * @static
  9088  	     *
  9089  	     * @example
  9090  	     *
  9091  	     *     var key = CryptoJS.EvpKDF(password, salt);
  9092  	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  9093  	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  9094  	     */
  9095  	    C.EvpKDF = function (password, salt, cfg) {
  9096  	        return EvpKDF.create(cfg).compute(password, salt);
  9097  	    };
  9098  	}());
  9099  
  9100  
  9101  	return CryptoJS.EvpKDF;
  9102  
  9103  }));
  9104  },{"./core":53,"./hmac":58,"./sha1":77}],57:[function(require,module,exports){
  9105  ;(function (root, factory, undef) {
  9106  	if (typeof exports === "object") {
  9107  		// CommonJS
  9108  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9109  	}
  9110  	else if (typeof define === "function" && define.amd) {
  9111  		// AMD
  9112  		define(["./core", "./cipher-core"], factory);
  9113  	}
  9114  	else {
  9115  		// Global (browser)
  9116  		factory(root.CryptoJS);
  9117  	}
  9118  }(this, function (CryptoJS) {
  9119  
  9120  	(function (undefined) {
  9121  	    // Shortcuts
  9122  	    var C = CryptoJS;
  9123  	    var C_lib = C.lib;
  9124  	    var CipherParams = C_lib.CipherParams;
  9125  	    var C_enc = C.enc;
  9126  	    var Hex = C_enc.Hex;
  9127  	    var C_format = C.format;
  9128  
  9129  	    var HexFormatter = C_format.Hex = {
  9130  	        /**
  9131  	         * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  9132  	         *
  9133  	         * @param {CipherParams} cipherParams The cipher params object.
  9134  	         *
  9135  	         * @return {string} The hexadecimally encoded string.
  9136  	         *
  9137  	         * @static
  9138  	         *
  9139  	         * @example
  9140  	         *
  9141  	         *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  9142  	         */
  9143  	        stringify: function (cipherParams) {
  9144  	            return cipherParams.ciphertext.toString(Hex);
  9145  	        },
  9146  
  9147  	        /**
  9148  	         * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  9149  	         *
  9150  	         * @param {string} input The hexadecimally encoded string.
  9151  	         *
  9152  	         * @return {CipherParams} The cipher params object.
  9153  	         *
  9154  	         * @static
  9155  	         *
  9156  	         * @example
  9157  	         *
  9158  	         *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
  9159  	         */
  9160  	        parse: function (input) {
  9161  	            var ciphertext = Hex.parse(input);
  9162  	            return CipherParams.create({ ciphertext: ciphertext });
  9163  	        }
  9164  	    };
  9165  	}());
  9166  
  9167  
  9168  	return CryptoJS.format.Hex;
  9169  
  9170  }));
  9171  },{"./cipher-core":52,"./core":53}],58:[function(require,module,exports){
  9172  ;(function (root, factory) {
  9173  	if (typeof exports === "object") {
  9174  		// CommonJS
  9175  		module.exports = exports = factory(require("./core"));
  9176  	}
  9177  	else if (typeof define === "function" && define.amd) {
  9178  		// AMD
  9179  		define(["./core"], factory);
  9180  	}
  9181  	else {
  9182  		// Global (browser)
  9183  		factory(root.CryptoJS);
  9184  	}
  9185  }(this, function (CryptoJS) {
  9186  
  9187  	(function () {
  9188  	    // Shortcuts
  9189  	    var C = CryptoJS;
  9190  	    var C_lib = C.lib;
  9191  	    var Base = C_lib.Base;
  9192  	    var C_enc = C.enc;
  9193  	    var Utf8 = C_enc.Utf8;
  9194  	    var C_algo = C.algo;
  9195  
  9196  	    /**
  9197  	     * HMAC algorithm.
  9198  	     */
  9199  	    var HMAC = C_algo.HMAC = Base.extend({
  9200  	        /**
  9201  	         * Initializes a newly created HMAC.
  9202  	         *
  9203  	         * @param {Hasher} hasher The hash algorithm to use.
  9204  	         * @param {WordArray|string} key The secret key.
  9205  	         *
  9206  	         * @example
  9207  	         *
  9208  	         *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  9209  	         */
  9210  	        init: function (hasher, key) {
  9211  	            // Init hasher
  9212  	            hasher = this._hasher = new hasher.init();
  9213  
  9214  	            // Convert string to WordArray, else assume WordArray already
  9215  	            if (typeof key == 'string') {
  9216  	                key = Utf8.parse(key);
  9217  	            }
  9218  
  9219  	            // Shortcuts
  9220  	            var hasherBlockSize = hasher.blockSize;
  9221  	            var hasherBlockSizeBytes = hasherBlockSize * 4;
  9222  
  9223  	            // Allow arbitrary length keys
  9224  	            if (key.sigBytes > hasherBlockSizeBytes) {
  9225  	                key = hasher.finalize(key);
  9226  	            }
  9227  
  9228  	            // Clamp excess bits
  9229  	            key.clamp();
  9230  
  9231  	            // Clone key for inner and outer pads
  9232  	            var oKey = this._oKey = key.clone();
  9233  	            var iKey = this._iKey = key.clone();
  9234  
  9235  	            // Shortcuts
  9236  	            var oKeyWords = oKey.words;
  9237  	            var iKeyWords = iKey.words;
  9238  
  9239  	            // XOR keys with pad constants
  9240  	            for (var i = 0; i < hasherBlockSize; i++) {
  9241  	                oKeyWords[i] ^= 0x5c5c5c5c;
  9242  	                iKeyWords[i] ^= 0x36363636;
  9243  	            }
  9244  	            oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  9245  
  9246  	            // Set initial values
  9247  	            this.reset();
  9248  	        },
  9249  
  9250  	        /**
  9251  	         * Resets this HMAC to its initial state.
  9252  	         *
  9253  	         * @example
  9254  	         *
  9255  	         *     hmacHasher.reset();
  9256  	         */
  9257  	        reset: function () {
  9258  	            // Shortcut
  9259  	            var hasher = this._hasher;
  9260  
  9261  	            // Reset
  9262  	            hasher.reset();
  9263  	            hasher.update(this._iKey);
  9264  	        },
  9265  
  9266  	        /**
  9267  	         * Updates this HMAC with a message.
  9268  	         *
  9269  	         * @param {WordArray|string} messageUpdate The message to append.
  9270  	         *
  9271  	         * @return {HMAC} This HMAC instance.
  9272  	         *
  9273  	         * @example
  9274  	         *
  9275  	         *     hmacHasher.update('message');
  9276  	         *     hmacHasher.update(wordArray);
  9277  	         */
  9278  	        update: function (messageUpdate) {
  9279  	            this._hasher.update(messageUpdate);
  9280  
  9281  	            // Chainable
  9282  	            return this;
  9283  	        },
  9284  
  9285  	        /**
  9286  	         * Finalizes the HMAC computation.
  9287  	         * Note that the finalize operation is effectively a destructive, read-once operation.
  9288  	         *
  9289  	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
  9290  	         *
  9291  	         * @return {WordArray} The HMAC.
  9292  	         *
  9293  	         * @example
  9294  	         *
  9295  	         *     var hmac = hmacHasher.finalize();
  9296  	         *     var hmac = hmacHasher.finalize('message');
  9297  	         *     var hmac = hmacHasher.finalize(wordArray);
  9298  	         */
  9299  	        finalize: function (messageUpdate) {
  9300  	            // Shortcut
  9301  	            var hasher = this._hasher;
  9302  
  9303  	            // Compute HMAC
  9304  	            var innerHash = hasher.finalize(messageUpdate);
  9305  	            hasher.reset();
  9306  	            var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  9307  
  9308  	            return hmac;
  9309  	        }
  9310  	    });
  9311  	}());
  9312  
  9313  
  9314  }));
  9315  },{"./core":53}],59:[function(require,module,exports){
  9316  ;(function (root, factory, undef) {
  9317  	if (typeof exports === "object") {
  9318  		// CommonJS
  9319  		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"));
  9320  	}
  9321  	else if (typeof define === "function" && define.amd) {
  9322  		// AMD
  9323  		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);
  9324  	}
  9325  	else {
  9326  		// Global (browser)
  9327  		root.CryptoJS = factory(root.CryptoJS);
  9328  	}
  9329  }(this, function (CryptoJS) {
  9330  
  9331  	return CryptoJS;
  9332  
  9333  }));
  9334  },{"./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){
  9335  ;(function (root, factory) {
  9336  	if (typeof exports === "object") {
  9337  		// CommonJS
  9338  		module.exports = exports = factory(require("./core"));
  9339  	}
  9340  	else if (typeof define === "function" && define.amd) {
  9341  		// AMD
  9342  		define(["./core"], factory);
  9343  	}
  9344  	else {
  9345  		// Global (browser)
  9346  		factory(root.CryptoJS);
  9347  	}
  9348  }(this, function (CryptoJS) {
  9349  
  9350  	(function () {
  9351  	    // Check if typed arrays are supported
  9352  	    if (typeof ArrayBuffer != 'function') {
  9353  	        return;
  9354  	    }
  9355  
  9356  	    // Shortcuts
  9357  	    var C = CryptoJS;
  9358  	    var C_lib = C.lib;
  9359  	    var WordArray = C_lib.WordArray;
  9360  
  9361  	    // Reference original init
  9362  	    var superInit = WordArray.init;
  9363  
  9364  	    // Augment WordArray.init to handle typed arrays
  9365  	    var subInit = WordArray.init = function (typedArray) {
  9366  	        // Convert buffers to uint8
  9367  	        if (typedArray instanceof ArrayBuffer) {
  9368  	            typedArray = new Uint8Array(typedArray);
  9369  	        }
  9370  
  9371  	        // Convert other array views to uint8
  9372  	        if (
  9373  	            typedArray instanceof Int8Array ||
  9374  	            (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
  9375  	            typedArray instanceof Int16Array ||
  9376  	            typedArray instanceof Uint16Array ||
  9377  	            typedArray instanceof Int32Array ||
  9378  	            typedArray instanceof Uint32Array ||
  9379  	            typedArray instanceof Float32Array ||
  9380  	            typedArray instanceof Float64Array
  9381  	        ) {
  9382  	            typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
  9383  	        }
  9384  
  9385  	        // Handle Uint8Array
  9386  	        if (typedArray instanceof Uint8Array) {
  9387  	            // Shortcut
  9388  	            var typedArrayByteLength = typedArray.byteLength;
  9389  
  9390  	            // Extract bytes
  9391  	            var words = [];
  9392  	            for (var i = 0; i < typedArrayByteLength; i++) {
  9393  	                words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
  9394  	            }
  9395  
  9396  	            // Initialize this word array
  9397  	            superInit.call(this, words, typedArrayByteLength);
  9398  	        } else {
  9399  	            // Else call normal init
  9400  	            superInit.apply(this, arguments);
  9401  	        }
  9402  	    };
  9403  
  9404  	    subInit.prototype = WordArray;
  9405  	}());
  9406  
  9407  
  9408  	return CryptoJS.lib.WordArray;
  9409  
  9410  }));
  9411  },{"./core":53}],61:[function(require,module,exports){
  9412  ;(function (root, factory) {
  9413  	if (typeof exports === "object") {
  9414  		// CommonJS
  9415  		module.exports = exports = factory(require("./core"));
  9416  	}
  9417  	else if (typeof define === "function" && define.amd) {
  9418  		// AMD
  9419  		define(["./core"], factory);
  9420  	}
  9421  	else {
  9422  		// Global (browser)
  9423  		factory(root.CryptoJS);
  9424  	}
  9425  }(this, function (CryptoJS) {
  9426  
  9427  	(function (Math) {
  9428  	    // Shortcuts
  9429  	    var C = CryptoJS;
  9430  	    var C_lib = C.lib;
  9431  	    var WordArray = C_lib.WordArray;
  9432  	    var Hasher = C_lib.Hasher;
  9433  	    var C_algo = C.algo;
  9434  
  9435  	    // Constants table
  9436  	    var T = [];
  9437  
  9438  	    // Compute constants
  9439  	    (function () {
  9440  	        for (var i = 0; i < 64; i++) {
  9441  	            T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
  9442  	        }
  9443  	    }());
  9444  
  9445  	    /**
  9446  	     * MD5 hash algorithm.
  9447  	     */
  9448  	    var MD5 = C_algo.MD5 = Hasher.extend({
  9449  	        _doReset: function () {
  9450  	            this._hash = new WordArray.init([
  9451  	                0x67452301, 0xefcdab89,
  9452  	                0x98badcfe, 0x10325476
  9453  	            ]);
  9454  	        },
  9455  
  9456  	        _doProcessBlock: function (M, offset) {
  9457  	            // Swap endian
  9458  	            for (var i = 0; i < 16; i++) {
  9459  	                // Shortcuts
  9460  	                var offset_i = offset + i;
  9461  	                var M_offset_i = M[offset_i];
  9462  
  9463  	                M[offset_i] = (
  9464  	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
  9465  	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
  9466  	                );
  9467  	            }
  9468  
  9469  	            // Shortcuts
  9470  	            var H = this._hash.words;
  9471  
  9472  	            var M_offset_0  = M[offset + 0];
  9473  	            var M_offset_1  = M[offset + 1];
  9474  	            var M_offset_2  = M[offset + 2];
  9475  	            var M_offset_3  = M[offset + 3];
  9476  	            var M_offset_4  = M[offset + 4];
  9477  	            var M_offset_5  = M[offset + 5];
  9478  	            var M_offset_6  = M[offset + 6];
  9479  	            var M_offset_7  = M[offset + 7];
  9480  	            var M_offset_8  = M[offset + 8];
  9481  	            var M_offset_9  = M[offset + 9];
  9482  	            var M_offset_10 = M[offset + 10];
  9483  	            var M_offset_11 = M[offset + 11];
  9484  	            var M_offset_12 = M[offset + 12];
  9485  	            var M_offset_13 = M[offset + 13];
  9486  	            var M_offset_14 = M[offset + 14];
  9487  	            var M_offset_15 = M[offset + 15];
  9488  
  9489  	            // Working varialbes
  9490  	            var a = H[0];
  9491  	            var b = H[1];
  9492  	            var c = H[2];
  9493  	            var d = H[3];
  9494  
  9495  	            // Computation
  9496  	            a = FF(a, b, c, d, M_offset_0,  7,  T[0]);
  9497  	            d = FF(d, a, b, c, M_offset_1,  12, T[1]);
  9498  	            c = FF(c, d, a, b, M_offset_2,  17, T[2]);
  9499  	            b = FF(b, c, d, a, M_offset_3,  22, T[3]);
  9500  	            a = FF(a, b, c, d, M_offset_4,  7,  T[4]);
  9501  	            d = FF(d, a, b, c, M_offset_5,  12, T[5]);
  9502  	            c = FF(c, d, a, b, M_offset_6,  17, T[6]);
  9503  	            b = FF(b, c, d, a, M_offset_7,  22, T[7]);
  9504  	            a = FF(a, b, c, d, M_offset_8,  7,  T[8]);
  9505  	            d = FF(d, a, b, c, M_offset_9,  12, T[9]);
  9506  	            c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  9507  	            b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  9508  	            a = FF(a, b, c, d, M_offset_12, 7,  T[12]);
  9509  	            d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  9510  	            c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  9511  	            b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  9512  
  9513  	            a = GG(a, b, c, d, M_offset_1,  5,  T[16]);
  9514  	            d = GG(d, a, b, c, M_offset_6,  9,  T[17]);
  9515  	            c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  9516  	            b = GG(b, c, d, a, M_offset_0,  20, T[19]);
  9517  	            a = GG(a, b, c, d, M_offset_5,  5,  T[20]);
  9518  	            d = GG(d, a, b, c, M_offset_10, 9,  T[21]);
  9519  	            c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  9520  	            b = GG(b, c, d, a, M_offset_4,  20, T[23]);
  9521  	            a = GG(a, b, c, d, M_offset_9,  5,  T[24]);
  9522  	            d = GG(d, a, b, c, M_offset_14, 9,  T[25]);
  9523  	            c = GG(c, d, a, b, M_offset_3,  14, T[26]);
  9524  	            b = GG(b, c, d, a, M_offset_8,  20, T[27]);
  9525  	            a = GG(a, b, c, d, M_offset_13, 5,  T[28]);
  9526  	            d = GG(d, a, b, c, M_offset_2,  9,  T[29]);
  9527  	            c = GG(c, d, a, b, M_offset_7,  14, T[30]);
  9528  	            b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  9529  
  9530  	            a = HH(a, b, c, d, M_offset_5,  4,  T[32]);
  9531  	            d = HH(d, a, b, c, M_offset_8,  11, T[33]);
  9532  	            c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  9533  	            b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  9534  	            a = HH(a, b, c, d, M_offset_1,  4,  T[36]);
  9535  	            d = HH(d, a, b, c, M_offset_4,  11, T[37]);
  9536  	            c = HH(c, d, a, b, M_offset_7,  16, T[38]);
  9537  	            b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  9538  	            a = HH(a, b, c, d, M_offset_13, 4,  T[40]);
  9539  	            d = HH(d, a, b, c, M_offset_0,  11, T[41]);
  9540  	            c = HH(c, d, a, b, M_offset_3,  16, T[42]);
  9541  	            b = HH(b, c, d, a, M_offset_6,  23, T[43]);
  9542  	            a = HH(a, b, c, d, M_offset_9,  4,  T[44]);
  9543  	            d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  9544  	            c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  9545  	            b = HH(b, c, d, a, M_offset_2,  23, T[47]);
  9546  
  9547  	            a = II(a, b, c, d, M_offset_0,  6,  T[48]);
  9548  	            d = II(d, a, b, c, M_offset_7,  10, T[49]);
  9549  	            c = II(c, d, a, b, M_offset_14, 15, T[50]);
  9550  	            b = II(b, c, d, a, M_offset_5,  21, T[51]);
  9551  	            a = II(a, b, c, d, M_offset_12, 6,  T[52]);
  9552  	            d = II(d, a, b, c, M_offset_3,  10, T[53]);
  9553  	            c = II(c, d, a, b, M_offset_10, 15, T[54]);
  9554  	            b = II(b, c, d, a, M_offset_1,  21, T[55]);
  9555  	            a = II(a, b, c, d, M_offset_8,  6,  T[56]);
  9556  	            d = II(d, a, b, c, M_offset_15, 10, T[57]);
  9557  	            c = II(c, d, a, b, M_offset_6,  15, T[58]);
  9558  	            b = II(b, c, d, a, M_offset_13, 21, T[59]);
  9559  	            a = II(a, b, c, d, M_offset_4,  6,  T[60]);
  9560  	            d = II(d, a, b, c, M_offset_11, 10, T[61]);
  9561  	            c = II(c, d, a, b, M_offset_2,  15, T[62]);
  9562  	            b = II(b, c, d, a, M_offset_9,  21, T[63]);
  9563  
  9564  	            // Intermediate hash value
  9565  	            H[0] = (H[0] + a) | 0;
  9566  	            H[1] = (H[1] + b) | 0;
  9567  	            H[2] = (H[2] + c) | 0;
  9568  	            H[3] = (H[3] + d) | 0;
  9569  	        },
  9570  
  9571  	        _doFinalize: function () {
  9572  	            // Shortcuts
  9573  	            var data = this._data;
  9574  	            var dataWords = data.words;
  9575  
  9576  	            var nBitsTotal = this._nDataBytes * 8;
  9577  	            var nBitsLeft = data.sigBytes * 8;
  9578  
  9579  	            // Add padding
  9580  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  9581  
  9582  	            var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  9583  	            var nBitsTotalL = nBitsTotal;
  9584  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
  9585  	                (((nBitsTotalH << 8)  | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
  9586  	                (((nBitsTotalH << 24) | (nBitsTotalH >>> 8))  & 0xff00ff00)
  9587  	            );
  9588  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  9589  	                (((nBitsTotalL << 8)  | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
  9590  	                (((nBitsTotalL << 24) | (nBitsTotalL >>> 8))  & 0xff00ff00)
  9591  	            );
  9592  
  9593  	            data.sigBytes = (dataWords.length + 1) * 4;
  9594  
  9595  	            // Hash final blocks
  9596  	            this._process();
  9597  
  9598  	            // Shortcuts
  9599  	            var hash = this._hash;
  9600  	            var H = hash.words;
  9601  
  9602  	            // Swap endian
  9603  	            for (var i = 0; i < 4; i++) {
  9604  	                // Shortcut
  9605  	                var H_i = H[i];
  9606  
  9607  	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
  9608  	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
  9609  	            }
  9610  
  9611  	            // Return final computed hash
  9612  	            return hash;
  9613  	        },
  9614  
  9615  	        clone: function () {
  9616  	            var clone = Hasher.clone.call(this);
  9617  	            clone._hash = this._hash.clone();
  9618  
  9619  	            return clone;
  9620  	        }
  9621  	    });
  9622  
  9623  	    function FF(a, b, c, d, x, s, t) {
  9624  	        var n = a + ((b & c) | (~b & d)) + x + t;
  9625  	        return ((n << s) | (n >>> (32 - s))) + b;
  9626  	    }
  9627  
  9628  	    function GG(a, b, c, d, x, s, t) {
  9629  	        var n = a + ((b & d) | (c & ~d)) + x + t;
  9630  	        return ((n << s) | (n >>> (32 - s))) + b;
  9631  	    }
  9632  
  9633  	    function HH(a, b, c, d, x, s, t) {
  9634  	        var n = a + (b ^ c ^ d) + x + t;
  9635  	        return ((n << s) | (n >>> (32 - s))) + b;
  9636  	    }
  9637  
  9638  	    function II(a, b, c, d, x, s, t) {
  9639  	        var n = a + (c ^ (b | ~d)) + x + t;
  9640  	        return ((n << s) | (n >>> (32 - s))) + b;
  9641  	    }
  9642  
  9643  	    /**
  9644  	     * Shortcut function to the hasher's object interface.
  9645  	     *
  9646  	     * @param {WordArray|string} message The message to hash.
  9647  	     *
  9648  	     * @return {WordArray} The hash.
  9649  	     *
  9650  	     * @static
  9651  	     *
  9652  	     * @example
  9653  	     *
  9654  	     *     var hash = CryptoJS.MD5('message');
  9655  	     *     var hash = CryptoJS.MD5(wordArray);
  9656  	     */
  9657  	    C.MD5 = Hasher._createHelper(MD5);
  9658  
  9659  	    /**
  9660  	     * Shortcut function to the HMAC's object interface.
  9661  	     *
  9662  	     * @param {WordArray|string} message The message to hash.
  9663  	     * @param {WordArray|string} key The secret key.
  9664  	     *
  9665  	     * @return {WordArray} The HMAC.
  9666  	     *
  9667  	     * @static
  9668  	     *
  9669  	     * @example
  9670  	     *
  9671  	     *     var hmac = CryptoJS.HmacMD5(message, key);
  9672  	     */
  9673  	    C.HmacMD5 = Hasher._createHmacHelper(MD5);
  9674  	}(Math));
  9675  
  9676  
  9677  	return CryptoJS.MD5;
  9678  
  9679  }));
  9680  },{"./core":53}],62:[function(require,module,exports){
  9681  ;(function (root, factory, undef) {
  9682  	if (typeof exports === "object") {
  9683  		// CommonJS
  9684  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9685  	}
  9686  	else if (typeof define === "function" && define.amd) {
  9687  		// AMD
  9688  		define(["./core", "./cipher-core"], factory);
  9689  	}
  9690  	else {
  9691  		// Global (browser)
  9692  		factory(root.CryptoJS);
  9693  	}
  9694  }(this, function (CryptoJS) {
  9695  
  9696  	/**
  9697  	 * Cipher Feedback block mode.
  9698  	 */
  9699  	CryptoJS.mode.CFB = (function () {
  9700  	    var CFB = CryptoJS.lib.BlockCipherMode.extend();
  9701  
  9702  	    CFB.Encryptor = CFB.extend({
  9703  	        processBlock: function (words, offset) {
  9704  	            // Shortcuts
  9705  	            var cipher = this._cipher;
  9706  	            var blockSize = cipher.blockSize;
  9707  
  9708  	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  9709  
  9710  	            // Remember this block to use with next block
  9711  	            this._prevBlock = words.slice(offset, offset + blockSize);
  9712  	        }
  9713  	    });
  9714  
  9715  	    CFB.Decryptor = CFB.extend({
  9716  	        processBlock: function (words, offset) {
  9717  	            // Shortcuts
  9718  	            var cipher = this._cipher;
  9719  	            var blockSize = cipher.blockSize;
  9720  
  9721  	            // Remember this block to use with next block
  9722  	            var thisBlock = words.slice(offset, offset + blockSize);
  9723  
  9724  	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  9725  
  9726  	            // This block becomes the previous block
  9727  	            this._prevBlock = thisBlock;
  9728  	        }
  9729  	    });
  9730  
  9731  	    function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
  9732  	        // Shortcut
  9733  	        var iv = this._iv;
  9734  
  9735  	        // Generate keystream
  9736  	        if (iv) {
  9737  	            var keystream = iv.slice(0);
  9738  
  9739  	            // Remove IV for subsequent blocks
  9740  	            this._iv = undefined;
  9741  	        } else {
  9742  	            var keystream = this._prevBlock;
  9743  	        }
  9744  	        cipher.encryptBlock(keystream, 0);
  9745  
  9746  	        // Encrypt
  9747  	        for (var i = 0; i < blockSize; i++) {
  9748  	            words[offset + i] ^= keystream[i];
  9749  	        }
  9750  	    }
  9751  
  9752  	    return CFB;
  9753  	}());
  9754  
  9755  
  9756  	return CryptoJS.mode.CFB;
  9757  
  9758  }));
  9759  },{"./cipher-core":52,"./core":53}],63:[function(require,module,exports){
  9760  ;(function (root, factory, undef) {
  9761  	if (typeof exports === "object") {
  9762  		// CommonJS
  9763  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9764  	}
  9765  	else if (typeof define === "function" && define.amd) {
  9766  		// AMD
  9767  		define(["./core", "./cipher-core"], factory);
  9768  	}
  9769  	else {
  9770  		// Global (browser)
  9771  		factory(root.CryptoJS);
  9772  	}
  9773  }(this, function (CryptoJS) {
  9774  
  9775  	/** @preserve
  9776  	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
  9777  	 * derived from CryptoJS.mode.CTR
  9778  	 * Jan Hruby jhruby.web@gmail.com
  9779  	 */
  9780  	CryptoJS.mode.CTRGladman = (function () {
  9781  	    var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
  9782  
  9783  		function incWord(word)
  9784  		{
  9785  			if (((word >> 24) & 0xff) === 0xff) { //overflow
  9786  			var b1 = (word >> 16)&0xff;
  9787  			var b2 = (word >> 8)&0xff;
  9788  			var b3 = word & 0xff;
  9789  
  9790  			if (b1 === 0xff) // overflow b1
  9791  			{
  9792  			b1 = 0;
  9793  			if (b2 === 0xff)
  9794  			{
  9795  				b2 = 0;
  9796  				if (b3 === 0xff)
  9797  				{
  9798  					b3 = 0;
  9799  				}
  9800  				else
  9801  				{
  9802  					++b3;
  9803  				}
  9804  			}
  9805  			else
  9806  			{
  9807  				++b2;
  9808  			}
  9809  			}
  9810  			else
  9811  			{
  9812  			++b1;
  9813  			}
  9814  
  9815  			word = 0;
  9816  			word += (b1 << 16);
  9817  			word += (b2 << 8);
  9818  			word += b3;
  9819  			}
  9820  			else
  9821  			{
  9822  			word += (0x01 << 24);
  9823  			}
  9824  			return word;
  9825  		}
  9826  
  9827  		function incCounter(counter)
  9828  		{
  9829  			if ((counter[0] = incWord(counter[0])) === 0)
  9830  			{
  9831  				// encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
  9832  				counter[1] = incWord(counter[1]);
  9833  			}
  9834  			return counter;
  9835  		}
  9836  
  9837  	    var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
  9838  	        processBlock: function (words, offset) {
  9839  	            // Shortcuts
  9840  	            var cipher = this._cipher
  9841  	            var blockSize = cipher.blockSize;
  9842  	            var iv = this._iv;
  9843  	            var counter = this._counter;
  9844  
  9845  	            // Generate keystream
  9846  	            if (iv) {
  9847  	                counter = this._counter = iv.slice(0);
  9848  
  9849  	                // Remove IV for subsequent blocks
  9850  	                this._iv = undefined;
  9851  	            }
  9852  
  9853  				incCounter(counter);
  9854  
  9855  				var keystream = counter.slice(0);
  9856  	            cipher.encryptBlock(keystream, 0);
  9857  
  9858  	            // Encrypt
  9859  	            for (var i = 0; i < blockSize; i++) {
  9860  	                words[offset + i] ^= keystream[i];
  9861  	            }
  9862  	        }
  9863  	    });
  9864  
  9865  	    CTRGladman.Decryptor = Encryptor;
  9866  
  9867  	    return CTRGladman;
  9868  	}());
  9869  
  9870  
  9871  
  9872  
  9873  	return CryptoJS.mode.CTRGladman;
  9874  
  9875  }));
  9876  },{"./cipher-core":52,"./core":53}],64:[function(require,module,exports){
  9877  ;(function (root, factory, undef) {
  9878  	if (typeof exports === "object") {
  9879  		// CommonJS
  9880  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9881  	}
  9882  	else if (typeof define === "function" && define.amd) {
  9883  		// AMD
  9884  		define(["./core", "./cipher-core"], factory);
  9885  	}
  9886  	else {
  9887  		// Global (browser)
  9888  		factory(root.CryptoJS);
  9889  	}
  9890  }(this, function (CryptoJS) {
  9891  
  9892  	/**
  9893  	 * Counter block mode.
  9894  	 */
  9895  	CryptoJS.mode.CTR = (function () {
  9896  	    var CTR = CryptoJS.lib.BlockCipherMode.extend();
  9897  
  9898  	    var Encryptor = CTR.Encryptor = CTR.extend({
  9899  	        processBlock: function (words, offset) {
  9900  	            // Shortcuts
  9901  	            var cipher = this._cipher
  9902  	            var blockSize = cipher.blockSize;
  9903  	            var iv = this._iv;
  9904  	            var counter = this._counter;
  9905  
  9906  	            // Generate keystream
  9907  	            if (iv) {
  9908  	                counter = this._counter = iv.slice(0);
  9909  
  9910  	                // Remove IV for subsequent blocks
  9911  	                this._iv = undefined;
  9912  	            }
  9913  	            var keystream = counter.slice(0);
  9914  	            cipher.encryptBlock(keystream, 0);
  9915  
  9916  	            // Increment counter
  9917  	            counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
  9918  
  9919  	            // Encrypt
  9920  	            for (var i = 0; i < blockSize; i++) {
  9921  	                words[offset + i] ^= keystream[i];
  9922  	            }
  9923  	        }
  9924  	    });
  9925  
  9926  	    CTR.Decryptor = Encryptor;
  9927  
  9928  	    return CTR;
  9929  	}());
  9930  
  9931  
  9932  	return CryptoJS.mode.CTR;
  9933  
  9934  }));
  9935  },{"./cipher-core":52,"./core":53}],65:[function(require,module,exports){
  9936  ;(function (root, factory, undef) {
  9937  	if (typeof exports === "object") {
  9938  		// CommonJS
  9939  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9940  	}
  9941  	else if (typeof define === "function" && define.amd) {
  9942  		// AMD
  9943  		define(["./core", "./cipher-core"], factory);
  9944  	}
  9945  	else {
  9946  		// Global (browser)
  9947  		factory(root.CryptoJS);
  9948  	}
  9949  }(this, function (CryptoJS) {
  9950  
  9951  	/**
  9952  	 * Electronic Codebook block mode.
  9953  	 */
  9954  	CryptoJS.mode.ECB = (function () {
  9955  	    var ECB = CryptoJS.lib.BlockCipherMode.extend();
  9956  
  9957  	    ECB.Encryptor = ECB.extend({
  9958  	        processBlock: function (words, offset) {
  9959  	            this._cipher.encryptBlock(words, offset);
  9960  	        }
  9961  	    });
  9962  
  9963  	    ECB.Decryptor = ECB.extend({
  9964  	        processBlock: function (words, offset) {
  9965  	            this._cipher.decryptBlock(words, offset);
  9966  	        }
  9967  	    });
  9968  
  9969  	    return ECB;
  9970  	}());
  9971  
  9972  
  9973  	return CryptoJS.mode.ECB;
  9974  
  9975  }));
  9976  },{"./cipher-core":52,"./core":53}],66:[function(require,module,exports){
  9977  ;(function (root, factory, undef) {
  9978  	if (typeof exports === "object") {
  9979  		// CommonJS
  9980  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
  9981  	}
  9982  	else if (typeof define === "function" && define.amd) {
  9983  		// AMD
  9984  		define(["./core", "./cipher-core"], factory);
  9985  	}
  9986  	else {
  9987  		// Global (browser)
  9988  		factory(root.CryptoJS);
  9989  	}
  9990  }(this, function (CryptoJS) {
  9991  
  9992  	/**
  9993  	 * Output Feedback block mode.
  9994  	 */
  9995  	CryptoJS.mode.OFB = (function () {
  9996  	    var OFB = CryptoJS.lib.BlockCipherMode.extend();
  9997  
  9998  	    var Encryptor = OFB.Encryptor = OFB.extend({
  9999  	        processBlock: function (words, offset) {
 10000  	            // Shortcuts
 10001  	            var cipher = this._cipher
 10002  	            var blockSize = cipher.blockSize;
 10003  	            var iv = this._iv;
 10004  	            var keystream = this._keystream;
 10005  
 10006  	            // Generate keystream
 10007  	            if (iv) {
 10008  	                keystream = this._keystream = iv.slice(0);
 10009  
 10010  	                // Remove IV for subsequent blocks
 10011  	                this._iv = undefined;
 10012  	            }
 10013  	            cipher.encryptBlock(keystream, 0);
 10014  
 10015  	            // Encrypt
 10016  	            for (var i = 0; i < blockSize; i++) {
 10017  	                words[offset + i] ^= keystream[i];
 10018  	            }
 10019  	        }
 10020  	    });
 10021  
 10022  	    OFB.Decryptor = Encryptor;
 10023  
 10024  	    return OFB;
 10025  	}());
 10026  
 10027  
 10028  	return CryptoJS.mode.OFB;
 10029  
 10030  }));
 10031  },{"./cipher-core":52,"./core":53}],67:[function(require,module,exports){
 10032  ;(function (root, factory, undef) {
 10033  	if (typeof exports === "object") {
 10034  		// CommonJS
 10035  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
 10036  	}
 10037  	else if (typeof define === "function" && define.amd) {
 10038  		// AMD
 10039  		define(["./core", "./cipher-core"], factory);
 10040  	}
 10041  	else {
 10042  		// Global (browser)
 10043  		factory(root.CryptoJS);
 10044  	}
 10045  }(this, function (CryptoJS) {
 10046  
 10047  	/**
 10048  	 * ANSI X.923 padding strategy.
 10049  	 */
 10050  	CryptoJS.pad.AnsiX923 = {
 10051  	    pad: function (data, blockSize) {
 10052  	        // Shortcuts
 10053  	        var dataSigBytes = data.sigBytes;
 10054  	        var blockSizeBytes = blockSize * 4;
 10055  
 10056  	        // Count padding bytes
 10057  	        var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
 10058  
 10059  	        // Compute last byte position
 10060  	        var lastBytePos = dataSigBytes + nPaddingBytes - 1;
 10061  
 10062  	        // Pad
 10063  	        data.clamp();
 10064  	        data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
 10065  	        data.sigBytes += nPaddingBytes;
 10066  	    },
 10067  
 10068  	    unpad: function (data) {
 10069  	        // Get number of padding bytes from last byte
 10070  	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
 10071  
 10072  	        // Remove padding
 10073  	        data.sigBytes -= nPaddingBytes;
 10074  	    }
 10075  	};
 10076  
 10077  
 10078  	return CryptoJS.pad.Ansix923;
 10079  
 10080  }));
 10081  },{"./cipher-core":52,"./core":53}],68:[function(require,module,exports){
 10082  ;(function (root, factory, undef) {
 10083  	if (typeof exports === "object") {
 10084  		// CommonJS
 10085  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
 10086  	}
 10087  	else if (typeof define === "function" && define.amd) {
 10088  		// AMD
 10089  		define(["./core", "./cipher-core"], factory);
 10090  	}
 10091  	else {
 10092  		// Global (browser)
 10093  		factory(root.CryptoJS);
 10094  	}
 10095  }(this, function (CryptoJS) {
 10096  
 10097  	/**
 10098  	 * ISO 10126 padding strategy.
 10099  	 */
 10100  	CryptoJS.pad.Iso10126 = {
 10101  	    pad: function (data, blockSize) {
 10102  	        // Shortcut
 10103  	        var blockSizeBytes = blockSize * 4;
 10104  
 10105  	        // Count padding bytes
 10106  	        var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
 10107  
 10108  	        // Pad
 10109  	        data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
 10110  	             concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
 10111  	    },
 10112  
 10113  	    unpad: function (data) {
 10114  	        // Get number of padding bytes from last byte
 10115  	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
 10116  
 10117  	        // Remove padding
 10118  	        data.sigBytes -= nPaddingBytes;
 10119  	    }
 10120  	};
 10121  
 10122  
 10123  	return CryptoJS.pad.Iso10126;
 10124  
 10125  }));
 10126  },{"./cipher-core":52,"./core":53}],69:[function(require,module,exports){
 10127  ;(function (root, factory, undef) {
 10128  	if (typeof exports === "object") {
 10129  		// CommonJS
 10130  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
 10131  	}
 10132  	else if (typeof define === "function" && define.amd) {
 10133  		// AMD
 10134  		define(["./core", "./cipher-core"], factory);
 10135  	}
 10136  	else {
 10137  		// Global (browser)
 10138  		factory(root.CryptoJS);
 10139  	}
 10140  }(this, function (CryptoJS) {
 10141  
 10142  	/**
 10143  	 * ISO/IEC 9797-1 Padding Method 2.
 10144  	 */
 10145  	CryptoJS.pad.Iso97971 = {
 10146  	    pad: function (data, blockSize) {
 10147  	        // Add 0x80 byte
 10148  	        data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
 10149  
 10150  	        // Zero pad the rest
 10151  	        CryptoJS.pad.ZeroPadding.pad(data, blockSize);
 10152  	    },
 10153  
 10154  	    unpad: function (data) {
 10155  	        // Remove zero padding
 10156  	        CryptoJS.pad.ZeroPadding.unpad(data);
 10157  
 10158  	        // Remove one more byte -- the 0x80 byte
 10159  	        data.sigBytes--;
 10160  	    }
 10161  	};
 10162  
 10163  
 10164  	return CryptoJS.pad.Iso97971;
 10165  
 10166  }));
 10167  },{"./cipher-core":52,"./core":53}],70:[function(require,module,exports){
 10168  ;(function (root, factory, undef) {
 10169  	if (typeof exports === "object") {
 10170  		// CommonJS
 10171  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
 10172  	}
 10173  	else if (typeof define === "function" && define.amd) {
 10174  		// AMD
 10175  		define(["./core", "./cipher-core"], factory);
 10176  	}
 10177  	else {
 10178  		// Global (browser)
 10179  		factory(root.CryptoJS);
 10180  	}
 10181  }(this, function (CryptoJS) {
 10182  
 10183  	/**
 10184  	 * A noop padding strategy.
 10185  	 */
 10186  	CryptoJS.pad.NoPadding = {
 10187  	    pad: function () {
 10188  	    },
 10189  
 10190  	    unpad: function () {
 10191  	    }
 10192  	};
 10193  
 10194  
 10195  	return CryptoJS.pad.NoPadding;
 10196  
 10197  }));
 10198  },{"./cipher-core":52,"./core":53}],71:[function(require,module,exports){
 10199  ;(function (root, factory, undef) {
 10200  	if (typeof exports === "object") {
 10201  		// CommonJS
 10202  		module.exports = exports = factory(require("./core"), require("./cipher-core"));
 10203  	}
 10204  	else if (typeof define === "function" && define.amd) {
 10205  		// AMD
 10206  		define(["./core", "./cipher-core"], factory);
 10207  	}
 10208  	else {
 10209  		// Global (browser)
 10210  		factory(root.CryptoJS);
 10211  	}
 10212  }(this, function (CryptoJS) {
 10213  
 10214  	/**
 10215  	 * Zero padding strategy.
 10216  	 */
 10217  	CryptoJS.pad.ZeroPadding = {
 10218  	    pad: function (data, blockSize) {
 10219  	        // Shortcut
 10220  	        var blockSizeBytes = blockSize * 4;
 10221  
 10222  	        // Pad
 10223  	        data.clamp();
 10224  	        data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
 10225  	    },
 10226  
 10227  	    unpad: function (data) {
 10228  	        // Shortcut
 10229  	        var dataWords = data.words;
 10230  
 10231  	        // Unpad
 10232  	        var i = data.sigBytes - 1;
 10233  	        while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
 10234  	            i--;
 10235  	        }
 10236  	        data.sigBytes = i + 1;
 10237  	    }
 10238  	};
 10239  
 10240  
 10241  	return CryptoJS.pad.ZeroPadding;
 10242  
 10243  }));
 10244  },{"./cipher-core":52,"./core":53}],72:[function(require,module,exports){
 10245  ;(function (root, factory, undef) {
 10246  	if (typeof exports === "object") {
 10247  		// CommonJS
 10248  		module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
 10249  	}
 10250  	else if (typeof define === "function" && define.amd) {
 10251  		// AMD
 10252  		define(["./core", "./sha1", "./hmac"], factory);
 10253  	}
 10254  	else {
 10255  		// Global (browser)
 10256  		factory(root.CryptoJS);
 10257  	}
 10258  }(this, function (CryptoJS) {
 10259  
 10260  	(function () {
 10261  	    // Shortcuts
 10262  	    var C = CryptoJS;
 10263  	    var C_lib = C.lib;
 10264  	    var Base = C_lib.Base;
 10265  	    var WordArray = C_lib.WordArray;
 10266  	    var C_algo = C.algo;
 10267  	    var SHA1 = C_algo.SHA1;
 10268  	    var HMAC = C_algo.HMAC;
 10269  
 10270  	    /**
 10271  	     * Password-Based Key Derivation Function 2 algorithm.
 10272  	     */
 10273  	    var PBKDF2 = C_algo.PBKDF2 = Base.extend({
 10274  	        /**
 10275  	         * Configuration options.
 10276  	         *
 10277  	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
 10278  	         * @property {Hasher} hasher The hasher to use. Default: SHA1
 10279  	         * @property {number} iterations The number of iterations to perform. Default: 1
 10280  	         */
 10281  	        cfg: Base.extend({
 10282  	            keySize: 128/32,
 10283  	            hasher: SHA1,
 10284  	            iterations: 1
 10285  	        }),
 10286  
 10287  	        /**
 10288  	         * Initializes a newly created key derivation function.
 10289  	         *
 10290  	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
 10291  	         *
 10292  	         * @example
 10293  	         *
 10294  	         *     var kdf = CryptoJS.algo.PBKDF2.create();
 10295  	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
 10296  	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
 10297  	         */
 10298  	        init: function (cfg) {
 10299  	            this.cfg = this.cfg.extend(cfg);
 10300  	        },
 10301  
 10302  	        /**
 10303  	         * Computes the Password-Based Key Derivation Function 2.
 10304  	         *
 10305  	         * @param {WordArray|string} password The password.
 10306  	         * @param {WordArray|string} salt A salt.
 10307  	         *
 10308  	         * @return {WordArray} The derived key.
 10309  	         *
 10310  	         * @example
 10311  	         *
 10312  	         *     var key = kdf.compute(password, salt);
 10313  	         */
 10314  	        compute: function (password, salt) {
 10315  	            // Shortcut
 10316  	            var cfg = this.cfg;
 10317  
 10318  	            // Init HMAC
 10319  	            var hmac = HMAC.create(cfg.hasher, password);
 10320  
 10321  	            // Initial values
 10322  	            var derivedKey = WordArray.create();
 10323  	            var blockIndex = WordArray.create([0x00000001]);
 10324  
 10325  	            // Shortcuts
 10326  	            var derivedKeyWords = derivedKey.words;
 10327  	            var blockIndexWords = blockIndex.words;
 10328  	            var keySize = cfg.keySize;
 10329  	            var iterations = cfg.iterations;
 10330  
 10331  	            // Generate key
 10332  	            while (derivedKeyWords.length < keySize) {
 10333  	                var block = hmac.update(salt).finalize(blockIndex);
 10334  	                hmac.reset();
 10335  
 10336  	                // Shortcuts
 10337  	                var blockWords = block.words;
 10338  	                var blockWordsLength = blockWords.length;
 10339  
 10340  	                // Iterations
 10341  	                var intermediate = block;
 10342  	                for (var i = 1; i < iterations; i++) {
 10343  	                    intermediate = hmac.finalize(intermediate);
 10344  	                    hmac.reset();
 10345  
 10346  	                    // Shortcut
 10347  	                    var intermediateWords = intermediate.words;
 10348  
 10349  	                    // XOR intermediate with block
 10350  	                    for (var j = 0; j < blockWordsLength; j++) {
 10351  	                        blockWords[j] ^= intermediateWords[j];
 10352  	                    }
 10353  	                }
 10354  
 10355  	                derivedKey.concat(block);
 10356  	                blockIndexWords[0]++;
 10357  	            }
 10358  	            derivedKey.sigBytes = keySize * 4;
 10359  
 10360  	            return derivedKey;
 10361  	        }
 10362  	    });
 10363  
 10364  	    /**
 10365  	     * Computes the Password-Based Key Derivation Function 2.
 10366  	     *
 10367  	     * @param {WordArray|string} password The password.
 10368  	     * @param {WordArray|string} salt A salt.
 10369  	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
 10370  	     *
 10371  	     * @return {WordArray} The derived key.
 10372  	     *
 10373  	     * @static
 10374  	     *
 10375  	     * @example
 10376  	     *
 10377  	     *     var key = CryptoJS.PBKDF2(password, salt);
 10378  	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
 10379  	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
 10380  	     */
 10381  	    C.PBKDF2 = function (password, salt, cfg) {
 10382  	        return PBKDF2.create(cfg).compute(password, salt);
 10383  	    };
 10384  	}());
 10385  
 10386  
 10387  	return CryptoJS.PBKDF2;
 10388  
 10389  }));
 10390  },{"./core":53,"./hmac":58,"./sha1":77}],73:[function(require,module,exports){
 10391  ;(function (root, factory, undef) {
 10392  	if (typeof exports === "object") {
 10393  		// CommonJS
 10394  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 10395  	}
 10396  	else if (typeof define === "function" && define.amd) {
 10397  		// AMD
 10398  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 10399  	}
 10400  	else {
 10401  		// Global (browser)
 10402  		factory(root.CryptoJS);
 10403  	}
 10404  }(this, function (CryptoJS) {
 10405  
 10406  	(function () {
 10407  	    // Shortcuts
 10408  	    var C = CryptoJS;
 10409  	    var C_lib = C.lib;
 10410  	    var StreamCipher = C_lib.StreamCipher;
 10411  	    var C_algo = C.algo;
 10412  
 10413  	    // Reusable objects
 10414  	    var S  = [];
 10415  	    var C_ = [];
 10416  	    var G  = [];
 10417  
 10418  	    /**
 10419  	     * Rabbit stream cipher algorithm.
 10420  	     *
 10421  	     * This is a legacy version that neglected to convert the key to little-endian.
 10422  	     * This error doesn't affect the cipher's security,
 10423  	     * but it does affect its compatibility with other implementations.
 10424  	     */
 10425  	    var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
 10426  	        _doReset: function () {
 10427  	            // Shortcuts
 10428  	            var K = this._key.words;
 10429  	            var iv = this.cfg.iv;
 10430  
 10431  	            // Generate initial state values
 10432  	            var X = this._X = [
 10433  	                K[0], (K[3] << 16) | (K[2] >>> 16),
 10434  	                K[1], (K[0] << 16) | (K[3] >>> 16),
 10435  	                K[2], (K[1] << 16) | (K[0] >>> 16),
 10436  	                K[3], (K[2] << 16) | (K[1] >>> 16)
 10437  	            ];
 10438  
 10439  	            // Generate initial counter values
 10440  	            var C = this._C = [
 10441  	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
 10442  	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
 10443  	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
 10444  	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
 10445  	            ];
 10446  
 10447  	            // Carry bit
 10448  	            this._b = 0;
 10449  
 10450  	            // Iterate the system four times
 10451  	            for (var i = 0; i < 4; i++) {
 10452  	                nextState.call(this);
 10453  	            }
 10454  
 10455  	            // Modify the counters
 10456  	            for (var i = 0; i < 8; i++) {
 10457  	                C[i] ^= X[(i + 4) & 7];
 10458  	            }
 10459  
 10460  	            // IV setup
 10461  	            if (iv) {
 10462  	                // Shortcuts
 10463  	                var IV = iv.words;
 10464  	                var IV_0 = IV[0];
 10465  	                var IV_1 = IV[1];
 10466  
 10467  	                // Generate four subvectors
 10468  	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
 10469  	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
 10470  	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
 10471  	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
 10472  
 10473  	                // Modify counter values
 10474  	                C[0] ^= i0;
 10475  	                C[1] ^= i1;
 10476  	                C[2] ^= i2;
 10477  	                C[3] ^= i3;
 10478  	                C[4] ^= i0;
 10479  	                C[5] ^= i1;
 10480  	                C[6] ^= i2;
 10481  	                C[7] ^= i3;
 10482  
 10483  	                // Iterate the system four times
 10484  	                for (var i = 0; i < 4; i++) {
 10485  	                    nextState.call(this);
 10486  	                }
 10487  	            }
 10488  	        },
 10489  
 10490  	        _doProcessBlock: function (M, offset) {
 10491  	            // Shortcut
 10492  	            var X = this._X;
 10493  
 10494  	            // Iterate the system
 10495  	            nextState.call(this);
 10496  
 10497  	            // Generate four keystream words
 10498  	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
 10499  	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
 10500  	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
 10501  	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
 10502  
 10503  	            for (var i = 0; i < 4; i++) {
 10504  	                // Swap endian
 10505  	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
 10506  	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
 10507  
 10508  	                // Encrypt
 10509  	                M[offset + i] ^= S[i];
 10510  	            }
 10511  	        },
 10512  
 10513  	        blockSize: 128/32,
 10514  
 10515  	        ivSize: 64/32
 10516  	    });
 10517  
 10518  	    function nextState() {
 10519  	        // Shortcuts
 10520  	        var X = this._X;
 10521  	        var C = this._C;
 10522  
 10523  	        // Save old counter values
 10524  	        for (var i = 0; i < 8; i++) {
 10525  	            C_[i] = C[i];
 10526  	        }
 10527  
 10528  	        // Calculate new counter values
 10529  	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
 10530  	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
 10531  	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
 10532  	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
 10533  	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
 10534  	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
 10535  	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
 10536  	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
 10537  	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
 10538  
 10539  	        // Calculate the g-values
 10540  	        for (var i = 0; i < 8; i++) {
 10541  	            var gx = X[i] + C[i];
 10542  
 10543  	            // Construct high and low argument for squaring
 10544  	            var ga = gx & 0xffff;
 10545  	            var gb = gx >>> 16;
 10546  
 10547  	            // Calculate high and low result of squaring
 10548  	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 10549  	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
 10550  
 10551  	            // High XOR low
 10552  	            G[i] = gh ^ gl;
 10553  	        }
 10554  
 10555  	        // Calculate new state values
 10556  	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
 10557  	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
 10558  	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
 10559  	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
 10560  	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
 10561  	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
 10562  	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
 10563  	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
 10564  	    }
 10565  
 10566  	    /**
 10567  	     * Shortcut functions to the cipher's object interface.
 10568  	     *
 10569  	     * @example
 10570  	     *
 10571  	     *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
 10572  	     *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
 10573  	     */
 10574  	    C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
 10575  	}());
 10576  
 10577  
 10578  	return CryptoJS.RabbitLegacy;
 10579  
 10580  }));
 10581  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],74:[function(require,module,exports){
 10582  ;(function (root, factory, undef) {
 10583  	if (typeof exports === "object") {
 10584  		// CommonJS
 10585  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 10586  	}
 10587  	else if (typeof define === "function" && define.amd) {
 10588  		// AMD
 10589  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 10590  	}
 10591  	else {
 10592  		// Global (browser)
 10593  		factory(root.CryptoJS);
 10594  	}
 10595  }(this, function (CryptoJS) {
 10596  
 10597  	(function () {
 10598  	    // Shortcuts
 10599  	    var C = CryptoJS;
 10600  	    var C_lib = C.lib;
 10601  	    var StreamCipher = C_lib.StreamCipher;
 10602  	    var C_algo = C.algo;
 10603  
 10604  	    // Reusable objects
 10605  	    var S  = [];
 10606  	    var C_ = [];
 10607  	    var G  = [];
 10608  
 10609  	    /**
 10610  	     * Rabbit stream cipher algorithm
 10611  	     */
 10612  	    var Rabbit = C_algo.Rabbit = StreamCipher.extend({
 10613  	        _doReset: function () {
 10614  	            // Shortcuts
 10615  	            var K = this._key.words;
 10616  	            var iv = this.cfg.iv;
 10617  
 10618  	            // Swap endian
 10619  	            for (var i = 0; i < 4; i++) {
 10620  	                K[i] = (((K[i] << 8)  | (K[i] >>> 24)) & 0x00ff00ff) |
 10621  	                       (((K[i] << 24) | (K[i] >>> 8))  & 0xff00ff00);
 10622  	            }
 10623  
 10624  	            // Generate initial state values
 10625  	            var X = this._X = [
 10626  	                K[0], (K[3] << 16) | (K[2] >>> 16),
 10627  	                K[1], (K[0] << 16) | (K[3] >>> 16),
 10628  	                K[2], (K[1] << 16) | (K[0] >>> 16),
 10629  	                K[3], (K[2] << 16) | (K[1] >>> 16)
 10630  	            ];
 10631  
 10632  	            // Generate initial counter values
 10633  	            var C = this._C = [
 10634  	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
 10635  	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
 10636  	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
 10637  	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
 10638  	            ];
 10639  
 10640  	            // Carry bit
 10641  	            this._b = 0;
 10642  
 10643  	            // Iterate the system four times
 10644  	            for (var i = 0; i < 4; i++) {
 10645  	                nextState.call(this);
 10646  	            }
 10647  
 10648  	            // Modify the counters
 10649  	            for (var i = 0; i < 8; i++) {
 10650  	                C[i] ^= X[(i + 4) & 7];
 10651  	            }
 10652  
 10653  	            // IV setup
 10654  	            if (iv) {
 10655  	                // Shortcuts
 10656  	                var IV = iv.words;
 10657  	                var IV_0 = IV[0];
 10658  	                var IV_1 = IV[1];
 10659  
 10660  	                // Generate four subvectors
 10661  	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
 10662  	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
 10663  	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
 10664  	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
 10665  
 10666  	                // Modify counter values
 10667  	                C[0] ^= i0;
 10668  	                C[1] ^= i1;
 10669  	                C[2] ^= i2;
 10670  	                C[3] ^= i3;
 10671  	                C[4] ^= i0;
 10672  	                C[5] ^= i1;
 10673  	                C[6] ^= i2;
 10674  	                C[7] ^= i3;
 10675  
 10676  	                // Iterate the system four times
 10677  	                for (var i = 0; i < 4; i++) {
 10678  	                    nextState.call(this);
 10679  	                }
 10680  	            }
 10681  	        },
 10682  
 10683  	        _doProcessBlock: function (M, offset) {
 10684  	            // Shortcut
 10685  	            var X = this._X;
 10686  
 10687  	            // Iterate the system
 10688  	            nextState.call(this);
 10689  
 10690  	            // Generate four keystream words
 10691  	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
 10692  	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
 10693  	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
 10694  	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
 10695  
 10696  	            for (var i = 0; i < 4; i++) {
 10697  	                // Swap endian
 10698  	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
 10699  	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
 10700  
 10701  	                // Encrypt
 10702  	                M[offset + i] ^= S[i];
 10703  	            }
 10704  	        },
 10705  
 10706  	        blockSize: 128/32,
 10707  
 10708  	        ivSize: 64/32
 10709  	    });
 10710  
 10711  	    function nextState() {
 10712  	        // Shortcuts
 10713  	        var X = this._X;
 10714  	        var C = this._C;
 10715  
 10716  	        // Save old counter values
 10717  	        for (var i = 0; i < 8; i++) {
 10718  	            C_[i] = C[i];
 10719  	        }
 10720  
 10721  	        // Calculate new counter values
 10722  	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
 10723  	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
 10724  	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
 10725  	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
 10726  	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
 10727  	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
 10728  	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
 10729  	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
 10730  	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
 10731  
 10732  	        // Calculate the g-values
 10733  	        for (var i = 0; i < 8; i++) {
 10734  	            var gx = X[i] + C[i];
 10735  
 10736  	            // Construct high and low argument for squaring
 10737  	            var ga = gx & 0xffff;
 10738  	            var gb = gx >>> 16;
 10739  
 10740  	            // Calculate high and low result of squaring
 10741  	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 10742  	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
 10743  
 10744  	            // High XOR low
 10745  	            G[i] = gh ^ gl;
 10746  	        }
 10747  
 10748  	        // Calculate new state values
 10749  	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
 10750  	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
 10751  	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
 10752  	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
 10753  	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
 10754  	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
 10755  	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
 10756  	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
 10757  	    }
 10758  
 10759  	    /**
 10760  	     * Shortcut functions to the cipher's object interface.
 10761  	     *
 10762  	     * @example
 10763  	     *
 10764  	     *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
 10765  	     *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
 10766  	     */
 10767  	    C.Rabbit = StreamCipher._createHelper(Rabbit);
 10768  	}());
 10769  
 10770  
 10771  	return CryptoJS.Rabbit;
 10772  
 10773  }));
 10774  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],75:[function(require,module,exports){
 10775  ;(function (root, factory, undef) {
 10776  	if (typeof exports === "object") {
 10777  		// CommonJS
 10778  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 10779  	}
 10780  	else if (typeof define === "function" && define.amd) {
 10781  		// AMD
 10782  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 10783  	}
 10784  	else {
 10785  		// Global (browser)
 10786  		factory(root.CryptoJS);
 10787  	}
 10788  }(this, function (CryptoJS) {
 10789  
 10790  	(function () {
 10791  	    // Shortcuts
 10792  	    var C = CryptoJS;
 10793  	    var C_lib = C.lib;
 10794  	    var StreamCipher = C_lib.StreamCipher;
 10795  	    var C_algo = C.algo;
 10796  
 10797  	    /**
 10798  	     * RC4 stream cipher algorithm.
 10799  	     */
 10800  	    var RC4 = C_algo.RC4 = StreamCipher.extend({
 10801  	        _doReset: function () {
 10802  	            // Shortcuts
 10803  	            var key = this._key;
 10804  	            var keyWords = key.words;
 10805  	            var keySigBytes = key.sigBytes;
 10806  
 10807  	            // Init sbox
 10808  	            var S = this._S = [];
 10809  	            for (var i = 0; i < 256; i++) {
 10810  	                S[i] = i;
 10811  	            }
 10812  
 10813  	            // Key setup
 10814  	            for (var i = 0, j = 0; i < 256; i++) {
 10815  	                var keyByteIndex = i % keySigBytes;
 10816  	                var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
 10817  
 10818  	                j = (j + S[i] + keyByte) % 256;
 10819  
 10820  	                // Swap
 10821  	                var t = S[i];
 10822  	                S[i] = S[j];
 10823  	                S[j] = t;
 10824  	            }
 10825  
 10826  	            // Counters
 10827  	            this._i = this._j = 0;
 10828  	        },
 10829  
 10830  	        _doProcessBlock: function (M, offset) {
 10831  	            M[offset] ^= generateKeystreamWord.call(this);
 10832  	        },
 10833  
 10834  	        keySize: 256/32,
 10835  
 10836  	        ivSize: 0
 10837  	    });
 10838  
 10839  	    function generateKeystreamWord() {
 10840  	        // Shortcuts
 10841  	        var S = this._S;
 10842  	        var i = this._i;
 10843  	        var j = this._j;
 10844  
 10845  	        // Generate keystream word
 10846  	        var keystreamWord = 0;
 10847  	        for (var n = 0; n < 4; n++) {
 10848  	            i = (i + 1) % 256;
 10849  	            j = (j + S[i]) % 256;
 10850  
 10851  	            // Swap
 10852  	            var t = S[i];
 10853  	            S[i] = S[j];
 10854  	            S[j] = t;
 10855  
 10856  	            keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
 10857  	        }
 10858  
 10859  	        // Update counters
 10860  	        this._i = i;
 10861  	        this._j = j;
 10862  
 10863  	        return keystreamWord;
 10864  	    }
 10865  
 10866  	    /**
 10867  	     * Shortcut functions to the cipher's object interface.
 10868  	     *
 10869  	     * @example
 10870  	     *
 10871  	     *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
 10872  	     *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
 10873  	     */
 10874  	    C.RC4 = StreamCipher._createHelper(RC4);
 10875  
 10876  	    /**
 10877  	     * Modified RC4 stream cipher algorithm.
 10878  	     */
 10879  	    var RC4Drop = C_algo.RC4Drop = RC4.extend({
 10880  	        /**
 10881  	         * Configuration options.
 10882  	         *
 10883  	         * @property {number} drop The number of keystream words to drop. Default 192
 10884  	         */
 10885  	        cfg: RC4.cfg.extend({
 10886  	            drop: 192
 10887  	        }),
 10888  
 10889  	        _doReset: function () {
 10890  	            RC4._doReset.call(this);
 10891  
 10892  	            // Drop
 10893  	            for (var i = this.cfg.drop; i > 0; i--) {
 10894  	                generateKeystreamWord.call(this);
 10895  	            }
 10896  	        }
 10897  	    });
 10898  
 10899  	    /**
 10900  	     * Shortcut functions to the cipher's object interface.
 10901  	     *
 10902  	     * @example
 10903  	     *
 10904  	     *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
 10905  	     *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
 10906  	     */
 10907  	    C.RC4Drop = StreamCipher._createHelper(RC4Drop);
 10908  	}());
 10909  
 10910  
 10911  	return CryptoJS.RC4;
 10912  
 10913  }));
 10914  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],76:[function(require,module,exports){
 10915  ;(function (root, factory) {
 10916  	if (typeof exports === "object") {
 10917  		// CommonJS
 10918  		module.exports = exports = factory(require("./core"));
 10919  	}
 10920  	else if (typeof define === "function" && define.amd) {
 10921  		// AMD
 10922  		define(["./core"], factory);
 10923  	}
 10924  	else {
 10925  		// Global (browser)
 10926  		factory(root.CryptoJS);
 10927  	}
 10928  }(this, function (CryptoJS) {
 10929  
 10930  	/** @preserve
 10931  	(c) 2012 by Cédric Mesnil. All rights reserved.
 10932  
 10933  	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 10934  
 10935  	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 10936  	    - 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.
 10937  
 10938  	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.
 10939  	*/
 10940  
 10941  	(function (Math) {
 10942  	    // Shortcuts
 10943  	    var C = CryptoJS;
 10944  	    var C_lib = C.lib;
 10945  	    var WordArray = C_lib.WordArray;
 10946  	    var Hasher = C_lib.Hasher;
 10947  	    var C_algo = C.algo;
 10948  
 10949  	    // Constants table
 10950  	    var _zl = WordArray.create([
 10951  	        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
 10952  	        7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
 10953  	        3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
 10954  	        1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
 10955  	        4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13]);
 10956  	    var _zr = WordArray.create([
 10957  	        5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
 10958  	        6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
 10959  	        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
 10960  	        8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
 10961  	        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11]);
 10962  	    var _sl = WordArray.create([
 10963  	         11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
 10964  	        7, 6,   8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
 10965  	        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
 10966  	          11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
 10967  	        9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 ]);
 10968  	    var _sr = WordArray.create([
 10969  	        8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
 10970  	        9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
 10971  	        9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
 10972  	        15,  5,  8, 11, 14, 14,  6, 14,  6,  9, 12,  9, 12,  5, 15,  8,
 10973  	        8,  5, 12,  9, 12,  5, 14,  6,  8, 13,  6,  5, 15, 13, 11, 11 ]);
 10974  
 10975  	    var _hl =  WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
 10976  	    var _hr =  WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
 10977  
 10978  	    /**
 10979  	     * RIPEMD160 hash algorithm.
 10980  	     */
 10981  	    var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
 10982  	        _doReset: function () {
 10983  	            this._hash  = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
 10984  	        },
 10985  
 10986  	        _doProcessBlock: function (M, offset) {
 10987  
 10988  	            // Swap endian
 10989  	            for (var i = 0; i < 16; i++) {
 10990  	                // Shortcuts
 10991  	                var offset_i = offset + i;
 10992  	                var M_offset_i = M[offset_i];
 10993  
 10994  	                // Swap
 10995  	                M[offset_i] = (
 10996  	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
 10997  	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
 10998  	                );
 10999  	            }
 11000  	            // Shortcut
 11001  	            var H  = this._hash.words;
 11002  	            var hl = _hl.words;
 11003  	            var hr = _hr.words;
 11004  	            var zl = _zl.words;
 11005  	            var zr = _zr.words;
 11006  	            var sl = _sl.words;
 11007  	            var sr = _sr.words;
 11008  
 11009  	            // Working variables
 11010  	            var al, bl, cl, dl, el;
 11011  	            var ar, br, cr, dr, er;
 11012  
 11013  	            ar = al = H[0];
 11014  	            br = bl = H[1];
 11015  	            cr = cl = H[2];
 11016  	            dr = dl = H[3];
 11017  	            er = el = H[4];
 11018  	            // Computation
 11019  	            var t;
 11020  	            for (var i = 0; i < 80; i += 1) {
 11021  	                t = (al +  M[offset+zl[i]])|0;
 11022  	                if (i<16){
 11023  		            t +=  f1(bl,cl,dl) + hl[0];
 11024  	                } else if (i<32) {
 11025  		            t +=  f2(bl,cl,dl) + hl[1];
 11026  	                } else if (i<48) {
 11027  		            t +=  f3(bl,cl,dl) + hl[2];
 11028  	                } else if (i<64) {
 11029  		            t +=  f4(bl,cl,dl) + hl[3];
 11030  	                } else {// if (i<80) {
 11031  		            t +=  f5(bl,cl,dl) + hl[4];
 11032  	                }
 11033  	                t = t|0;
 11034  	                t =  rotl(t,sl[i]);
 11035  	                t = (t+el)|0;
 11036  	                al = el;
 11037  	                el = dl;
 11038  	                dl = rotl(cl, 10);
 11039  	                cl = bl;
 11040  	                bl = t;
 11041  
 11042  	                t = (ar + M[offset+zr[i]])|0;
 11043  	                if (i<16){
 11044  		            t +=  f5(br,cr,dr) + hr[0];
 11045  	                } else if (i<32) {
 11046  		            t +=  f4(br,cr,dr) + hr[1];
 11047  	                } else if (i<48) {
 11048  		            t +=  f3(br,cr,dr) + hr[2];
 11049  	                } else if (i<64) {
 11050  		            t +=  f2(br,cr,dr) + hr[3];
 11051  	                } else {// if (i<80) {
 11052  		            t +=  f1(br,cr,dr) + hr[4];
 11053  	                }
 11054  	                t = t|0;
 11055  	                t =  rotl(t,sr[i]) ;
 11056  	                t = (t+er)|0;
 11057  	                ar = er;
 11058  	                er = dr;
 11059  	                dr = rotl(cr, 10);
 11060  	                cr = br;
 11061  	                br = t;
 11062  	            }
 11063  	            // Intermediate hash value
 11064  	            t    = (H[1] + cl + dr)|0;
 11065  	            H[1] = (H[2] + dl + er)|0;
 11066  	            H[2] = (H[3] + el + ar)|0;
 11067  	            H[3] = (H[4] + al + br)|0;
 11068  	            H[4] = (H[0] + bl + cr)|0;
 11069  	            H[0] =  t;
 11070  	        },
 11071  
 11072  	        _doFinalize: function () {
 11073  	            // Shortcuts
 11074  	            var data = this._data;
 11075  	            var dataWords = data.words;
 11076  
 11077  	            var nBitsTotal = this._nDataBytes * 8;
 11078  	            var nBitsLeft = data.sigBytes * 8;
 11079  
 11080  	            // Add padding
 11081  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 11082  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
 11083  	                (((nBitsTotal << 8)  | (nBitsTotal >>> 24)) & 0x00ff00ff) |
 11084  	                (((nBitsTotal << 24) | (nBitsTotal >>> 8))  & 0xff00ff00)
 11085  	            );
 11086  	            data.sigBytes = (dataWords.length + 1) * 4;
 11087  
 11088  	            // Hash final blocks
 11089  	            this._process();
 11090  
 11091  	            // Shortcuts
 11092  	            var hash = this._hash;
 11093  	            var H = hash.words;
 11094  
 11095  	            // Swap endian
 11096  	            for (var i = 0; i < 5; i++) {
 11097  	                // Shortcut
 11098  	                var H_i = H[i];
 11099  
 11100  	                // Swap
 11101  	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
 11102  	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
 11103  	            }
 11104  
 11105  	            // Return final computed hash
 11106  	            return hash;
 11107  	        },
 11108  
 11109  	        clone: function () {
 11110  	            var clone = Hasher.clone.call(this);
 11111  	            clone._hash = this._hash.clone();
 11112  
 11113  	            return clone;
 11114  	        }
 11115  	    });
 11116  
 11117  
 11118  	    function f1(x, y, z) {
 11119  	        return ((x) ^ (y) ^ (z));
 11120  
 11121  	    }
 11122  
 11123  	    function f2(x, y, z) {
 11124  	        return (((x)&(y)) | ((~x)&(z)));
 11125  	    }
 11126  
 11127  	    function f3(x, y, z) {
 11128  	        return (((x) | (~(y))) ^ (z));
 11129  	    }
 11130  
 11131  	    function f4(x, y, z) {
 11132  	        return (((x) & (z)) | ((y)&(~(z))));
 11133  	    }
 11134  
 11135  	    function f5(x, y, z) {
 11136  	        return ((x) ^ ((y) |(~(z))));
 11137  
 11138  	    }
 11139  
 11140  	    function rotl(x,n) {
 11141  	        return (x<<n) | (x>>>(32-n));
 11142  	    }
 11143  
 11144  
 11145  	    /**
 11146  	     * Shortcut function to the hasher's object interface.
 11147  	     *
 11148  	     * @param {WordArray|string} message The message to hash.
 11149  	     *
 11150  	     * @return {WordArray} The hash.
 11151  	     *
 11152  	     * @static
 11153  	     *
 11154  	     * @example
 11155  	     *
 11156  	     *     var hash = CryptoJS.RIPEMD160('message');
 11157  	     *     var hash = CryptoJS.RIPEMD160(wordArray);
 11158  	     */
 11159  	    C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
 11160  
 11161  	    /**
 11162  	     * Shortcut function to the HMAC's object interface.
 11163  	     *
 11164  	     * @param {WordArray|string} message The message to hash.
 11165  	     * @param {WordArray|string} key The secret key.
 11166  	     *
 11167  	     * @return {WordArray} The HMAC.
 11168  	     *
 11169  	     * @static
 11170  	     *
 11171  	     * @example
 11172  	     *
 11173  	     *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
 11174  	     */
 11175  	    C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
 11176  	}(Math));
 11177  
 11178  
 11179  	return CryptoJS.RIPEMD160;
 11180  
 11181  }));
 11182  },{"./core":53}],77:[function(require,module,exports){
 11183  ;(function (root, factory) {
 11184  	if (typeof exports === "object") {
 11185  		// CommonJS
 11186  		module.exports = exports = factory(require("./core"));
 11187  	}
 11188  	else if (typeof define === "function" && define.amd) {
 11189  		// AMD
 11190  		define(["./core"], factory);
 11191  	}
 11192  	else {
 11193  		// Global (browser)
 11194  		factory(root.CryptoJS);
 11195  	}
 11196  }(this, function (CryptoJS) {
 11197  
 11198  	(function () {
 11199  	    // Shortcuts
 11200  	    var C = CryptoJS;
 11201  	    var C_lib = C.lib;
 11202  	    var WordArray = C_lib.WordArray;
 11203  	    var Hasher = C_lib.Hasher;
 11204  	    var C_algo = C.algo;
 11205  
 11206  	    // Reusable object
 11207  	    var W = [];
 11208  
 11209  	    /**
 11210  	     * SHA-1 hash algorithm.
 11211  	     */
 11212  	    var SHA1 = C_algo.SHA1 = Hasher.extend({
 11213  	        _doReset: function () {
 11214  	            this._hash = new WordArray.init([
 11215  	                0x67452301, 0xefcdab89,
 11216  	                0x98badcfe, 0x10325476,
 11217  	                0xc3d2e1f0
 11218  	            ]);
 11219  	        },
 11220  
 11221  	        _doProcessBlock: function (M, offset) {
 11222  	            // Shortcut
 11223  	            var H = this._hash.words;
 11224  
 11225  	            // Working variables
 11226  	            var a = H[0];
 11227  	            var b = H[1];
 11228  	            var c = H[2];
 11229  	            var d = H[3];
 11230  	            var e = H[4];
 11231  
 11232  	            // Computation
 11233  	            for (var i = 0; i < 80; i++) {
 11234  	                if (i < 16) {
 11235  	                    W[i] = M[offset + i] | 0;
 11236  	                } else {
 11237  	                    var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
 11238  	                    W[i] = (n << 1) | (n >>> 31);
 11239  	                }
 11240  
 11241  	                var t = ((a << 5) | (a >>> 27)) + e + W[i];
 11242  	                if (i < 20) {
 11243  	                    t += ((b & c) | (~b & d)) + 0x5a827999;
 11244  	                } else if (i < 40) {
 11245  	                    t += (b ^ c ^ d) + 0x6ed9eba1;
 11246  	                } else if (i < 60) {
 11247  	                    t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
 11248  	                } else /* if (i < 80) */ {
 11249  	                    t += (b ^ c ^ d) - 0x359d3e2a;
 11250  	                }
 11251  
 11252  	                e = d;
 11253  	                d = c;
 11254  	                c = (b << 30) | (b >>> 2);
 11255  	                b = a;
 11256  	                a = t;
 11257  	            }
 11258  
 11259  	            // Intermediate hash value
 11260  	            H[0] = (H[0] + a) | 0;
 11261  	            H[1] = (H[1] + b) | 0;
 11262  	            H[2] = (H[2] + c) | 0;
 11263  	            H[3] = (H[3] + d) | 0;
 11264  	            H[4] = (H[4] + e) | 0;
 11265  	        },
 11266  
 11267  	        _doFinalize: function () {
 11268  	            // Shortcuts
 11269  	            var data = this._data;
 11270  	            var dataWords = data.words;
 11271  
 11272  	            var nBitsTotal = this._nDataBytes * 8;
 11273  	            var nBitsLeft = data.sigBytes * 8;
 11274  
 11275  	            // Add padding
 11276  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 11277  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
 11278  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 11279  	            data.sigBytes = dataWords.length * 4;
 11280  
 11281  	            // Hash final blocks
 11282  	            this._process();
 11283  
 11284  	            // Return final computed hash
 11285  	            return this._hash;
 11286  	        },
 11287  
 11288  	        clone: function () {
 11289  	            var clone = Hasher.clone.call(this);
 11290  	            clone._hash = this._hash.clone();
 11291  
 11292  	            return clone;
 11293  	        }
 11294  	    });
 11295  
 11296  	    /**
 11297  	     * Shortcut function to the hasher's object interface.
 11298  	     *
 11299  	     * @param {WordArray|string} message The message to hash.
 11300  	     *
 11301  	     * @return {WordArray} The hash.
 11302  	     *
 11303  	     * @static
 11304  	     *
 11305  	     * @example
 11306  	     *
 11307  	     *     var hash = CryptoJS.SHA1('message');
 11308  	     *     var hash = CryptoJS.SHA1(wordArray);
 11309  	     */
 11310  	    C.SHA1 = Hasher._createHelper(SHA1);
 11311  
 11312  	    /**
 11313  	     * Shortcut function to the HMAC's object interface.
 11314  	     *
 11315  	     * @param {WordArray|string} message The message to hash.
 11316  	     * @param {WordArray|string} key The secret key.
 11317  	     *
 11318  	     * @return {WordArray} The HMAC.
 11319  	     *
 11320  	     * @static
 11321  	     *
 11322  	     * @example
 11323  	     *
 11324  	     *     var hmac = CryptoJS.HmacSHA1(message, key);
 11325  	     */
 11326  	    C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
 11327  	}());
 11328  
 11329  
 11330  	return CryptoJS.SHA1;
 11331  
 11332  }));
 11333  },{"./core":53}],78:[function(require,module,exports){
 11334  ;(function (root, factory, undef) {
 11335  	if (typeof exports === "object") {
 11336  		// CommonJS
 11337  		module.exports = exports = factory(require("./core"), require("./sha256"));
 11338  	}
 11339  	else if (typeof define === "function" && define.amd) {
 11340  		// AMD
 11341  		define(["./core", "./sha256"], factory);
 11342  	}
 11343  	else {
 11344  		// Global (browser)
 11345  		factory(root.CryptoJS);
 11346  	}
 11347  }(this, function (CryptoJS) {
 11348  
 11349  	(function () {
 11350  	    // Shortcuts
 11351  	    var C = CryptoJS;
 11352  	    var C_lib = C.lib;
 11353  	    var WordArray = C_lib.WordArray;
 11354  	    var C_algo = C.algo;
 11355  	    var SHA256 = C_algo.SHA256;
 11356  
 11357  	    /**
 11358  	     * SHA-224 hash algorithm.
 11359  	     */
 11360  	    var SHA224 = C_algo.SHA224 = SHA256.extend({
 11361  	        _doReset: function () {
 11362  	            this._hash = new WordArray.init([
 11363  	                0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
 11364  	                0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
 11365  	            ]);
 11366  	        },
 11367  
 11368  	        _doFinalize: function () {
 11369  	            var hash = SHA256._doFinalize.call(this);
 11370  
 11371  	            hash.sigBytes -= 4;
 11372  
 11373  	            return hash;
 11374  	        }
 11375  	    });
 11376  
 11377  	    /**
 11378  	     * Shortcut function to the hasher's object interface.
 11379  	     *
 11380  	     * @param {WordArray|string} message The message to hash.
 11381  	     *
 11382  	     * @return {WordArray} The hash.
 11383  	     *
 11384  	     * @static
 11385  	     *
 11386  	     * @example
 11387  	     *
 11388  	     *     var hash = CryptoJS.SHA224('message');
 11389  	     *     var hash = CryptoJS.SHA224(wordArray);
 11390  	     */
 11391  	    C.SHA224 = SHA256._createHelper(SHA224);
 11392  
 11393  	    /**
 11394  	     * Shortcut function to the HMAC's object interface.
 11395  	     *
 11396  	     * @param {WordArray|string} message The message to hash.
 11397  	     * @param {WordArray|string} key The secret key.
 11398  	     *
 11399  	     * @return {WordArray} The HMAC.
 11400  	     *
 11401  	     * @static
 11402  	     *
 11403  	     * @example
 11404  	     *
 11405  	     *     var hmac = CryptoJS.HmacSHA224(message, key);
 11406  	     */
 11407  	    C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
 11408  	}());
 11409  
 11410  
 11411  	return CryptoJS.SHA224;
 11412  
 11413  }));
 11414  },{"./core":53,"./sha256":79}],79:[function(require,module,exports){
 11415  ;(function (root, factory) {
 11416  	if (typeof exports === "object") {
 11417  		// CommonJS
 11418  		module.exports = exports = factory(require("./core"));
 11419  	}
 11420  	else if (typeof define === "function" && define.amd) {
 11421  		// AMD
 11422  		define(["./core"], factory);
 11423  	}
 11424  	else {
 11425  		// Global (browser)
 11426  		factory(root.CryptoJS);
 11427  	}
 11428  }(this, function (CryptoJS) {
 11429  
 11430  	(function (Math) {
 11431  	    // Shortcuts
 11432  	    var C = CryptoJS;
 11433  	    var C_lib = C.lib;
 11434  	    var WordArray = C_lib.WordArray;
 11435  	    var Hasher = C_lib.Hasher;
 11436  	    var C_algo = C.algo;
 11437  
 11438  	    // Initialization and round constants tables
 11439  	    var H = [];
 11440  	    var K = [];
 11441  
 11442  	    // Compute constants
 11443  	    (function () {
 11444  	        function isPrime(n) {
 11445  	            var sqrtN = Math.sqrt(n);
 11446  	            for (var factor = 2; factor <= sqrtN; factor++) {
 11447  	                if (!(n % factor)) {
 11448  	                    return false;
 11449  	                }
 11450  	            }
 11451  
 11452  	            return true;
 11453  	        }
 11454  
 11455  	        function getFractionalBits(n) {
 11456  	            return ((n - (n | 0)) * 0x100000000) | 0;
 11457  	        }
 11458  
 11459  	        var n = 2;
 11460  	        var nPrime = 0;
 11461  	        while (nPrime < 64) {
 11462  	            if (isPrime(n)) {
 11463  	                if (nPrime < 8) {
 11464  	                    H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
 11465  	                }
 11466  	                K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
 11467  
 11468  	                nPrime++;
 11469  	            }
 11470  
 11471  	            n++;
 11472  	        }
 11473  	    }());
 11474  
 11475  	    // Reusable object
 11476  	    var W = [];
 11477  
 11478  	    /**
 11479  	     * SHA-256 hash algorithm.
 11480  	     */
 11481  	    var SHA256 = C_algo.SHA256 = Hasher.extend({
 11482  	        _doReset: function () {
 11483  	            this._hash = new WordArray.init(H.slice(0));
 11484  	        },
 11485  
 11486  	        _doProcessBlock: function (M, offset) {
 11487  	            // Shortcut
 11488  	            var H = this._hash.words;
 11489  
 11490  	            // Working variables
 11491  	            var a = H[0];
 11492  	            var b = H[1];
 11493  	            var c = H[2];
 11494  	            var d = H[3];
 11495  	            var e = H[4];
 11496  	            var f = H[5];
 11497  	            var g = H[6];
 11498  	            var h = H[7];
 11499  
 11500  	            // Computation
 11501  	            for (var i = 0; i < 64; i++) {
 11502  	                if (i < 16) {
 11503  	                    W[i] = M[offset + i] | 0;
 11504  	                } else {
 11505  	                    var gamma0x = W[i - 15];
 11506  	                    var gamma0  = ((gamma0x << 25) | (gamma0x >>> 7))  ^
 11507  	                                  ((gamma0x << 14) | (gamma0x >>> 18)) ^
 11508  	                                   (gamma0x >>> 3);
 11509  
 11510  	                    var gamma1x = W[i - 2];
 11511  	                    var gamma1  = ((gamma1x << 15) | (gamma1x >>> 17)) ^
 11512  	                                  ((gamma1x << 13) | (gamma1x >>> 19)) ^
 11513  	                                   (gamma1x >>> 10);
 11514  
 11515  	                    W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
 11516  	                }
 11517  
 11518  	                var ch  = (e & f) ^ (~e & g);
 11519  	                var maj = (a & b) ^ (a & c) ^ (b & c);
 11520  
 11521  	                var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
 11522  	                var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7)  | (e >>> 25));
 11523  
 11524  	                var t1 = h + sigma1 + ch + K[i] + W[i];
 11525  	                var t2 = sigma0 + maj;
 11526  
 11527  	                h = g;
 11528  	                g = f;
 11529  	                f = e;
 11530  	                e = (d + t1) | 0;
 11531  	                d = c;
 11532  	                c = b;
 11533  	                b = a;
 11534  	                a = (t1 + t2) | 0;
 11535  	            }
 11536  
 11537  	            // Intermediate hash value
 11538  	            H[0] = (H[0] + a) | 0;
 11539  	            H[1] = (H[1] + b) | 0;
 11540  	            H[2] = (H[2] + c) | 0;
 11541  	            H[3] = (H[3] + d) | 0;
 11542  	            H[4] = (H[4] + e) | 0;
 11543  	            H[5] = (H[5] + f) | 0;
 11544  	            H[6] = (H[6] + g) | 0;
 11545  	            H[7] = (H[7] + h) | 0;
 11546  	        },
 11547  
 11548  	        _doFinalize: function () {
 11549  	            // Shortcuts
 11550  	            var data = this._data;
 11551  	            var dataWords = data.words;
 11552  
 11553  	            var nBitsTotal = this._nDataBytes * 8;
 11554  	            var nBitsLeft = data.sigBytes * 8;
 11555  
 11556  	            // Add padding
 11557  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 11558  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
 11559  	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 11560  	            data.sigBytes = dataWords.length * 4;
 11561  
 11562  	            // Hash final blocks
 11563  	            this._process();
 11564  
 11565  	            // Return final computed hash
 11566  	            return this._hash;
 11567  	        },
 11568  
 11569  	        clone: function () {
 11570  	            var clone = Hasher.clone.call(this);
 11571  	            clone._hash = this._hash.clone();
 11572  
 11573  	            return clone;
 11574  	        }
 11575  	    });
 11576  
 11577  	    /**
 11578  	     * Shortcut function to the hasher's object interface.
 11579  	     *
 11580  	     * @param {WordArray|string} message The message to hash.
 11581  	     *
 11582  	     * @return {WordArray} The hash.
 11583  	     *
 11584  	     * @static
 11585  	     *
 11586  	     * @example
 11587  	     *
 11588  	     *     var hash = CryptoJS.SHA256('message');
 11589  	     *     var hash = CryptoJS.SHA256(wordArray);
 11590  	     */
 11591  	    C.SHA256 = Hasher._createHelper(SHA256);
 11592  
 11593  	    /**
 11594  	     * Shortcut function to the HMAC's object interface.
 11595  	     *
 11596  	     * @param {WordArray|string} message The message to hash.
 11597  	     * @param {WordArray|string} key The secret key.
 11598  	     *
 11599  	     * @return {WordArray} The HMAC.
 11600  	     *
 11601  	     * @static
 11602  	     *
 11603  	     * @example
 11604  	     *
 11605  	     *     var hmac = CryptoJS.HmacSHA256(message, key);
 11606  	     */
 11607  	    C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
 11608  	}(Math));
 11609  
 11610  
 11611  	return CryptoJS.SHA256;
 11612  
 11613  }));
 11614  },{"./core":53}],80:[function(require,module,exports){
 11615  ;(function (root, factory, undef) {
 11616  	if (typeof exports === "object") {
 11617  		// CommonJS
 11618  		module.exports = exports = factory(require("./core"), require("./x64-core"));
 11619  	}
 11620  	else if (typeof define === "function" && define.amd) {
 11621  		// AMD
 11622  		define(["./core", "./x64-core"], factory);
 11623  	}
 11624  	else {
 11625  		// Global (browser)
 11626  		factory(root.CryptoJS);
 11627  	}
 11628  }(this, function (CryptoJS) {
 11629  
 11630  	(function (Math) {
 11631  	    // Shortcuts
 11632  	    var C = CryptoJS;
 11633  	    var C_lib = C.lib;
 11634  	    var WordArray = C_lib.WordArray;
 11635  	    var Hasher = C_lib.Hasher;
 11636  	    var C_x64 = C.x64;
 11637  	    var X64Word = C_x64.Word;
 11638  	    var C_algo = C.algo;
 11639  
 11640  	    // Constants tables
 11641  	    var RHO_OFFSETS = [];
 11642  	    var PI_INDEXES  = [];
 11643  	    var ROUND_CONSTANTS = [];
 11644  
 11645  	    // Compute Constants
 11646  	    (function () {
 11647  	        // Compute rho offset constants
 11648  	        var x = 1, y = 0;
 11649  	        for (var t = 0; t < 24; t++) {
 11650  	            RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
 11651  
 11652  	            var newX = y % 5;
 11653  	            var newY = (2 * x + 3 * y) % 5;
 11654  	            x = newX;
 11655  	            y = newY;
 11656  	        }
 11657  
 11658  	        // Compute pi index constants
 11659  	        for (var x = 0; x < 5; x++) {
 11660  	            for (var y = 0; y < 5; y++) {
 11661  	                PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
 11662  	            }
 11663  	        }
 11664  
 11665  	        // Compute round constants
 11666  	        var LFSR = 0x01;
 11667  	        for (var i = 0; i < 24; i++) {
 11668  	            var roundConstantMsw = 0;
 11669  	            var roundConstantLsw = 0;
 11670  
 11671  	            for (var j = 0; j < 7; j++) {
 11672  	                if (LFSR & 0x01) {
 11673  	                    var bitPosition = (1 << j) - 1;
 11674  	                    if (bitPosition < 32) {
 11675  	                        roundConstantLsw ^= 1 << bitPosition;
 11676  	                    } else /* if (bitPosition >= 32) */ {
 11677  	                        roundConstantMsw ^= 1 << (bitPosition - 32);
 11678  	                    }
 11679  	                }
 11680  
 11681  	                // Compute next LFSR
 11682  	                if (LFSR & 0x80) {
 11683  	                    // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
 11684  	                    LFSR = (LFSR << 1) ^ 0x71;
 11685  	                } else {
 11686  	                    LFSR <<= 1;
 11687  	                }
 11688  	            }
 11689  
 11690  	            ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
 11691  	        }
 11692  	    }());
 11693  
 11694  	    // Reusable objects for temporary values
 11695  	    var T = [];
 11696  	    (function () {
 11697  	        for (var i = 0; i < 25; i++) {
 11698  	            T[i] = X64Word.create();
 11699  	        }
 11700  	    }());
 11701  
 11702  	    /**
 11703  	     * SHA-3 hash algorithm.
 11704  	     */
 11705  	    var SHA3 = C_algo.SHA3 = Hasher.extend({
 11706  	        /**
 11707  	         * Configuration options.
 11708  	         *
 11709  	         * @property {number} outputLength
 11710  	         *   The desired number of bits in the output hash.
 11711  	         *   Only values permitted are: 224, 256, 384, 512.
 11712  	         *   Default: 512
 11713  	         */
 11714  	        cfg: Hasher.cfg.extend({
 11715  	            outputLength: 512
 11716  	        }),
 11717  
 11718  	        _doReset: function () {
 11719  	            var state = this._state = []
 11720  	            for (var i = 0; i < 25; i++) {
 11721  	                state[i] = new X64Word.init();
 11722  	            }
 11723  
 11724  	            this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
 11725  	        },
 11726  
 11727  	        _doProcessBlock: function (M, offset) {
 11728  	            // Shortcuts
 11729  	            var state = this._state;
 11730  	            var nBlockSizeLanes = this.blockSize / 2;
 11731  
 11732  	            // Absorb
 11733  	            for (var i = 0; i < nBlockSizeLanes; i++) {
 11734  	                // Shortcuts
 11735  	                var M2i  = M[offset + 2 * i];
 11736  	                var M2i1 = M[offset + 2 * i + 1];
 11737  
 11738  	                // Swap endian
 11739  	                M2i = (
 11740  	                    (((M2i << 8)  | (M2i >>> 24)) & 0x00ff00ff) |
 11741  	                    (((M2i << 24) | (M2i >>> 8))  & 0xff00ff00)
 11742  	                );
 11743  	                M2i1 = (
 11744  	                    (((M2i1 << 8)  | (M2i1 >>> 24)) & 0x00ff00ff) |
 11745  	                    (((M2i1 << 24) | (M2i1 >>> 8))  & 0xff00ff00)
 11746  	                );
 11747  
 11748  	                // Absorb message into state
 11749  	                var lane = state[i];
 11750  	                lane.high ^= M2i1;
 11751  	                lane.low  ^= M2i;
 11752  	            }
 11753  
 11754  	            // Rounds
 11755  	            for (var round = 0; round < 24; round++) {
 11756  	                // Theta
 11757  	                for (var x = 0; x < 5; x++) {
 11758  	                    // Mix column lanes
 11759  	                    var tMsw = 0, tLsw = 0;
 11760  	                    for (var y = 0; y < 5; y++) {
 11761  	                        var lane = state[x + 5 * y];
 11762  	                        tMsw ^= lane.high;
 11763  	                        tLsw ^= lane.low;
 11764  	                    }
 11765  
 11766  	                    // Temporary values
 11767  	                    var Tx = T[x];
 11768  	                    Tx.high = tMsw;
 11769  	                    Tx.low  = tLsw;
 11770  	                }
 11771  	                for (var x = 0; x < 5; x++) {
 11772  	                    // Shortcuts
 11773  	                    var Tx4 = T[(x + 4) % 5];
 11774  	                    var Tx1 = T[(x + 1) % 5];
 11775  	                    var Tx1Msw = Tx1.high;
 11776  	                    var Tx1Lsw = Tx1.low;
 11777  
 11778  	                    // Mix surrounding columns
 11779  	                    var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
 11780  	                    var tLsw = Tx4.low  ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
 11781  	                    for (var y = 0; y < 5; y++) {
 11782  	                        var lane = state[x + 5 * y];
 11783  	                        lane.high ^= tMsw;
 11784  	                        lane.low  ^= tLsw;
 11785  	                    }
 11786  	                }
 11787  
 11788  	                // Rho Pi
 11789  	                for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
 11790  	                    // Shortcuts
 11791  	                    var lane = state[laneIndex];
 11792  	                    var laneMsw = lane.high;
 11793  	                    var laneLsw = lane.low;
 11794  	                    var rhoOffset = RHO_OFFSETS[laneIndex];
 11795  
 11796  	                    // Rotate lanes
 11797  	                    if (rhoOffset < 32) {
 11798  	                        var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
 11799  	                        var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
 11800  	                    } else /* if (rhoOffset >= 32) */ {
 11801  	                        var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
 11802  	                        var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
 11803  	                    }
 11804  
 11805  	                    // Transpose lanes
 11806  	                    var TPiLane = T[PI_INDEXES[laneIndex]];
 11807  	                    TPiLane.high = tMsw;
 11808  	                    TPiLane.low  = tLsw;
 11809  	                }
 11810  
 11811  	                // Rho pi at x = y = 0
 11812  	                var T0 = T[0];
 11813  	                var state0 = state[0];
 11814  	                T0.high = state0.high;
 11815  	                T0.low  = state0.low;
 11816  
 11817  	                // Chi
 11818  	                for (var x = 0; x < 5; x++) {
 11819  	                    for (var y = 0; y < 5; y++) {
 11820  	                        // Shortcuts
 11821  	                        var laneIndex = x + 5 * y;
 11822  	                        var lane = state[laneIndex];
 11823  	                        var TLane = T[laneIndex];
 11824  	                        var Tx1Lane = T[((x + 1) % 5) + 5 * y];
 11825  	                        var Tx2Lane = T[((x + 2) % 5) + 5 * y];
 11826  
 11827  	                        // Mix rows
 11828  	                        lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
 11829  	                        lane.low  = TLane.low  ^ (~Tx1Lane.low  & Tx2Lane.low);
 11830  	                    }
 11831  	                }
 11832  
 11833  	                // Iota
 11834  	                var lane = state[0];
 11835  	                var roundConstant = ROUND_CONSTANTS[round];
 11836  	                lane.high ^= roundConstant.high;
 11837  	                lane.low  ^= roundConstant.low;;
 11838  	            }
 11839  	        },
 11840  
 11841  	        _doFinalize: function () {
 11842  	            // Shortcuts
 11843  	            var data = this._data;
 11844  	            var dataWords = data.words;
 11845  	            var nBitsTotal = this._nDataBytes * 8;
 11846  	            var nBitsLeft = data.sigBytes * 8;
 11847  	            var blockSizeBits = this.blockSize * 32;
 11848  
 11849  	            // Add padding
 11850  	            dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
 11851  	            dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
 11852  	            data.sigBytes = dataWords.length * 4;
 11853  
 11854  	            // Hash final blocks
 11855  	            this._process();
 11856  
 11857  	            // Shortcuts
 11858  	            var state = this._state;
 11859  	            var outputLengthBytes = this.cfg.outputLength / 8;
 11860  	            var outputLengthLanes = outputLengthBytes / 8;
 11861  
 11862  	            // Squeeze
 11863  	            var hashWords = [];
 11864  	            for (var i = 0; i < outputLengthLanes; i++) {
 11865  	                // Shortcuts
 11866  	                var lane = state[i];
 11867  	                var laneMsw = lane.high;
 11868  	                var laneLsw = lane.low;
 11869  
 11870  	                // Swap endian
 11871  	                laneMsw = (
 11872  	                    (((laneMsw << 8)  | (laneMsw >>> 24)) & 0x00ff00ff) |
 11873  	                    (((laneMsw << 24) | (laneMsw >>> 8))  & 0xff00ff00)
 11874  	                );
 11875  	                laneLsw = (
 11876  	                    (((laneLsw << 8)  | (laneLsw >>> 24)) & 0x00ff00ff) |
 11877  	                    (((laneLsw << 24) | (laneLsw >>> 8))  & 0xff00ff00)
 11878  	                );
 11879  
 11880  	                // Squeeze state to retrieve hash
 11881  	                hashWords.push(laneLsw);
 11882  	                hashWords.push(laneMsw);
 11883  	            }
 11884  
 11885  	            // Return final computed hash
 11886  	            return new WordArray.init(hashWords, outputLengthBytes);
 11887  	        },
 11888  
 11889  	        clone: function () {
 11890  	            var clone = Hasher.clone.call(this);
 11891  
 11892  	            var state = clone._state = this._state.slice(0);
 11893  	            for (var i = 0; i < 25; i++) {
 11894  	                state[i] = state[i].clone();
 11895  	            }
 11896  
 11897  	            return clone;
 11898  	        }
 11899  	    });
 11900  
 11901  	    /**
 11902  	     * Shortcut function to the hasher's object interface.
 11903  	     *
 11904  	     * @param {WordArray|string} message The message to hash.
 11905  	     *
 11906  	     * @return {WordArray} The hash.
 11907  	     *
 11908  	     * @static
 11909  	     *
 11910  	     * @example
 11911  	     *
 11912  	     *     var hash = CryptoJS.SHA3('message');
 11913  	     *     var hash = CryptoJS.SHA3(wordArray);
 11914  	     */
 11915  	    C.SHA3 = Hasher._createHelper(SHA3);
 11916  
 11917  	    /**
 11918  	     * Shortcut function to the HMAC's object interface.
 11919  	     *
 11920  	     * @param {WordArray|string} message The message to hash.
 11921  	     * @param {WordArray|string} key The secret key.
 11922  	     *
 11923  	     * @return {WordArray} The HMAC.
 11924  	     *
 11925  	     * @static
 11926  	     *
 11927  	     * @example
 11928  	     *
 11929  	     *     var hmac = CryptoJS.HmacSHA3(message, key);
 11930  	     */
 11931  	    C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
 11932  	}(Math));
 11933  
 11934  
 11935  	return CryptoJS.SHA3;
 11936  
 11937  }));
 11938  },{"./core":53,"./x64-core":84}],81:[function(require,module,exports){
 11939  ;(function (root, factory, undef) {
 11940  	if (typeof exports === "object") {
 11941  		// CommonJS
 11942  		module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
 11943  	}
 11944  	else if (typeof define === "function" && define.amd) {
 11945  		// AMD
 11946  		define(["./core", "./x64-core", "./sha512"], factory);
 11947  	}
 11948  	else {
 11949  		// Global (browser)
 11950  		factory(root.CryptoJS);
 11951  	}
 11952  }(this, function (CryptoJS) {
 11953  
 11954  	(function () {
 11955  	    // Shortcuts
 11956  	    var C = CryptoJS;
 11957  	    var C_x64 = C.x64;
 11958  	    var X64Word = C_x64.Word;
 11959  	    var X64WordArray = C_x64.WordArray;
 11960  	    var C_algo = C.algo;
 11961  	    var SHA512 = C_algo.SHA512;
 11962  
 11963  	    /**
 11964  	     * SHA-384 hash algorithm.
 11965  	     */
 11966  	    var SHA384 = C_algo.SHA384 = SHA512.extend({
 11967  	        _doReset: function () {
 11968  	            this._hash = new X64WordArray.init([
 11969  	                new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
 11970  	                new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
 11971  	                new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
 11972  	                new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
 11973  	            ]);
 11974  	        },
 11975  
 11976  	        _doFinalize: function () {
 11977  	            var hash = SHA512._doFinalize.call(this);
 11978  
 11979  	            hash.sigBytes -= 16;
 11980  
 11981  	            return hash;
 11982  	        }
 11983  	    });
 11984  
 11985  	    /**
 11986  	     * Shortcut function to the hasher's object interface.
 11987  	     *
 11988  	     * @param {WordArray|string} message The message to hash.
 11989  	     *
 11990  	     * @return {WordArray} The hash.
 11991  	     *
 11992  	     * @static
 11993  	     *
 11994  	     * @example
 11995  	     *
 11996  	     *     var hash = CryptoJS.SHA384('message');
 11997  	     *     var hash = CryptoJS.SHA384(wordArray);
 11998  	     */
 11999  	    C.SHA384 = SHA512._createHelper(SHA384);
 12000  
 12001  	    /**
 12002  	     * Shortcut function to the HMAC's object interface.
 12003  	     *
 12004  	     * @param {WordArray|string} message The message to hash.
 12005  	     * @param {WordArray|string} key The secret key.
 12006  	     *
 12007  	     * @return {WordArray} The HMAC.
 12008  	     *
 12009  	     * @static
 12010  	     *
 12011  	     * @example
 12012  	     *
 12013  	     *     var hmac = CryptoJS.HmacSHA384(message, key);
 12014  	     */
 12015  	    C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
 12016  	}());
 12017  
 12018  
 12019  	return CryptoJS.SHA384;
 12020  
 12021  }));
 12022  },{"./core":53,"./sha512":82,"./x64-core":84}],82:[function(require,module,exports){
 12023  ;(function (root, factory, undef) {
 12024  	if (typeof exports === "object") {
 12025  		// CommonJS
 12026  		module.exports = exports = factory(require("./core"), require("./x64-core"));
 12027  	}
 12028  	else if (typeof define === "function" && define.amd) {
 12029  		// AMD
 12030  		define(["./core", "./x64-core"], factory);
 12031  	}
 12032  	else {
 12033  		// Global (browser)
 12034  		factory(root.CryptoJS);
 12035  	}
 12036  }(this, function (CryptoJS) {
 12037  
 12038  	(function () {
 12039  	    // Shortcuts
 12040  	    var C = CryptoJS;
 12041  	    var C_lib = C.lib;
 12042  	    var Hasher = C_lib.Hasher;
 12043  	    var C_x64 = C.x64;
 12044  	    var X64Word = C_x64.Word;
 12045  	    var X64WordArray = C_x64.WordArray;
 12046  	    var C_algo = C.algo;
 12047  
 12048  	    function X64Word_create() {
 12049  	        return X64Word.create.apply(X64Word, arguments);
 12050  	    }
 12051  
 12052  	    // Constants
 12053  	    var K = [
 12054  	        X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
 12055  	        X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
 12056  	        X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
 12057  	        X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
 12058  	        X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
 12059  	        X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
 12060  	        X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
 12061  	        X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
 12062  	        X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
 12063  	        X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
 12064  	        X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
 12065  	        X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
 12066  	        X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
 12067  	        X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
 12068  	        X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
 12069  	        X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
 12070  	        X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
 12071  	        X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
 12072  	        X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
 12073  	        X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
 12074  	        X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
 12075  	        X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
 12076  	        X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
 12077  	        X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
 12078  	        X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
 12079  	        X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
 12080  	        X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
 12081  	        X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
 12082  	        X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
 12083  	        X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
 12084  	        X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
 12085  	        X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
 12086  	        X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
 12087  	        X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
 12088  	        X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
 12089  	        X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
 12090  	        X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
 12091  	        X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
 12092  	        X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
 12093  	        X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
 12094  	    ];
 12095  
 12096  	    // Reusable objects
 12097  	    var W = [];
 12098  	    (function () {
 12099  	        for (var i = 0; i < 80; i++) {
 12100  	            W[i] = X64Word_create();
 12101  	        }
 12102  	    }());
 12103  
 12104  	    /**
 12105  	     * SHA-512 hash algorithm.
 12106  	     */
 12107  	    var SHA512 = C_algo.SHA512 = Hasher.extend({
 12108  	        _doReset: function () {
 12109  	            this._hash = new X64WordArray.init([
 12110  	                new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
 12111  	                new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
 12112  	                new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
 12113  	                new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
 12114  	            ]);
 12115  	        },
 12116  
 12117  	        _doProcessBlock: function (M, offset) {
 12118  	            // Shortcuts
 12119  	            var H = this._hash.words;
 12120  
 12121  	            var H0 = H[0];
 12122  	            var H1 = H[1];
 12123  	            var H2 = H[2];
 12124  	            var H3 = H[3];
 12125  	            var H4 = H[4];
 12126  	            var H5 = H[5];
 12127  	            var H6 = H[6];
 12128  	            var H7 = H[7];
 12129  
 12130  	            var H0h = H0.high;
 12131  	            var H0l = H0.low;
 12132  	            var H1h = H1.high;
 12133  	            var H1l = H1.low;
 12134  	            var H2h = H2.high;
 12135  	            var H2l = H2.low;
 12136  	            var H3h = H3.high;
 12137  	            var H3l = H3.low;
 12138  	            var H4h = H4.high;
 12139  	            var H4l = H4.low;
 12140  	            var H5h = H5.high;
 12141  	            var H5l = H5.low;
 12142  	            var H6h = H6.high;
 12143  	            var H6l = H6.low;
 12144  	            var H7h = H7.high;
 12145  	            var H7l = H7.low;
 12146  
 12147  	            // Working variables
 12148  	            var ah = H0h;
 12149  	            var al = H0l;
 12150  	            var bh = H1h;
 12151  	            var bl = H1l;
 12152  	            var ch = H2h;
 12153  	            var cl = H2l;
 12154  	            var dh = H3h;
 12155  	            var dl = H3l;
 12156  	            var eh = H4h;
 12157  	            var el = H4l;
 12158  	            var fh = H5h;
 12159  	            var fl = H5l;
 12160  	            var gh = H6h;
 12161  	            var gl = H6l;
 12162  	            var hh = H7h;
 12163  	            var hl = H7l;
 12164  
 12165  	            // Rounds
 12166  	            for (var i = 0; i < 80; i++) {
 12167  	                // Shortcut
 12168  	                var Wi = W[i];
 12169  
 12170  	                // Extend message
 12171  	                if (i < 16) {
 12172  	                    var Wih = Wi.high = M[offset + i * 2]     | 0;
 12173  	                    var Wil = Wi.low  = M[offset + i * 2 + 1] | 0;
 12174  	                } else {
 12175  	                    // Gamma0
 12176  	                    var gamma0x  = W[i - 15];
 12177  	                    var gamma0xh = gamma0x.high;
 12178  	                    var gamma0xl = gamma0x.low;
 12179  	                    var gamma0h  = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
 12180  	                    var gamma0l  = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
 12181  
 12182  	                    // Gamma1
 12183  	                    var gamma1x  = W[i - 2];
 12184  	                    var gamma1xh = gamma1x.high;
 12185  	                    var gamma1xl = gamma1x.low;
 12186  	                    var gamma1h  = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
 12187  	                    var gamma1l  = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
 12188  
 12189  	                    // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
 12190  	                    var Wi7  = W[i - 7];
 12191  	                    var Wi7h = Wi7.high;
 12192  	                    var Wi7l = Wi7.low;
 12193  
 12194  	                    var Wi16  = W[i - 16];
 12195  	                    var Wi16h = Wi16.high;
 12196  	                    var Wi16l = Wi16.low;
 12197  
 12198  	                    var Wil = gamma0l + Wi7l;
 12199  	                    var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
 12200  	                    var Wil = Wil + gamma1l;
 12201  	                    var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
 12202  	                    var Wil = Wil + Wi16l;
 12203  	                    var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
 12204  
 12205  	                    Wi.high = Wih;
 12206  	                    Wi.low  = Wil;
 12207  	                }
 12208  
 12209  	                var chh  = (eh & fh) ^ (~eh & gh);
 12210  	                var chl  = (el & fl) ^ (~el & gl);
 12211  	                var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
 12212  	                var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
 12213  
 12214  	                var sigma0h = ((ah >>> 28) | (al << 4))  ^ ((ah << 30)  | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
 12215  	                var sigma0l = ((al >>> 28) | (ah << 4))  ^ ((al << 30)  | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
 12216  	                var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
 12217  	                var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
 12218  
 12219  	                // t1 = h + sigma1 + ch + K[i] + W[i]
 12220  	                var Ki  = K[i];
 12221  	                var Kih = Ki.high;
 12222  	                var Kil = Ki.low;
 12223  
 12224  	                var t1l = hl + sigma1l;
 12225  	                var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
 12226  	                var t1l = t1l + chl;
 12227  	                var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
 12228  	                var t1l = t1l + Kil;
 12229  	                var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
 12230  	                var t1l = t1l + Wil;
 12231  	                var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
 12232  
 12233  	                // t2 = sigma0 + maj
 12234  	                var t2l = sigma0l + majl;
 12235  	                var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
 12236  
 12237  	                // Update working variables
 12238  	                hh = gh;
 12239  	                hl = gl;
 12240  	                gh = fh;
 12241  	                gl = fl;
 12242  	                fh = eh;
 12243  	                fl = el;
 12244  	                el = (dl + t1l) | 0;
 12245  	                eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
 12246  	                dh = ch;
 12247  	                dl = cl;
 12248  	                ch = bh;
 12249  	                cl = bl;
 12250  	                bh = ah;
 12251  	                bl = al;
 12252  	                al = (t1l + t2l) | 0;
 12253  	                ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
 12254  	            }
 12255  
 12256  	            // Intermediate hash value
 12257  	            H0l = H0.low  = (H0l + al);
 12258  	            H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
 12259  	            H1l = H1.low  = (H1l + bl);
 12260  	            H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
 12261  	            H2l = H2.low  = (H2l + cl);
 12262  	            H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
 12263  	            H3l = H3.low  = (H3l + dl);
 12264  	            H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
 12265  	            H4l = H4.low  = (H4l + el);
 12266  	            H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
 12267  	            H5l = H5.low  = (H5l + fl);
 12268  	            H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
 12269  	            H6l = H6.low  = (H6l + gl);
 12270  	            H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
 12271  	            H7l = H7.low  = (H7l + hl);
 12272  	            H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
 12273  	        },
 12274  
 12275  	        _doFinalize: function () {
 12276  	            // Shortcuts
 12277  	            var data = this._data;
 12278  	            var dataWords = data.words;
 12279  
 12280  	            var nBitsTotal = this._nDataBytes * 8;
 12281  	            var nBitsLeft = data.sigBytes * 8;
 12282  
 12283  	            // Add padding
 12284  	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
 12285  	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
 12286  	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
 12287  	            data.sigBytes = dataWords.length * 4;
 12288  
 12289  	            // Hash final blocks
 12290  	            this._process();
 12291  
 12292  	            // Convert hash to 32-bit word array before returning
 12293  	            var hash = this._hash.toX32();
 12294  
 12295  	            // Return final computed hash
 12296  	            return hash;
 12297  	        },
 12298  
 12299  	        clone: function () {
 12300  	            var clone = Hasher.clone.call(this);
 12301  	            clone._hash = this._hash.clone();
 12302  
 12303  	            return clone;
 12304  	        },
 12305  
 12306  	        blockSize: 1024/32
 12307  	    });
 12308  
 12309  	    /**
 12310  	     * Shortcut function to the hasher's object interface.
 12311  	     *
 12312  	     * @param {WordArray|string} message The message to hash.
 12313  	     *
 12314  	     * @return {WordArray} The hash.
 12315  	     *
 12316  	     * @static
 12317  	     *
 12318  	     * @example
 12319  	     *
 12320  	     *     var hash = CryptoJS.SHA512('message');
 12321  	     *     var hash = CryptoJS.SHA512(wordArray);
 12322  	     */
 12323  	    C.SHA512 = Hasher._createHelper(SHA512);
 12324  
 12325  	    /**
 12326  	     * Shortcut function to the HMAC's object interface.
 12327  	     *
 12328  	     * @param {WordArray|string} message The message to hash.
 12329  	     * @param {WordArray|string} key The secret key.
 12330  	     *
 12331  	     * @return {WordArray} The HMAC.
 12332  	     *
 12333  	     * @static
 12334  	     *
 12335  	     * @example
 12336  	     *
 12337  	     *     var hmac = CryptoJS.HmacSHA512(message, key);
 12338  	     */
 12339  	    C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
 12340  	}());
 12341  
 12342  
 12343  	return CryptoJS.SHA512;
 12344  
 12345  }));
 12346  },{"./core":53,"./x64-core":84}],83:[function(require,module,exports){
 12347  ;(function (root, factory, undef) {
 12348  	if (typeof exports === "object") {
 12349  		// CommonJS
 12350  		module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
 12351  	}
 12352  	else if (typeof define === "function" && define.amd) {
 12353  		// AMD
 12354  		define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
 12355  	}
 12356  	else {
 12357  		// Global (browser)
 12358  		factory(root.CryptoJS);
 12359  	}
 12360  }(this, function (CryptoJS) {
 12361  
 12362  	(function () {
 12363  	    // Shortcuts
 12364  	    var C = CryptoJS;
 12365  	    var C_lib = C.lib;
 12366  	    var WordArray = C_lib.WordArray;
 12367  	    var BlockCipher = C_lib.BlockCipher;
 12368  	    var C_algo = C.algo;
 12369  
 12370  	    // Permuted Choice 1 constants
 12371  	    var PC1 = [
 12372  	        57, 49, 41, 33, 25, 17, 9,  1,
 12373  	        58, 50, 42, 34, 26, 18, 10, 2,
 12374  	        59, 51, 43, 35, 27, 19, 11, 3,
 12375  	        60, 52, 44, 36, 63, 55, 47, 39,
 12376  	        31, 23, 15, 7,  62, 54, 46, 38,
 12377  	        30, 22, 14, 6,  61, 53, 45, 37,
 12378  	        29, 21, 13, 5,  28, 20, 12, 4
 12379  	    ];
 12380  
 12381  	    // Permuted Choice 2 constants
 12382  	    var PC2 = [
 12383  	        14, 17, 11, 24, 1,  5,
 12384  	        3,  28, 15, 6,  21, 10,
 12385  	        23, 19, 12, 4,  26, 8,
 12386  	        16, 7,  27, 20, 13, 2,
 12387  	        41, 52, 31, 37, 47, 55,
 12388  	        30, 40, 51, 45, 33, 48,
 12389  	        44, 49, 39, 56, 34, 53,
 12390  	        46, 42, 50, 36, 29, 32
 12391  	    ];
 12392  
 12393  	    // Cumulative bit shift constants
 12394  	    var BIT_SHIFTS = [1,  2,  4,  6,  8,  10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
 12395  
 12396  	    // SBOXes and round permutation constants
 12397  	    var SBOX_P = [
 12398  	        {
 12399  	            0x0: 0x808200,
 12400  	            0x10000000: 0x8000,
 12401  	            0x20000000: 0x808002,
 12402  	            0x30000000: 0x2,
 12403  	            0x40000000: 0x200,
 12404  	            0x50000000: 0x808202,
 12405  	            0x60000000: 0x800202,
 12406  	            0x70000000: 0x800000,
 12407  	            0x80000000: 0x202,
 12408  	            0x90000000: 0x800200,
 12409  	            0xa0000000: 0x8200,
 12410  	            0xb0000000: 0x808000,
 12411  	            0xc0000000: 0x8002,
 12412  	            0xd0000000: 0x800002,
 12413  	            0xe0000000: 0x0,
 12414  	            0xf0000000: 0x8202,
 12415  	            0x8000000: 0x0,
 12416  	            0x18000000: 0x808202,
 12417  	            0x28000000: 0x8202,
 12418  	            0x38000000: 0x8000,
 12419  	            0x48000000: 0x808200,
 12420  	            0x58000000: 0x200,
 12421  	            0x68000000: 0x808002,
 12422  	            0x78000000: 0x2,
 12423  	            0x88000000: 0x800200,
 12424  	            0x98000000: 0x8200,
 12425  	            0xa8000000: 0x808000,
 12426  	            0xb8000000: 0x800202,
 12427  	            0xc8000000: 0x800002,
 12428  	            0xd8000000: 0x8002,
 12429  	            0xe8000000: 0x202,
 12430  	            0xf8000000: 0x800000,
 12431  	            0x1: 0x8000,
 12432  	            0x10000001: 0x2,
 12433  	            0x20000001: 0x808200,
 12434  	            0x30000001: 0x800000,
 12435  	            0x40000001: 0x808002,
 12436  	            0x50000001: 0x8200,
 12437  	            0x60000001: 0x200,
 12438  	            0x70000001: 0x800202,
 12439  	            0x80000001: 0x808202,
 12440  	            0x90000001: 0x808000,
 12441  	            0xa0000001: 0x800002,
 12442  	            0xb0000001: 0x8202,
 12443  	            0xc0000001: 0x202,
 12444  	            0xd0000001: 0x800200,
 12445  	            0xe0000001: 0x8002,
 12446  	            0xf0000001: 0x0,
 12447  	            0x8000001: 0x808202,
 12448  	            0x18000001: 0x808000,
 12449  	            0x28000001: 0x800000,
 12450  	            0x38000001: 0x200,
 12451  	            0x48000001: 0x8000,
 12452  	            0x58000001: 0x800002,
 12453  	            0x68000001: 0x2,
 12454  	            0x78000001: 0x8202,
 12455  	            0x88000001: 0x8002,
 12456  	            0x98000001: 0x800202,
 12457  	            0xa8000001: 0x202,
 12458  	            0xb8000001: 0x808200,
 12459  	            0xc8000001: 0x800200,
 12460  	            0xd8000001: 0x0,
 12461  	            0xe8000001: 0x8200,
 12462  	            0xf8000001: 0x808002
 12463  	        },
 12464  	        {
 12465  	            0x0: 0x40084010,
 12466  	            0x1000000: 0x4000,
 12467  	            0x2000000: 0x80000,
 12468  	            0x3000000: 0x40080010,
 12469  	            0x4000000: 0x40000010,
 12470  	            0x5000000: 0x40084000,
 12471  	            0x6000000: 0x40004000,
 12472  	            0x7000000: 0x10,
 12473  	            0x8000000: 0x84000,
 12474  	            0x9000000: 0x40004010,
 12475  	            0xa000000: 0x40000000,
 12476  	            0xb000000: 0x84010,
 12477  	            0xc000000: 0x80010,
 12478  	            0xd000000: 0x0,
 12479  	            0xe000000: 0x4010,
 12480  	            0xf000000: 0x40080000,
 12481  	            0x800000: 0x40004000,
 12482  	            0x1800000: 0x84010,
 12483  	            0x2800000: 0x10,
 12484  	            0x3800000: 0x40004010,
 12485  	            0x4800000: 0x40084010,
 12486  	            0x5800000: 0x40000000,
 12487  	            0x6800000: 0x80000,
 12488  	            0x7800000: 0x40080010,
 12489  	            0x8800000: 0x80010,
 12490  	            0x9800000: 0x0,
 12491  	            0xa800000: 0x4000,
 12492  	            0xb800000: 0x40080000,
 12493  	            0xc800000: 0x40000010,
 12494  	            0xd800000: 0x84000,
 12495  	            0xe800000: 0x40084000,
 12496  	            0xf800000: 0x4010,
 12497  	            0x10000000: 0x0,
 12498  	            0x11000000: 0x40080010,
 12499  	            0x12000000: 0x40004010,
 12500  	            0x13000000: 0x40084000,
 12501  	            0x14000000: 0x40080000,
 12502  	            0x15000000: 0x10,
 12503  	            0x16000000: 0x84010,
 12504  	            0x17000000: 0x4000,
 12505  	            0x18000000: 0x4010,
 12506  	            0x19000000: 0x80000,
 12507  	            0x1a000000: 0x80010,
 12508  	            0x1b000000: 0x40000010,
 12509  	            0x1c000000: 0x84000,
 12510  	            0x1d000000: 0x40004000,
 12511  	            0x1e000000: 0x40000000,
 12512  	            0x1f000000: 0x40084010,
 12513  	            0x10800000: 0x84010,
 12514  	            0x11800000: 0x80000,
 12515  	            0x12800000: 0x40080000,
 12516  	            0x13800000: 0x4000,
 12517  	            0x14800000: 0x40004000,
 12518  	            0x15800000: 0x40084010,
 12519  	            0x16800000: 0x10,
 12520  	            0x17800000: 0x40000000,
 12521  	            0x18800000: 0x40084000,
 12522  	            0x19800000: 0x40000010,
 12523  	            0x1a800000: 0x40004010,
 12524  	            0x1b800000: 0x80010,
 12525  	            0x1c800000: 0x0,
 12526  	            0x1d800000: 0x4010,
 12527  	            0x1e800000: 0x40080010,
 12528  	            0x1f800000: 0x84000
 12529  	        },
 12530  	        {
 12531  	            0x0: 0x104,
 12532  	            0x100000: 0x0,
 12533  	            0x200000: 0x4000100,
 12534  	            0x300000: 0x10104,
 12535  	            0x400000: 0x10004,
 12536  	            0x500000: 0x4000004,
 12537  	            0x600000: 0x4010104,
 12538  	            0x700000: 0x4010000,
 12539  	            0x800000: 0x4000000,
 12540  	            0x900000: 0x4010100,
 12541  	            0xa00000: 0x10100,
 12542  	            0xb00000: 0x4010004,
 12543  	            0xc00000: 0x4000104,
 12544  	            0xd00000: 0x10000,
 12545  	            0xe00000: 0x4,
 12546  	            0xf00000: 0x100,
 12547  	            0x80000: 0x4010100,
 12548  	            0x180000: 0x4010004,
 12549  	            0x280000: 0x0,
 12550  	            0x380000: 0x4000100,
 12551  	            0x480000: 0x4000004,
 12552  	            0x580000: 0x10000,
 12553  	            0x680000: 0x10004,
 12554  	            0x780000: 0x104,
 12555  	            0x880000: 0x4,
 12556  	            0x980000: 0x100,
 12557  	            0xa80000: 0x4010000,
 12558  	            0xb80000: 0x10104,
 12559  	            0xc80000: 0x10100,
 12560  	            0xd80000: 0x4000104,
 12561  	            0xe80000: 0x4010104,
 12562  	            0xf80000: 0x4000000,
 12563  	            0x1000000: 0x4010100,
 12564  	            0x1100000: 0x10004,
 12565  	            0x1200000: 0x10000,
 12566  	            0x1300000: 0x4000100,
 12567  	            0x1400000: 0x100,
 12568  	            0x1500000: 0x4010104,
 12569  	            0x1600000: 0x4000004,
 12570  	            0x1700000: 0x0,
 12571  	            0x1800000: 0x4000104,
 12572  	            0x1900000: 0x4000000,
 12573  	            0x1a00000: 0x4,
 12574  	            0x1b00000: 0x10100,
 12575  	            0x1c00000: 0x4010000,
 12576  	            0x1d00000: 0x104,
 12577  	            0x1e00000: 0x10104,
 12578  	            0x1f00000: 0x4010004,
 12579  	            0x1080000: 0x4000000,
 12580  	            0x1180000: 0x104,
 12581  	            0x1280000: 0x4010100,
 12582  	            0x1380000: 0x0,
 12583  	            0x1480000: 0x10004,
 12584  	            0x1580000: 0x4000100,
 12585  	            0x1680000: 0x100,
 12586  	            0x1780000: 0x4010004,
 12587  	            0x1880000: 0x10000,
 12588  	            0x1980000: 0x4010104,
 12589  	            0x1a80000: 0x10104,
 12590  	            0x1b80000: 0x4000004,
 12591  	            0x1c80000: 0x4000104,
 12592  	            0x1d80000: 0x4010000,
 12593  	            0x1e80000: 0x4,
 12594  	            0x1f80000: 0x10100
 12595  	        },
 12596  	        {
 12597  	            0x0: 0x80401000,
 12598  	            0x10000: 0x80001040,
 12599  	            0x20000: 0x401040,
 12600  	            0x30000: 0x80400000,
 12601  	            0x40000: 0x0,
 12602  	            0x50000: 0x401000,
 12603  	            0x60000: 0x80000040,
 12604  	            0x70000: 0x400040,
 12605  	            0x80000: 0x80000000,
 12606  	            0x90000: 0x400000,
 12607  	            0xa0000: 0x40,
 12608  	            0xb0000: 0x80001000,
 12609  	            0xc0000: 0x80400040,
 12610  	            0xd0000: 0x1040,
 12611  	            0xe0000: 0x1000,
 12612  	            0xf0000: 0x80401040,
 12613  	            0x8000: 0x80001040,
 12614  	            0x18000: 0x40,
 12615  	            0x28000: 0x80400040,
 12616  	            0x38000: 0x80001000,
 12617  	            0x48000: 0x401000,
 12618  	            0x58000: 0x80401040,
 12619  	            0x68000: 0x0,
 12620  	            0x78000: 0x80400000,
 12621  	            0x88000: 0x1000,
 12622  	            0x98000: 0x80401000,
 12623  	            0xa8000: 0x400000,
 12624  	            0xb8000: 0x1040,
 12625  	            0xc8000: 0x80000000,
 12626  	            0xd8000: 0x400040,
 12627  	            0xe8000: 0x401040,
 12628  	            0xf8000: 0x80000040,
 12629  	            0x100000: 0x400040,
 12630  	            0x110000: 0x401000,
 12631  	            0x120000: 0x80000040,
 12632  	            0x130000: 0x0,
 12633  	            0x140000: 0x1040,
 12634  	            0x150000: 0x80400040,
 12635  	            0x160000: 0x80401000,
 12636  	            0x170000: 0x80001040,
 12637  	            0x180000: 0x80401040,
 12638  	            0x190000: 0x80000000,
 12639  	            0x1a0000: 0x80400000,
 12640  	            0x1b0000: 0x401040,
 12641  	            0x1c0000: 0x80001000,
 12642  	            0x1d0000: 0x400000,
 12643  	            0x1e0000: 0x40,
 12644  	            0x1f0000: 0x1000,
 12645  	            0x108000: 0x80400000,
 12646  	            0x118000: 0x80401040,
 12647  	            0x128000: 0x0,
 12648  	            0x138000: 0x401000,
 12649  	            0x148000: 0x400040,
 12650  	            0x158000: 0x80000000,
 12651  	            0x168000: 0x80001040,
 12652  	            0x178000: 0x40,
 12653  	            0x188000: 0x80000040,
 12654  	            0x198000: 0x1000,
 12655  	            0x1a8000: 0x80001000,
 12656  	            0x1b8000: 0x80400040,
 12657  	            0x1c8000: 0x1040,
 12658  	            0x1d8000: 0x80401000,
 12659  	            0x1e8000: 0x400000,
 12660  	            0x1f8000: 0x401040
 12661  	        },
 12662  	        {
 12663  	            0x0: 0x80,
 12664  	            0x1000: 0x1040000,
 12665  	            0x2000: 0x40000,
 12666  	            0x3000: 0x20000000,
 12667  	            0x4000: 0x20040080,
 12668  	            0x5000: 0x1000080,
 12669  	            0x6000: 0x21000080,
 12670  	            0x7000: 0x40080,
 12671  	            0x8000: 0x1000000,
 12672  	            0x9000: 0x20040000,
 12673  	            0xa000: 0x20000080,
 12674  	            0xb000: 0x21040080,
 12675  	            0xc000: 0x21040000,
 12676  	            0xd000: 0x0,
 12677  	            0xe000: 0x1040080,
 12678  	            0xf000: 0x21000000,
 12679  	            0x800: 0x1040080,
 12680  	            0x1800: 0x21000080,
 12681  	            0x2800: 0x80,
 12682  	            0x3800: 0x1040000,
 12683  	            0x4800: 0x40000,
 12684  	            0x5800: 0x20040080,
 12685  	            0x6800: 0x21040000,
 12686  	            0x7800: 0x20000000,
 12687  	            0x8800: 0x20040000,
 12688  	            0x9800: 0x0,
 12689  	            0xa800: 0x21040080,
 12690  	            0xb800: 0x1000080,
 12691  	            0xc800: 0x20000080,
 12692  	            0xd800: 0x21000000,
 12693  	            0xe800: 0x1000000,
 12694  	            0xf800: 0x40080,
 12695  	            0x10000: 0x40000,
 12696  	            0x11000: 0x80,
 12697  	            0x12000: 0x20000000,
 12698  	            0x13000: 0x21000080,
 12699  	            0x14000: 0x1000080,
 12700  	            0x15000: 0x21040000,
 12701  	            0x16000: 0x20040080,
 12702  	            0x17000: 0x1000000,
 12703  	            0x18000: 0x21040080,
 12704  	            0x19000: 0x21000000,
 12705  	            0x1a000: 0x1040000,
 12706  	            0x1b000: 0x20040000,
 12707  	            0x1c000: 0x40080,
 12708  	            0x1d000: 0x20000080,
 12709  	            0x1e000: 0x0,
 12710  	            0x1f000: 0x1040080,
 12711  	            0x10800: 0x21000080,
 12712  	            0x11800: 0x1000000,
 12713  	            0x12800: 0x1040000,
 12714  	            0x13800: 0x20040080,
 12715  	            0x14800: 0x20000000,
 12716  	            0x15800: 0x1040080,
 12717  	            0x16800: 0x80,
 12718  	            0x17800: 0x21040000,
 12719  	            0x18800: 0x40080,
 12720  	            0x19800: 0x21040080,
 12721  	            0x1a800: 0x0,
 12722  	            0x1b800: 0x21000000,
 12723  	            0x1c800: 0x1000080,
 12724  	            0x1d800: 0x40000,
 12725  	            0x1e800: 0x20040000,
 12726  	            0x1f800: 0x20000080
 12727  	        },
 12728  	        {
 12729  	            0x0: 0x10000008,
 12730  	            0x100: 0x2000,
 12731  	            0x200: 0x10200000,
 12732  	            0x300: 0x10202008,
 12733  	            0x400: 0x10002000,
 12734  	            0x500: 0x200000,
 12735  	            0x600: 0x200008,
 12736  	            0x700: 0x10000000,
 12737  	            0x800: 0x0,
 12738  	            0x900: 0x10002008,
 12739  	            0xa00: 0x202000,
 12740  	            0xb00: 0x8,
 12741  	            0xc00: 0x10200008,
 12742  	            0xd00: 0x202008,
 12743  	            0xe00: 0x2008,
 12744  	            0xf00: 0x10202000,
 12745  	            0x80: 0x10200000,
 12746  	            0x180: 0x10202008,
 12747  	            0x280: 0x8,
 12748  	            0x380: 0x200000,
 12749  	            0x480: 0x202008,
 12750  	            0x580: 0x10000008,
 12751  	            0x680: 0x10002000,
 12752  	            0x780: 0x2008,
 12753  	            0x880: 0x200008,
 12754  	            0x980: 0x2000,
 12755  	            0xa80: 0x10002008,
 12756  	            0xb80: 0x10200008,
 12757  	            0xc80: 0x0,
 12758  	            0xd80: 0x10202000,
 12759  	            0xe80: 0x202000,
 12760  	            0xf80: 0x10000000,
 12761  	            0x1000: 0x10002000,
 12762  	            0x1100: 0x10200008,
 12763  	            0x1200: 0x10202008,
 12764  	            0x1300: 0x2008,
 12765  	            0x1400: 0x200000,
 12766  	            0x1500: 0x10000000,
 12767  	            0x1600: 0x10000008,
 12768  	            0x1700: 0x202000,
 12769  	            0x1800: 0x202008,
 12770  	            0x1900: 0x0,
 12771  	            0x1a00: 0x8,
 12772  	            0x1b00: 0x10200000,
 12773  	            0x1c00: 0x2000,
 12774  	            0x1d00: 0x10002008,
 12775  	            0x1e00: 0x10202000,
 12776  	            0x1f00: 0x200008,
 12777  	            0x1080: 0x8,
 12778  	            0x1180: 0x202000,
 12779  	            0x1280: 0x200000,
 12780  	            0x1380: 0x10000008,
 12781  	            0x1480: 0x10002000,
 12782  	            0x1580: 0x2008,
 12783  	            0x1680: 0x10202008,
 12784  	            0x1780: 0x10200000,
 12785  	            0x1880: 0x10202000,
 12786  	            0x1980: 0x10200008,
 12787  	            0x1a80: 0x2000,
 12788  	            0x1b80: 0x202008,
 12789  	            0x1c80: 0x200008,
 12790  	            0x1d80: 0x0,
 12791  	            0x1e80: 0x10000000,
 12792  	            0x1f80: 0x10002008
 12793  	        },
 12794  	        {
 12795  	            0x0: 0x100000,
 12796  	            0x10: 0x2000401,
 12797  	            0x20: 0x400,
 12798  	            0x30: 0x100401,
 12799  	            0x40: 0x2100401,
 12800  	            0x50: 0x0,
 12801  	            0x60: 0x1,
 12802  	            0x70: 0x2100001,
 12803  	            0x80: 0x2000400,
 12804  	            0x90: 0x100001,
 12805  	            0xa0: 0x2000001,
 12806  	            0xb0: 0x2100400,
 12807  	            0xc0: 0x2100000,
 12808  	            0xd0: 0x401,
 12809  	            0xe0: 0x100400,
 12810  	            0xf0: 0x2000000,
 12811  	            0x8: 0x2100001,
 12812  	            0x18: 0x0,
 12813  	            0x28: 0x2000401,
 12814  	            0x38: 0x2100400,
 12815  	            0x48: 0x100000,
 12816  	            0x58: 0x2000001,
 12817  	            0x68: 0x2000000,
 12818  	            0x78: 0x401,
 12819  	            0x88: 0x100401,
 12820  	            0x98: 0x2000400,
 12821  	            0xa8: 0x2100000,
 12822  	            0xb8: 0x100001,
 12823  	            0xc8: 0x400,
 12824  	            0xd8: 0x2100401,
 12825  	            0xe8: 0x1,
 12826  	            0xf8: 0x100400,
 12827  	            0x100: 0x2000000,
 12828  	            0x110: 0x100000,
 12829  	            0x120: 0x2000401,
 12830  	            0x130: 0x2100001,
 12831  	            0x140: 0x100001,
 12832  	            0x150: 0x2000400,
 12833  	            0x160: 0x2100400,
 12834  	            0x170: 0x100401,
 12835  	            0x180: 0x401,
 12836  	            0x190: 0x2100401,
 12837  	            0x1a0: 0x100400,
 12838  	            0x1b0: 0x1,
 12839  	            0x1c0: 0x0,
 12840  	            0x1d0: 0x2100000,
 12841  	            0x1e0: 0x2000001,
 12842  	            0x1f0: 0x400,
 12843  	            0x108: 0x100400,
 12844  	            0x118: 0x2000401,
 12845  	            0x128: 0x2100001,
 12846  	            0x138: 0x1,
 12847  	            0x148: 0x2000000,
 12848  	            0x158: 0x100000,
 12849  	            0x168: 0x401,
 12850  	            0x178: 0x2100400,
 12851  	            0x188: 0x2000001,
 12852  	            0x198: 0x2100000,
 12853  	            0x1a8: 0x0,
 12854  	            0x1b8: 0x2100401,
 12855  	            0x1c8: 0x100401,
 12856  	            0x1d8: 0x400,
 12857  	            0x1e8: 0x2000400,
 12858  	            0x1f8: 0x100001
 12859  	        },
 12860  	        {
 12861  	            0x0: 0x8000820,
 12862  	            0x1: 0x20000,
 12863  	            0x2: 0x8000000,
 12864  	            0x3: 0x20,
 12865  	            0x4: 0x20020,
 12866  	            0x5: 0x8020820,
 12867  	            0x6: 0x8020800,
 12868  	            0x7: 0x800,
 12869  	            0x8: 0x8020000,
 12870  	            0x9: 0x8000800,
 12871  	            0xa: 0x20800,
 12872  	            0xb: 0x8020020,
 12873  	            0xc: 0x820,
 12874  	            0xd: 0x0,
 12875  	            0xe: 0x8000020,
 12876  	            0xf: 0x20820,
 12877  	            0x80000000: 0x800,
 12878  	            0x80000001: 0x8020820,
 12879  	            0x80000002: 0x8000820,
 12880  	            0x80000003: 0x8000000,
 12881  	            0x80000004: 0x8020000,
 12882  	            0x80000005: 0x20800,
 12883  	            0x80000006: 0x20820,
 12884  	            0x80000007: 0x20,
 12885  	            0x80000008: 0x8000020,
 12886  	            0x80000009: 0x820,
 12887  	            0x8000000a: 0x20020,
 12888  	            0x8000000b: 0x8020800,
 12889  	            0x8000000c: 0x0,
 12890  	            0x8000000d: 0x8020020,
 12891  	            0x8000000e: 0x8000800,
 12892  	            0x8000000f: 0x20000,
 12893  	            0x10: 0x20820,
 12894  	            0x11: 0x8020800,
 12895  	            0x12: 0x20,
 12896  	            0x13: 0x800,
 12897  	            0x14: 0x8000800,
 12898  	            0x15: 0x8000020,
 12899  	            0x16: 0x8020020,
 12900  	            0x17: 0x20000,
 12901  	            0x18: 0x0,
 12902  	            0x19: 0x20020,
 12903  	            0x1a: 0x8020000,
 12904  	            0x1b: 0x8000820,
 12905  	            0x1c: 0x8020820,
 12906  	            0x1d: 0x20800,
 12907  	            0x1e: 0x820,
 12908  	            0x1f: 0x8000000,
 12909  	            0x80000010: 0x20000,
 12910  	            0x80000011: 0x800,
 12911  	            0x80000012: 0x8020020,
 12912  	            0x80000013: 0x20820,
 12913  	            0x80000014: 0x20,
 12914  	            0x80000015: 0x8020000,
 12915  	            0x80000016: 0x8000000,
 12916  	            0x80000017: 0x8000820,
 12917  	            0x80000018: 0x8020820,
 12918  	            0x80000019: 0x8000020,
 12919  	            0x8000001a: 0x8000800,
 12920  	            0x8000001b: 0x0,
 12921  	            0x8000001c: 0x20800,
 12922  	            0x8000001d: 0x820,
 12923  	            0x8000001e: 0x20020,
 12924  	            0x8000001f: 0x8020800
 12925  	        }
 12926  	    ];
 12927  
 12928  	    // Masks that select the SBOX input
 12929  	    var SBOX_MASK = [
 12930  	        0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
 12931  	        0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
 12932  	    ];
 12933  
 12934  	    /**
 12935  	     * DES block cipher algorithm.
 12936  	     */
 12937  	    var DES = C_algo.DES = BlockCipher.extend({
 12938  	        _doReset: function () {
 12939  	            // Shortcuts
 12940  	            var key = this._key;
 12941  	            var keyWords = key.words;
 12942  
 12943  	            // Select 56 bits according to PC1
 12944  	            var keyBits = [];
 12945  	            for (var i = 0; i < 56; i++) {
 12946  	                var keyBitPos = PC1[i] - 1;
 12947  	                keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
 12948  	            }
 12949  
 12950  	            // Assemble 16 subkeys
 12951  	            var subKeys = this._subKeys = [];
 12952  	            for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
 12953  	                // Create subkey
 12954  	                var subKey = subKeys[nSubKey] = [];
 12955  
 12956  	                // Shortcut
 12957  	                var bitShift = BIT_SHIFTS[nSubKey];
 12958  
 12959  	                // Select 48 bits according to PC2
 12960  	                for (var i = 0; i < 24; i++) {
 12961  	                    // Select from the left 28 key bits
 12962  	                    subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
 12963  
 12964  	                    // Select from the right 28 key bits
 12965  	                    subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
 12966  	                }
 12967  
 12968  	                // Since each subkey is applied to an expanded 32-bit input,
 12969  	                // the subkey can be broken into 8 values scaled to 32-bits,
 12970  	                // which allows the key to be used without expansion
 12971  	                subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
 12972  	                for (var i = 1; i < 7; i++) {
 12973  	                    subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
 12974  	                }
 12975  	                subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
 12976  	            }
 12977  
 12978  	            // Compute inverse subkeys
 12979  	            var invSubKeys = this._invSubKeys = [];
 12980  	            for (var i = 0; i < 16; i++) {
 12981  	                invSubKeys[i] = subKeys[15 - i];
 12982  	            }
 12983  	        },
 12984  
 12985  	        encryptBlock: function (M, offset) {
 12986  	            this._doCryptBlock(M, offset, this._subKeys);
 12987  	        },
 12988  
 12989  	        decryptBlock: function (M, offset) {
 12990  	            this._doCryptBlock(M, offset, this._invSubKeys);
 12991  	        },
 12992  
 12993  	        _doCryptBlock: function (M, offset, subKeys) {
 12994  	            // Get input
 12995  	            this._lBlock = M[offset];
 12996  	            this._rBlock = M[offset + 1];
 12997  
 12998  	            // Initial permutation
 12999  	            exchangeLR.call(this, 4,  0x0f0f0f0f);
 13000  	            exchangeLR.call(this, 16, 0x0000ffff);
 13001  	            exchangeRL.call(this, 2,  0x33333333);
 13002  	            exchangeRL.call(this, 8,  0x00ff00ff);
 13003  	            exchangeLR.call(this, 1,  0x55555555);
 13004  
 13005  	            // Rounds
 13006  	            for (var round = 0; round < 16; round++) {
 13007  	                // Shortcuts
 13008  	                var subKey = subKeys[round];
 13009  	                var lBlock = this._lBlock;
 13010  	                var rBlock = this._rBlock;
 13011  
 13012  	                // Feistel function
 13013  	                var f = 0;
 13014  	                for (var i = 0; i < 8; i++) {
 13015  	                    f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
 13016  	                }
 13017  	                this._lBlock = rBlock;
 13018  	                this._rBlock = lBlock ^ f;
 13019  	            }
 13020  
 13021  	            // Undo swap from last round
 13022  	            var t = this._lBlock;
 13023  	            this._lBlock = this._rBlock;
 13024  	            this._rBlock = t;
 13025  
 13026  	            // Final permutation
 13027  	            exchangeLR.call(this, 1,  0x55555555);
 13028  	            exchangeRL.call(this, 8,  0x00ff00ff);
 13029  	            exchangeRL.call(this, 2,  0x33333333);
 13030  	            exchangeLR.call(this, 16, 0x0000ffff);
 13031  	            exchangeLR.call(this, 4,  0x0f0f0f0f);
 13032  
 13033  	            // Set output
 13034  	            M[offset] = this._lBlock;
 13035  	            M[offset + 1] = this._rBlock;
 13036  	        },
 13037  
 13038  	        keySize: 64/32,
 13039  
 13040  	        ivSize: 64/32,
 13041  
 13042  	        blockSize: 64/32
 13043  	    });
 13044  
 13045  	    // Swap bits across the left and right words
 13046  	    function exchangeLR(offset, mask) {
 13047  	        var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
 13048  	        this._rBlock ^= t;
 13049  	        this._lBlock ^= t << offset;
 13050  	    }
 13051  
 13052  	    function exchangeRL(offset, mask) {
 13053  	        var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
 13054  	        this._lBlock ^= t;
 13055  	        this._rBlock ^= t << offset;
 13056  	    }
 13057  
 13058  	    /**
 13059  	     * Shortcut functions to the cipher's object interface.
 13060  	     *
 13061  	     * @example
 13062  	     *
 13063  	     *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
 13064  	     *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
 13065  	     */
 13066  	    C.DES = BlockCipher._createHelper(DES);
 13067  
 13068  	    /**
 13069  	     * Triple-DES block cipher algorithm.
 13070  	     */
 13071  	    var TripleDES = C_algo.TripleDES = BlockCipher.extend({
 13072  	        _doReset: function () {
 13073  	            // Shortcuts
 13074  	            var key = this._key;
 13075  	            var keyWords = key.words;
 13076  
 13077  	            // Create DES instances
 13078  	            this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2)));
 13079  	            this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4)));
 13080  	            this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6)));
 13081  	        },
 13082  
 13083  	        encryptBlock: function (M, offset) {
 13084  	            this._des1.encryptBlock(M, offset);
 13085  	            this._des2.decryptBlock(M, offset);
 13086  	            this._des3.encryptBlock(M, offset);
 13087  	        },
 13088  
 13089  	        decryptBlock: function (M, offset) {
 13090  	            this._des3.decryptBlock(M, offset);
 13091  	            this._des2.encryptBlock(M, offset);
 13092  	            this._des1.decryptBlock(M, offset);
 13093  	        },
 13094  
 13095  	        keySize: 192/32,
 13096  
 13097  	        ivSize: 64/32,
 13098  
 13099  	        blockSize: 64/32
 13100  	    });
 13101  
 13102  	    /**
 13103  	     * Shortcut functions to the cipher's object interface.
 13104  	     *
 13105  	     * @example
 13106  	     *
 13107  	     *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
 13108  	     *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
 13109  	     */
 13110  	    C.TripleDES = BlockCipher._createHelper(TripleDES);
 13111  	}());
 13112  
 13113  
 13114  	return CryptoJS.TripleDES;
 13115  
 13116  }));
 13117  },{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],84:[function(require,module,exports){
 13118  ;(function (root, factory) {
 13119  	if (typeof exports === "object") {
 13120  		// CommonJS
 13121  		module.exports = exports = factory(require("./core"));
 13122  	}
 13123  	else if (typeof define === "function" && define.amd) {
 13124  		// AMD
 13125  		define(["./core"], factory);
 13126  	}
 13127  	else {
 13128  		// Global (browser)
 13129  		factory(root.CryptoJS);
 13130  	}
 13131  }(this, function (CryptoJS) {
 13132  
 13133  	(function (undefined) {
 13134  	    // Shortcuts
 13135  	    var C = CryptoJS;
 13136  	    var C_lib = C.lib;
 13137  	    var Base = C_lib.Base;
 13138  	    var X32WordArray = C_lib.WordArray;
 13139  
 13140  	    /**
 13141  	     * x64 namespace.
 13142  	     */
 13143  	    var C_x64 = C.x64 = {};
 13144  
 13145  	    /**
 13146  	     * A 64-bit word.
 13147  	     */
 13148  	    var X64Word = C_x64.Word = Base.extend({
 13149  	        /**
 13150  	         * Initializes a newly created 64-bit word.
 13151  	         *
 13152  	         * @param {number} high The high 32 bits.
 13153  	         * @param {number} low The low 32 bits.
 13154  	         *
 13155  	         * @example
 13156  	         *
 13157  	         *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
 13158  	         */
 13159  	        init: function (high, low) {
 13160  	            this.high = high;
 13161  	            this.low = low;
 13162  	        }
 13163  
 13164  	        /**
 13165  	         * Bitwise NOTs this word.
 13166  	         *
 13167  	         * @return {X64Word} A new x64-Word object after negating.
 13168  	         *
 13169  	         * @example
 13170  	         *
 13171  	         *     var negated = x64Word.not();
 13172  	         */
 13173  	        // not: function () {
 13174  	            // var high = ~this.high;
 13175  	            // var low = ~this.low;
 13176  
 13177  	            // return X64Word.create(high, low);
 13178  	        // },
 13179  
 13180  	        /**
 13181  	         * Bitwise ANDs this word with the passed word.
 13182  	         *
 13183  	         * @param {X64Word} word The x64-Word to AND with this word.
 13184  	         *
 13185  	         * @return {X64Word} A new x64-Word object after ANDing.
 13186  	         *
 13187  	         * @example
 13188  	         *
 13189  	         *     var anded = x64Word.and(anotherX64Word);
 13190  	         */
 13191  	        // and: function (word) {
 13192  	            // var high = this.high & word.high;
 13193  	            // var low = this.low & word.low;
 13194  
 13195  	            // return X64Word.create(high, low);
 13196  	        // },
 13197  
 13198  	        /**
 13199  	         * Bitwise ORs this word with the passed word.
 13200  	         *
 13201  	         * @param {X64Word} word The x64-Word to OR with this word.
 13202  	         *
 13203  	         * @return {X64Word} A new x64-Word object after ORing.
 13204  	         *
 13205  	         * @example
 13206  	         *
 13207  	         *     var ored = x64Word.or(anotherX64Word);
 13208  	         */
 13209  	        // or: function (word) {
 13210  	            // var high = this.high | word.high;
 13211  	            // var low = this.low | word.low;
 13212  
 13213  	            // return X64Word.create(high, low);
 13214  	        // },
 13215  
 13216  	        /**
 13217  	         * Bitwise XORs this word with the passed word.
 13218  	         *
 13219  	         * @param {X64Word} word The x64-Word to XOR with this word.
 13220  	         *
 13221  	         * @return {X64Word} A new x64-Word object after XORing.
 13222  	         *
 13223  	         * @example
 13224  	         *
 13225  	         *     var xored = x64Word.xor(anotherX64Word);
 13226  	         */
 13227  	        // xor: function (word) {
 13228  	            // var high = this.high ^ word.high;
 13229  	            // var low = this.low ^ word.low;
 13230  
 13231  	            // return X64Word.create(high, low);
 13232  	        // },
 13233  
 13234  	        /**
 13235  	         * Shifts this word n bits to the left.
 13236  	         *
 13237  	         * @param {number} n The number of bits to shift.
 13238  	         *
 13239  	         * @return {X64Word} A new x64-Word object after shifting.
 13240  	         *
 13241  	         * @example
 13242  	         *
 13243  	         *     var shifted = x64Word.shiftL(25);
 13244  	         */
 13245  	        // shiftL: function (n) {
 13246  	            // if (n < 32) {
 13247  	                // var high = (this.high << n) | (this.low >>> (32 - n));
 13248  	                // var low = this.low << n;
 13249  	            // } else {
 13250  	                // var high = this.low << (n - 32);
 13251  	                // var low = 0;
 13252  	            // }
 13253  
 13254  	            // return X64Word.create(high, low);
 13255  	        // },
 13256  
 13257  	        /**
 13258  	         * Shifts this word n bits to the right.
 13259  	         *
 13260  	         * @param {number} n The number of bits to shift.
 13261  	         *
 13262  	         * @return {X64Word} A new x64-Word object after shifting.
 13263  	         *
 13264  	         * @example
 13265  	         *
 13266  	         *     var shifted = x64Word.shiftR(7);
 13267  	         */
 13268  	        // shiftR: function (n) {
 13269  	            // if (n < 32) {
 13270  	                // var low = (this.low >>> n) | (this.high << (32 - n));
 13271  	                // var high = this.high >>> n;
 13272  	            // } else {
 13273  	                // var low = this.high >>> (n - 32);
 13274  	                // var high = 0;
 13275  	            // }
 13276  
 13277  	            // return X64Word.create(high, low);
 13278  	        // },
 13279  
 13280  	        /**
 13281  	         * Rotates this word n bits to the left.
 13282  	         *
 13283  	         * @param {number} n The number of bits to rotate.
 13284  	         *
 13285  	         * @return {X64Word} A new x64-Word object after rotating.
 13286  	         *
 13287  	         * @example
 13288  	         *
 13289  	         *     var rotated = x64Word.rotL(25);
 13290  	         */
 13291  	        // rotL: function (n) {
 13292  	            // return this.shiftL(n).or(this.shiftR(64 - n));
 13293  	        // },
 13294  
 13295  	        /**
 13296  	         * Rotates this word n bits to the right.
 13297  	         *
 13298  	         * @param {number} n The number of bits to rotate.
 13299  	         *
 13300  	         * @return {X64Word} A new x64-Word object after rotating.
 13301  	         *
 13302  	         * @example
 13303  	         *
 13304  	         *     var rotated = x64Word.rotR(7);
 13305  	         */
 13306  	        // rotR: function (n) {
 13307  	            // return this.shiftR(n).or(this.shiftL(64 - n));
 13308  	        // },
 13309  
 13310  	        /**
 13311  	         * Adds this word with the passed word.
 13312  	         *
 13313  	         * @param {X64Word} word The x64-Word to add with this word.
 13314  	         *
 13315  	         * @return {X64Word} A new x64-Word object after adding.
 13316  	         *
 13317  	         * @example
 13318  	         *
 13319  	         *     var added = x64Word.add(anotherX64Word);
 13320  	         */
 13321  	        // add: function (word) {
 13322  	            // var low = (this.low + word.low) | 0;
 13323  	            // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
 13324  	            // var high = (this.high + word.high + carry) | 0;
 13325  
 13326  	            // return X64Word.create(high, low);
 13327  	        // }
 13328  	    });
 13329  
 13330  	    /**
 13331  	     * An array of 64-bit words.
 13332  	     *
 13333  	     * @property {Array} words The array of CryptoJS.x64.Word objects.
 13334  	     * @property {number} sigBytes The number of significant bytes in this word array.
 13335  	     */
 13336  	    var X64WordArray = C_x64.WordArray = Base.extend({
 13337  	        /**
 13338  	         * Initializes a newly created word array.
 13339  	         *
 13340  	         * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
 13341  	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
 13342  	         *
 13343  	         * @example
 13344  	         *
 13345  	         *     var wordArray = CryptoJS.x64.WordArray.create();
 13346  	         *
 13347  	         *     var wordArray = CryptoJS.x64.WordArray.create([
 13348  	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 13349  	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 13350  	         *     ]);
 13351  	         *
 13352  	         *     var wordArray = CryptoJS.x64.WordArray.create([
 13353  	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 13354  	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 13355  	         *     ], 10);
 13356  	         */
 13357  	        init: function (words, sigBytes) {
 13358  	            words = this.words = words || [];
 13359  
 13360  	            if (sigBytes != undefined) {
 13361  	                this.sigBytes = sigBytes;
 13362  	            } else {
 13363  	                this.sigBytes = words.length * 8;
 13364  	            }
 13365  	        },
 13366  
 13367  	        /**
 13368  	         * Converts this 64-bit word array to a 32-bit word array.
 13369  	         *
 13370  	         * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
 13371  	         *
 13372  	         * @example
 13373  	         *
 13374  	         *     var x32WordArray = x64WordArray.toX32();
 13375  	         */
 13376  	        toX32: function () {
 13377  	            // Shortcuts
 13378  	            var x64Words = this.words;
 13379  	            var x64WordsLength = x64Words.length;
 13380  
 13381  	            // Convert
 13382  	            var x32Words = [];
 13383  	            for (var i = 0; i < x64WordsLength; i++) {
 13384  	                var x64Word = x64Words[i];
 13385  	                x32Words.push(x64Word.high);
 13386  	                x32Words.push(x64Word.low);
 13387  	            }
 13388  
 13389  	            return X32WordArray.create(x32Words, this.sigBytes);
 13390  	        },
 13391  
 13392  	        /**
 13393  	         * Creates a copy of this word array.
 13394  	         *
 13395  	         * @return {X64WordArray} The clone.
 13396  	         *
 13397  	         * @example
 13398  	         *
 13399  	         *     var clone = x64WordArray.clone();
 13400  	         */
 13401  	        clone: function () {
 13402  	            var clone = Base.clone.call(this);
 13403  
 13404  	            // Clone "words" array
 13405  	            var words = clone.words = this.words.slice(0);
 13406  
 13407  	            // Clone each X64Word object
 13408  	            var wordsLength = words.length;
 13409  	            for (var i = 0; i < wordsLength; i++) {
 13410  	                words[i] = words[i].clone();
 13411  	            }
 13412  
 13413  	            return clone;
 13414  	        }
 13415  	    });
 13416  	}());
 13417  
 13418  
 13419  	return CryptoJS;
 13420  
 13421  }));
 13422  },{"./core":53}],85:[function(require,module,exports){
 13423  /*! https://mths.be/utf8js v2.1.2 by @mathias */
 13424  ;(function(root) {
 13425  
 13426  	// Detect free variables `exports`
 13427  	var freeExports = typeof exports == 'object' && exports;
 13428  
 13429  	// Detect free variable `module`
 13430  	var freeModule = typeof module == 'object' && module &&
 13431  		module.exports == freeExports && module;
 13432  
 13433  	// Detect free variable `global`, from Node.js or Browserified code,
 13434  	// and use it as `root`
 13435  	var freeGlobal = typeof global == 'object' && global;
 13436  	if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
 13437  		root = freeGlobal;
 13438  	}
 13439  
 13440  	/*--------------------------------------------------------------------------*/
 13441  
 13442  	var stringFromCharCode = String.fromCharCode;
 13443  
 13444  	// Taken from https://mths.be/punycode
 13445  	function ucs2decode(string) {
 13446  		var output = [];
 13447  		var counter = 0;
 13448  		var length = string.length;
 13449  		var value;
 13450  		var extra;
 13451  		while (counter < length) {
 13452  			value = string.charCodeAt(counter++);
 13453  			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
 13454  				// high surrogate, and there is a next character
 13455  				extra = string.charCodeAt(counter++);
 13456  				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
 13457  					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
 13458  				} else {
 13459  					// unmatched surrogate; only append this code unit, in case the next
 13460  					// code unit is the high surrogate of a surrogate pair
 13461  					output.push(value);
 13462  					counter--;
 13463  				}
 13464  			} else {
 13465  				output.push(value);
 13466  			}
 13467  		}
 13468  		return output;
 13469  	}
 13470  
 13471  	// Taken from https://mths.be/punycode
 13472  	function ucs2encode(array) {
 13473  		var length = array.length;
 13474  		var index = -1;
 13475  		var value;
 13476  		var output = '';
 13477  		while (++index < length) {
 13478  			value = array[index];
 13479  			if (value > 0xFFFF) {
 13480  				value -= 0x10000;
 13481  				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
 13482  				value = 0xDC00 | value & 0x3FF;
 13483  			}
 13484  			output += stringFromCharCode(value);
 13485  		}
 13486  		return output;
 13487  	}
 13488  
 13489  	function checkScalarValue(codePoint) {
 13490  		if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
 13491  			throw Error(
 13492  				'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
 13493  				' is not a scalar value'
 13494  			);
 13495  		}
 13496  	}
 13497  	/*--------------------------------------------------------------------------*/
 13498  
 13499  	function createByte(codePoint, shift) {
 13500  		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
 13501  	}
 13502  
 13503  	function encodeCodePoint(codePoint) {
 13504  		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
 13505  			return stringFromCharCode(codePoint);
 13506  		}
 13507  		var symbol = '';
 13508  		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
 13509  			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
 13510  		}
 13511  		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
 13512  			checkScalarValue(codePoint);
 13513  			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
 13514  			symbol += createByte(codePoint, 6);
 13515  		}
 13516  		else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
 13517  			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
 13518  			symbol += createByte(codePoint, 12);
 13519  			symbol += createByte(codePoint, 6);
 13520  		}
 13521  		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
 13522  		return symbol;
 13523  	}
 13524  
 13525  	function utf8encode(string) {
 13526  		var codePoints = ucs2decode(string);
 13527  		var length = codePoints.length;
 13528  		var index = -1;
 13529  		var codePoint;
 13530  		var byteString = '';
 13531  		while (++index < length) {
 13532  			codePoint = codePoints[index];
 13533  			byteString += encodeCodePoint(codePoint);
 13534  		}
 13535  		return byteString;
 13536  	}
 13537  
 13538  	/*--------------------------------------------------------------------------*/
 13539  
 13540  	function readContinuationByte() {
 13541  		if (byteIndex >= byteCount) {
 13542  			throw Error('Invalid byte index');
 13543  		}
 13544  
 13545  		var continuationByte = byteArray[byteIndex] & 0xFF;
 13546  		byteIndex++;
 13547  
 13548  		if ((continuationByte & 0xC0) == 0x80) {
 13549  			return continuationByte & 0x3F;
 13550  		}
 13551  
 13552  		// If we end up here, it’s not a continuation byte
 13553  		throw Error('Invalid continuation byte');
 13554  	}
 13555  
 13556  	function decodeSymbol() {
 13557  		var byte1;
 13558  		var byte2;
 13559  		var byte3;
 13560  		var byte4;
 13561  		var codePoint;
 13562  
 13563  		if (byteIndex > byteCount) {
 13564  			throw Error('Invalid byte index');
 13565  		}
 13566  
 13567  		if (byteIndex == byteCount) {
 13568  			return false;
 13569  		}
 13570  
 13571  		// Read first byte
 13572  		byte1 = byteArray[byteIndex] & 0xFF;
 13573  		byteIndex++;
 13574  
 13575  		// 1-byte sequence (no continuation bytes)
 13576  		if ((byte1 & 0x80) == 0) {
 13577  			return byte1;
 13578  		}
 13579  
 13580  		// 2-byte sequence
 13581  		if ((byte1 & 0xE0) == 0xC0) {
 13582  			byte2 = readContinuationByte();
 13583  			codePoint = ((byte1 & 0x1F) << 6) | byte2;
 13584  			if (codePoint >= 0x80) {
 13585  				return codePoint;
 13586  			} else {
 13587  				throw Error('Invalid continuation byte');
 13588  			}
 13589  		}
 13590  
 13591  		// 3-byte sequence (may include unpaired surrogates)
 13592  		if ((byte1 & 0xF0) == 0xE0) {
 13593  			byte2 = readContinuationByte();
 13594  			byte3 = readContinuationByte();
 13595  			codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
 13596  			if (codePoint >= 0x0800) {
 13597  				checkScalarValue(codePoint);
 13598  				return codePoint;
 13599  			} else {
 13600  				throw Error('Invalid continuation byte');
 13601  			}
 13602  		}
 13603  
 13604  		// 4-byte sequence
 13605  		if ((byte1 & 0xF8) == 0xF0) {
 13606  			byte2 = readContinuationByte();
 13607  			byte3 = readContinuationByte();
 13608  			byte4 = readContinuationByte();
 13609  			codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
 13610  				(byte3 << 0x06) | byte4;
 13611  			if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
 13612  				return codePoint;
 13613  			}
 13614  		}
 13615  
 13616  		throw Error('Invalid UTF-8 detected');
 13617  	}
 13618  
 13619  	var byteArray;
 13620  	var byteCount;
 13621  	var byteIndex;
 13622  	function utf8decode(byteString) {
 13623  		byteArray = ucs2decode(byteString);
 13624  		byteCount = byteArray.length;
 13625  		byteIndex = 0;
 13626  		var codePoints = [];
 13627  		var tmp;
 13628  		while ((tmp = decodeSymbol()) !== false) {
 13629  			codePoints.push(tmp);
 13630  		}
 13631  		return ucs2encode(codePoints);
 13632  	}
 13633  
 13634  	/*--------------------------------------------------------------------------*/
 13635  
 13636  	var utf8 = {
 13637  		'version': '2.1.2',
 13638  		'encode': utf8encode,
 13639  		'decode': utf8decode
 13640  	};
 13641  
 13642  	// Some AMD build optimizers, like r.js, check for specific condition patterns
 13643  	// like the following:
 13644  	if (
 13645  		typeof define == 'function' &&
 13646  		typeof define.amd == 'object' &&
 13647  		define.amd
 13648  	) {
 13649  		define(function() {
 13650  			return utf8;
 13651  		});
 13652  	}	else if (freeExports && !freeExports.nodeType) {
 13653  		if (freeModule) { // in Node.js or RingoJS v0.8.0+
 13654  			freeModule.exports = utf8;
 13655  		} else { // in Narwhal or RingoJS v0.7.0-
 13656  			var object = {};
 13657  			var hasOwnProperty = object.hasOwnProperty;
 13658  			for (var key in utf8) {
 13659  				hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
 13660  			}
 13661  		}
 13662  	} else { // in Rhino or a web browser
 13663  		root.utf8 = utf8;
 13664  	}
 13665  
 13666  }(this));
 13667  
 13668  },{}],86:[function(require,module,exports){
 13669  module.exports = XMLHttpRequest;
 13670  
 13671  },{}],"bignumber.js":[function(require,module,exports){
 13672  'use strict';
 13673  
 13674  module.exports = BigNumber; // jshint ignore:line
 13675  
 13676  
 13677  },{}],"web3":[function(require,module,exports){
 13678  var Web3 = require('./lib/web3');
 13679  
 13680  // don't override global variable
 13681  if (typeof window !== 'undefined' && typeof window.Web3 === 'undefined') {
 13682      window.Web3 = Web3;
 13683  }
 13684  
 13685  module.exports = Web3;
 13686  
 13687  },{"./lib/web3":22}]},{},["web3"])
 13688  //# sourceMappingURL=web3-light.js.map