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