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