You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

442 lines
999 KiB

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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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})({"bitcore":[function(require,module,exports){
module.exports=require('tmvhGl');
},{}],"tmvhGl":[function(require,module,exports){
(function(e){var i=function(e,i){Object.defineProperty(module.exports,e,{get:function(){return require(i)}})};i("Bignum","bignum"),Object.defineProperty(module.exports,"bignum",{get:function(){return console.log('bignum (with a lower-case "b") is deprecated. Use bitcore.Bignum (capital "B") instead.'),require("bignum")}}),i("Base58","./lib/Base58"),Object.defineProperty(module.exports,"base58",{get:function(){return console.log('base58 (with a lower-case "b") is deprecated. Use bitcore.Base58 (capital "B") instead.'),require("./lib/Base58")}}),i("bufferput","bufferput"),i("buffertools","buffertools"),i("Buffers.monkey","./patches/Buffers.monkey"),i("config","./config"),i("const","./const"),i("Deserialize","./lib/Deserialize"),i("ECIES","./lib/ECIES"),i("log","./util/log"),i("networks","./networks"),i("SecureRandom","./lib/SecureRandom"),i("sjcl","./lib/sjcl"),i("util","./util/util"),i("EncodedData","./util/EncodedData"),i("VersionedData","./util/VersionedData"),i("BinaryParser","./util/BinaryParser"),i("Address","./lib/Address"),i("HierarchicalKey","./lib/HierarchicalKey"),Object.defineProperty(module.exports,"BIP32",{get:function(){return console.log("BIP32 is deprecated. Use bitcore.HierarchicalKey instead."),require("./lib/HierarchicalKey")}}),i("BIP39","./lib/BIP39"),i("BIP39WordlistEn","./lib/BIP39WordlistEn"),i("Point","./lib/Point"),i("Opcode","./lib/Opcode"),i("Script","./lib/Script"),i("Transaction","./lib/Transaction"),i("TransactionBuilder","./lib/TransactionBuilder"),i("Connection","./lib/Connection"),i("PayPro","./lib/PayPro"),i("Peer","./lib/Peer"),i("Block","./lib/Block"),i("ScriptInterpreter","./lib/ScriptInterpreter"),i("Bloom","./lib/Bloom"),i("Key","./lib/Key"),Object.defineProperty(module.exports,"KeyModule",{get:function(){return console.log("KeyModule is deprecated."),require("bindings")("KeyModule")}}),i("SINKey","./lib/SINKey"),i("SIN","./lib/SIN"),i("PrivateKey","./lib/PrivateKey"),i("RpcClient","./lib/RpcClient"),i("Wallet","./lib/Wallet"),i("WalletKey","./lib/WalletKey"),i("PeerManager","./lib/PeerManager"),i("Message","./lib/Message"),i("Electrum","./lib/Electrum"),i("Armory","./lib/Armory"),i("NetworkMonitor","./lib/NetworkMonitor"),module.exports.Buffer=e}).call(this,require("buffer").Buffer);
11 years ago
},{"./lib/Base58":"6VqyzY","./lib/HierarchicalKey":"x1O6JW","bignum":59,"bindings":85,"buffer":93}],"4itQ50":[function(require,module,exports){
module.exports={network:"livenet",logger:"normal"};
},{}],"./config":[function(require,module,exports){
module.exports=require('4itQ50');
},{}],"./const":[function(require,module,exports){
module.exports=require('f08cvL');
},{}],"f08cvL":[function(require,module,exports){
MSG={TX:1,BLOCK:2,FILTERED_BLOCK:3},MSG.to_str=function(t){switch(t){case MSG.TX:return"transaction";case MSG.BLOCK:return"block";case MSG.FILTERED_BLOCK:return"filtered block";default:return"unknown"}},exports.MSG=MSG;
},{}],"G+CcXD":[function(require,module,exports){
11 years ago
(function(e){"use strict";function r(t,i){if(i&&i.length&&(!e.isBuffer(i)||20!=i.length))throw new Error("Hash must be 20 bytes");r.super_.call(this,t,i)}var t=require("../util"),i=require("../util/VersionedData"),n=require("../util/EncodedData"),s=require("../networks"),o=require("./Script"),u=require("util");u.inherits(r,i),n.applyEncodingsTo(r),r.fromPubKey=function(e,i){if(i||(i="livenet"),33!==e.length&&65!==e.length)throw new Error("Invalid public key");var n=s[i].addressVersion,o=t.sha256ripe160(e);return new r(n,o)},r.fromKey=function(e,t){return r.fromPubKey(e.public,t)},r.fromPubKeys=function(e,t,i,n){i||(i="livenet");for(var s in t){var u=t[s];if(33!=u.length&&65!=u.length)throw new Error("Invalid public key")}var a=o.createMultisig(e,t,n);return r.fromScript(a,i)},r.fromScript=function(i,n){n||(n="livenet"),"string"==typeof i&&(i=new o(new e(i,"hex")));var u=s[n].P2SHVersion,a=i.getBuffer(),f=t.sha256ripe160(a);return new r(u,f)},r.fromScriptPubKey=function(i,n){"string"==typeof i&&(i=new o(new e(i,"hex"))),n||(n="livenet");var u,a=[],f=i.capture();if(f){var c=i.classify();switch(c){case o.TX_PUBKEY:f[0]=t.sha256ripe160(f[0]),u=s[n].addressVersion;break;case o.TX_PUBKEYHASH:u=s[n].addressVersion;break;case o.TX_MULTISIG:u=s[n].addressVersion;for(var l in f)f[l]=t.sha256ripe160(f[l]);break;case o.TX_SCRIPTHASH:u=s[n].P2SHVersion}for(var l in f)a.push(new r(u,f[l]))}return a},r.prototype.validate=function(){if(this.doAsBinary(function(){if(r.super_.prototype.validate.apply(this),21!==this.data.length)throw new Error("invalid data length")}),"undefined"==typeof this.network())throw new Error("invalid network")},r.prototype.network=function(){var e,r=this.version(),t=s.livenet,i=s.testnet;return r===t.addressVersion||r===t.P2SHVersion?e=t:(r===i.addressVersion||r===i.P2SHVersion)&&(e=i),e},r.prototype.isScript=function(){return this.isValid()&&this.version()===this.network().P2SHVersion},r.prototype.getScriptPubKey=function(){var e,r=this.version(),t=s.livenet,i=s.testnet;if(r===t.addressVersion||r===i.addressVersion)e=o.createPubKeyHashOut(this.payload());else{if(r!==t.P2SHVersion&&r!==i.P2SHVersion)throw new Error("invalid address - unknown version");e=o.createP2SH(this.payload())}return e},r.fromPubkeyHashScriptSig=function(e,t){return r.fromPubKey(e.chunks[1],t)},r.fromScriptSig=function(t,i){"string"==typeof t&&(t=new o(new e(t,"hex"))),i||(i="livenet");t.chunks;return 2===t.chunks.length?r.fromPubkeyHashScriptSig(t,i):null},r.getScriptPubKeyFor=function(e){return new r(e).getScriptPubKey()},r.validate=function(e){return new r(e).isValid()},module.exports=r}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util":189,"../util/EncodedData":"eLfUFE","../util/VersionedData":"QLzNQg","./Script":"hQ0t76","buffer":93,"util":126}],"./lib/Address":[function(require,module,exports){
module.exports=require('G+CcXD');
},{}],"./lib/Armory":[function(require,module,exports){
module.exports=require('YL/05i');
},{}],"YL/05i":[function(require,module,exports){
(function(e){function r(r,n){this.chaincode=new e(r,"hex"),this.pubkey=new e(n,"hex")}function n(e){for(var r="0123456789abcdef",n="asdfghjkwertuion",t="",i=0;i<e.length;i++)t+=r.charAt(n.indexOf(e.charAt(i)));return t}var t=require("./Point"),i=require("./Key"),o=require("../util").sha256,c=require("../util").twoSha256;r.prototype.generatePubKey=function(){for(var e=this.pubkey,r=this.chaincode,n=c(e),i=0;32>i;i++)n[i]^=r[i];var o=t.fromUncompressedPubKey(e);o=t.multiply(o,n);var u=o.toUncompressedPubKey();return u},r.prototype.next=function(){var e=this.generatePubKey();return new r(this.chaincode,e)},r.fromMasterPublicKey=function(e){var n=e.substr(0,130),t=e.substr(130,e.length);return new r(t,n)},r.decodeSeed=function(t){for(var i=t.trim().split("\n"),o=[],c=0;c<i.length;c++){var u=i[c].replace(" ",""),a=new e(n(u),"hex"),h=a.slice(0,16);o.push(h)}var s=e.concat([o[0],o[1]]),f=4==o.length?e.concat([o[2],o[3]]):r.deriveChaincode(s);return{privKey:s,chainCode:f}},r.fromSeed=function(e){var n=r.decodeSeed(e),t=new i;return t.private=n.privKey,t.compressed=!1,t.regenerateSync(),new r(n.chainCode,t.public)},r.deriveChaincode=function(r){for(var n="Derive Chaincode from Root Key",t=c(r),i=[],u=[],a=0;a<t.length;a++)i.push(92^t[a]),u.push(54^t[a]);i=new e(i),u=new e(u);var h=new e(n,"utf8"),s=o(e.concat([u,h])),f=o(e.concat([i,s]));return f},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"./Key":"ALJ4PS","./Point":"6tXgqr","buffer":93}],"./lib/BIP39":[function(require,module,exports){
module.exports=require('82LilS');
},{}],"82LilS":[function(require,module,exports){
(function(e){var n=require("../util"),r=require("./sjcl"),t=require("./SecureRandom"),i=function(e){var n=new r.misc.hmac(e,r.hash.sha512);this.encrypt=function(){return n.encrypt.apply(n,arguments)}},o=function(e,n,t){var o=r.misc.pbkdf2(e,n,t,512,i);return r.codec.hex.fromBits(o)},l=function(){};l.mnemonic=function(e,n){if(n||(n=128),n%32!=0)throw new Error("bits must be multiple of 32");var r=t.getRandomBuffer(n/8);return l.entropy2mnemonic(e,r)},l.entropy2mnemonic=function(e,r){for(var t=n.sha256(r),i="",o=8*r.length,l=0;l<r.length;l++)i+=("00000000"+r[l].toString(2)).slice(-8);var c=t[0].toString(2);if(c=("00000000"+c).slice(-8).slice(0,o/32),i+=c,i.length%11!=0)throw new Error("internal error - entropy not an even multiple of 11 bits - "+i.length);for(var u="",l=0;l<i.length/11;l++){""!=u&&(u+=" ");var s=parseInt(i.slice(11*l,11*(l+1)),2);u+=e[s]}return u},l.check=function(r,t){for(var i=t.split(" "),o="",l=0;l<i.length;l++){var c=r.indexOf(i[l]);if(0>c)return!1;o+=("00000000000"+c.toString(2)).slice(-11)}if(o.length%11!=0)throw new Error("internal error - entropy not an even multiple of 11 bits - "+o.length);for(var u=o.length/33,s=o.slice(-u),a=o.slice(0,o.length-u),f=new e(a.length/8),l=0;l<a.length/8;l++)f.writeUInt8(parseInt(o.slice(8*l,8*(l+1)),2),l);var h=n.sha256(f),m=h[0].toString(2);return m=("00000000"+m).slice(-8).slice(0,u),m==s},l.mnemonic2seed=function(n,r){r||(r="");var t=o(n,"mnemonic"+r,2048,64),i=new e(t,"hex");return i},module.exports=l}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"./SecureRandom":"p4SiC2","./sjcl":"oLMOpG","buffer":93}],"./lib/BIP39WordlistEn":[function(require,module,exports){
module.exports=require('sp4vFZ');
},{}],"sp4vFZ":[function(require,module,exports){
var BIP39WordlistEn=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","dese
},{}],"./lib/Base58":[function(require,module,exports){
module.exports=require('6VqyzY');
},{}],"6VqyzY":[function(require,module,exports){
(function(e){function r(r){return new e(t.createHash("sha256").update(r).digest("binary"),"binary")}function n(e){return r(r(e))}for(var t=require("crypto"),o=require("bignum"),i=new e(1024),c=new e(0),f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",u=f[0],a=new e(f,"ascii"),h={},d=0;d<f.length;d++)h[f[d]]=d;var l={encode:function(r){var n,t,c=o.fromBuffer(r);n=r.length<512?i:new e(r.length<<1);for(var f=n.length-1;c.gt(0);)t=c.mod(58),c=c.div(58),n[f]=a[t.toNumber()],f--;for(var u=0;0==r[u];)n[f]=a[0],u++,f--;return n.slice(f+1,n.length).toString("ascii")},decode:function(r){if(0==r.length)return c;for(var n=o(0),t=0;t<r.length;t++)n=n.mul(58),n=n.add(h[r[t]]);for(var t=0;t<r.length&&r[t]==u;)t++;if(t>0){var i=new e(t);return i.fill(0),t==r.length?i:(n=n.toBuffer(),e.concat([i,n],t+n.length))}return n.toBuffer()}},s={encode:function(r){var t=new e(r.length+4),o=n(r);return r.copy(t),o.copy(t,r.length),l.encode(t)},decode:function(e){var r=l.decode(e);if(r.length<4)throw new Error("invalid input: too short");var t=r.slice(0,-4),o=r.slice(-4),i=n(t),c=i.slice(0,4);if(o.toString("hex")!==c.toString("hex"))throw new Error("checksum mismatch");return t}};exports.setBuffer=function(e){i=e},exports.base58=l,exports.base58Check=s,exports.encode=l.encode,exports.decode=l.decode}).call(this,require("buffer").Buffer);
11 years ago
},{"bignum":59,"buffer":93,"crypto":97}],"./lib/Block":[function(require,module,exports){
module.exports=require('pJEQEB');
},{}],"pJEQEB":[function(require,module,exports){
(function(t){function e(t){"object"!=typeof t&&(t={}),this.hash=t.hash||null,this.prev_hash=t.prev_hash||r.NULL_HASH,this.merkle_root=t.merkle_root||r.NULL_HASH,this.timestamp=t.timestamp||0,this.bits=t.bits||0,this.nonce=t.nonce||0,this.version=t.version||0,this.height=t.height||0,this.size=t.size||0,this.active=t.active||!1,this.chainWork=t.chainWork||r.EMPTY_BUFFER,this.txs=t.txs||[]}var r=require("../util"),i=require("./Script"),o=require("bignum"),s=(require("binary"),require("step"),require("buffertools")),h=require("./Transaction"),n=h.In,a=h.Out,c=h.COINBASE_OP,u=require("../util/error").VerificationError,l={maxTimeOffset:7200,largestHash:new o("10000000000000000000000000000000000000000000000000000000000000000",16)};e.prototype.getHeader=function(){var e=new t(80),r=0;return e.writeUInt32LE(this.version,r),r+=4,this.prev_hash.copy(e,r),r+=32,this.merkle_root.copy(e,r),r+=32,e.writeUInt32LE(this.timestamp,r),r+=4,e.writeUInt32LE(this.bits,r),r+=4,e.writeUInt32LE(this.nonce,r),r+=4,e},e.prototype.parse=function(t,e){if(this.version=t.word32le(),this.prev_hash=t.buffer(32),this.merkle_root=t.buffer(32),this.timestamp=t.word32le(),this.bits=t.word32le(),this.nonce=t.word32le(),this.txs=[],this.size=0,!e)for(var r=t.varInt(),i=0;r>i;i++){var o=new h;o.parse(t),this.txs.push(o)}},e.prototype.calcHash=function(){var t=this.getHeader();return r.twoSha256(t)},e.prototype.checkHash=function(){return this.hash&&this.hash.length?0==s.compare(this.calcHash(),this.hash):!1},e.prototype.getHash=function(){return this.hash&&this.hash.length||(this.hash=this.calcHash()),this.hash},e.prototype.checkProofOfWork=function(){var t=r.decodeDiffBits(this.bits),e=s.reverse(this.hash);if(s.compare(e,t)>0)throw new u("Difficulty target not met");return!0},e.prototype.getWork=function(){var t=r.decodeDiffBits(this.bits,!0);return l.largestHash.div(t.add(1))},e.prototype.checkTimestamp=function(){var t=(new Date).getTime()/1e3;if(this.timestamp>t+l.maxTimeOffset)throw new u("Timestamp too far into the future");return!0},e.prototype.checkTransactions=function(t){if(!Array.isArray(t)||t.length<=0)throw new u("No transactions");if(!t[0].isCoinBase())throw new u("First tx must be coinbase");for(var e=1;e<t.length;e++)if(t[e].isCoinBase())throw new u("Tx index "+e+" must not be coinbase");return!0},e.prototype.getMerkleTree=function(e){if(0==e.length)return[r.NULL_HASH.slice(0)];for(var i=e.map(function(t){return t instanceof h?t.getHash():t}),o=0,s=e.length;s>1;s=Math.floor((s+1)/2)){for(var n=0;s>n;n+=2){var a=Math.min(n+1,s-1),c=i[o+n],u=i[o+a];i.push(r.twoSha256(t.concat([c,u])))}o+=s}return i},e.prototype.calcMerkleRoot=function(t){var e=this.getMerkleTree(t);return e[e.length-1]},e.prototype.checkMerkleRoot=function(e){if(!this.merkle_root||!this.merkle_root.length)throw new u("No merkle root");if(0!==s.compare(this.calcMerkleRoot(e),new t(this.merkle_root)))throw new u("Merkle root incorrect");return!0},e.prototype.checkBlock=function(t){if(!this.checkHash())throw new u("Block hash invalid");if(this.checkProofOfWork(),this.checkTimestamp(),t&&(this.checkTransactions(t),!this.checkMerkleRoot(t)))throw new u("Merkle hash invalid");return!0},e.getBlockValue=function(t){var e=50*r.COIN;return e/=Math.pow(2,Math.floor(t/21e4)),e=Math.floor(e),e=new o(e)},e.prototype.getBlockValue=function(){return e.getBlockValue(this.height)},e.prototype.toString=function(){return"<Block "+r.formatHashAlt(this.hash)+" height="+this.height+">"},e.prototype.createCoinbaseTx=function(t){var e=new h;return e.ins.push(new n({s:r.EMPTY_BUFFER,q:4294967295,o:c})),e.outs.push(new a({v:r.bigIntToValue(this.getBlockValue()),s:i.createPubKeyOut(t).getBuffer()})),e},e.prototype.solve=function(t,e){var i=this.getHeader(),o=r.decodeDiffBits(this.bits);t.solve(i,o,e)},e.prototype.getStandardizedObject=function(t){var e={hash:r.formatHashFull(this.getHash()),version:this.version,prev_block:r.formatHashFull(this.prev_hash),mrkl_root:r.formatHashFull(this.merkle_root),time:this.timestamp,bits:this.bits,nonce:this.nonce,height:this.height};if(t){var i=this.getMerkleTree(t).map(
11 years ago
},{"../util":189,"../util/error":188,"./Script":"hQ0t76","./Transaction":"LJhYtm","bignum":59,"binary":81,"buffer":93,"buffertools":"fugeBw","step":176}],"./lib/Bloom":[function(require,module,exports){
module.exports=require('KifRG4');
},{}],"KifRG4":[function(require,module,exports){
function Bloom(){this.data="",this.hashFuncs=0}function ROTL32(t,n){return t<<n|t>>32-n}function getBlockU32(t,n){var o=4*t,s=n[o+0]<<0|n[o+1]<<8|n[o+2]<<16|n[o+3]<<24;return s}function toInt(t){return~~t}function min(t,n){return n>t?t:n}var MAX_BLOOM_FILTER_SIZE=36e3,MAX_HASH_FUNCS=50,LN2SQUARED=.48045301391820144,LN2=.6931471805599453,bit_mask=[1,2,4,8,16,32,64,128];Bloom.prototype.hash=function(t,n){for(var o=t*(4294967295/(this.hashFuncs-1)),s=3432918353,a=461845907,h=n.length/4,i=-h;i;i++){var r=getBlockU32(i);r*=s,r=ROTLF32(r,15),r*=a,o^=r,o=ROTFL(o,13),o=5*o+3864292196}var e=n.slice(4*h),r=0;switch(3&n.length){case 3:r^=e[2]<<16;case 2:r^=e[1]<<8;case 1:r^=e[0],r*=s,r=ROTL32(r,15),r*=a,o^=r}return o^=n.length,o^=o>>16,o*=2246822507,o^=o>>13,o*=3266489909,o^=o>>16,o%(8*this.data.length)},Bloom.prototype.insert=function(t){for(var n=0;n<this.hashFuncs;n++){var o=this.hash(n,t);this.data[o>>3]|=bit_mask[7&o]}},Bloom.prototype.contains=function(t){for(var n=0;n<this.hashFuncs;n++){var o=this.hash(n,t);if(!(this.data[o>>3]&bit_mask[7&o]))return!1}return!0},Bloom.prototype.sizeOk=function(){return this.data.length<=MAX_BLOOM_FILTER_SIZE&&this.hashFuncs<=MAX_HASH_FUNCS},Bloom.prototype.init=function(t,n){var o=min(toInt(-1/LN2SQUARED*t*Math.log(n)),8*MAX_BLOOM_FILTER_SIZE)/8;this.data[o]=0,this.hashFuncs=min(toInt(8*this.data.length/t*LN2),MAX_HASH_FUNCS)},module.exports=Bloom;
11 years ago
},{}],"./lib/Connection":[function(require,module,exports){
module.exports=require('DB/p3X');
11 years ago
},{}],"DB/p3X":[function(require,module,exports){
(function(e){function t(e,t,r){if(this.config=r||a,this.network=h[this.config.network]||h.livenet,this.socket=e,this.peer=t,this.config.proxy){var s=require("socks5-client");this.socket=new s(this.config.proxy.host,this.config.proxy.port)}this.active=!1,this.recvVer=0,this.sendVer=0,this.bestHeight=0,this.inbound=!!this.socket.server,this.getaddr=!1,this.buffers=new o,(new Date).getTime()>1329696e6&&(this.recvVer=209,this.sendVer=209),this.setupHandlers()}var r=require("../util/log"),s=1e7,n=7e4,i=require("bufferput"),o=require("buffers");require("../patches/Buffers.monkey").patch(o);var a=require("../config"),h=require("../networks"),c=require("./Block"),d=require("./Transaction"),f=require("../util"),u=require("../util/BinaryParser"),p=require("buffertools"),g=f.twoSha256,l=require("./SecureRandom"),v=l.getPseudoRandomBuffer(8),b=require("util"),k=require("events").EventEmitter,m=6e4;b.inherits(t,k),t.prototype.open=function(e){return"function"==typeof e&&this.once("connect",e),this.socket.connect(this.peer.port,this.peer.host),this},t.prototype.setupHandlers=function(){this.socket.addListener("connect",this.handleConnect.bind(this)),this.socket.addListener("error",this.handleError.bind(this)),this.socket.addListener("end",this.handleDisconnect.bind(this)),this.socket.addListener("data",function(e){var t=35;r.debug("["+this.peer+"] Recieved "+e.length+" bytes of data:"),r.debug("... "+p.toHex(e.slice(0,t>e.length?e.length:t))+(e.length>t?"...":""))}.bind(this)),this.socket.addListener("data",this.handleData.bind(this))},t.prototype.handleConnect=function(){this.inbound||this.sendVersion(),this.emit("connect",{conn:this,socket:this.socket,peer:this.peer})},t.prototype.handleError=function(e){110==e.errno||"ETIMEDOUT"==e.errno?r.info("connection timed out for "+this.peer):111==e.errno||"ECONNREFUSED"==e.errno?r.info("connection refused for "+this.peer):r.warn("connection with "+this.peer+" "+e.toString()),this.emit("error",{conn:this,socket:this.socket,peer:this.peer,err:e})},t.prototype.handleDisconnect=function(){this.emit("disconnect",{conn:this,socket:this.socket,peer:this.peer})},t.prototype.handleMessage=function(t){if(t){try{switch(t.command){case"version":if(0===p.compare(v,t.nonce))return void this.socket.end();this.inbound&&this.sendVersion(),t.version>=209&&this.sendMessage("verack",new e([])),this.sendVer=Math.min(t.version,n),t.version<209?this.recvVer=Math.min(t.version,n):this.once("verack",function(){this.recvVer=t.version}.bind(this)),this.bestHeight=t.start_height;break;case"verack":this.recvVer=Math.min(t.version,n),this.active=!0;break;case"ping":"object"==typeof t.nonce&&this.sendPong(t.nonce)}}catch(s){return void r.err('Error while handling "'+t.command+'" message from '+this.peer+":\n"+(s.stack?s.stack:s.toString()))}this.emit(t.command,{conn:this,socket:this.socket,peer:this.peer,message:t})}},t.prototype.sendPong=function(e){this.sendMessage("pong",e)},t.prototype.sendVersion=function(){var t="/BitcoinX:0.1/",r=new i;r.word32le(n),r.word64le(1),r.word64le(Math.round((new Date).getTime()/1e3)),r.pad(26),r.pad(26),r.put(v),r.varint(t.length),r.put(new e(t,"ascii")),r.word32le(0),this.sendMessage("version",r.buffer())},t.prototype.sendGetBlocks=function(t,r,s){r=r||f.NULL_HASH;var n=new i;n.word32le(this.sendVer),n.varint(t.length);for(var o=0;o<t.length;o++){if(32!=t[o].length)throw new Error("Invalid hash length");n.put(t[o])}var a=new e(r,"binary");if(32!=a.length)throw new Error("Invalid hash length");n.put(a);var h="getblocks";s&&(h="getheaders"),this.sendMessage(h,n.buffer())},t.prototype.sendGetHeaders=function(e,t){this.sendGetBlocks(e,t,!0)},t.prototype.sendGetData=function(e){var t=new i;t.varint(e.length);for(var r=0;r<e.length;r++)t.word32le(e[r].type),t.put(e[r].hash);this.sendMessage("getdata",t.buffer())},t.prototype.sendGetAddr=function(){var e=new i;this.sendMessage("getaddr",e.buffer())},t.prototype.sendInv=function(e){Array.isArray(e)||(e=[e]);var t=new i;t.varint(e.length),e.forEach(function(e){t.word32le(e instanceof c?2:1),t.put(e.getHash())}),this.sendMessage("inv",t.buffer(
},{"../config":"4itQ50","../networks":"ULNIu2","../patches/Buffers.monkey":"kytKTK","../util":189,"../util/BinaryParser":"b3ZSD7","../util/log":"AdF7pF","./Block":"pJEQEB","./SecureRandom":"p4SiC2","./Transaction":"LJhYtm","buffer":93,"bufferput":"aXRuS6","buffers":"OBo3aV","buffertools":"fugeBw","events":"T9Wsc/","socks5-client":170,"util":126}],"ez/meX":[function(require,module,exports){
exports.intFromCompact=function(r){var t=(r>>>24&255)>>>0,n=(16777215&r)<<8*(t-3)>>>0;return n};
},{}],"./lib/Deserialize":[function(require,module,exports){
module.exports=require('ez/meX');
},{}],"./lib/Electrum":[function(require,module,exports){
module.exports=require('hdzBvq');
},{}],"hdzBvq":[function(require,module,exports){
(function(e){function r(r){this.mpk=new e(r,"hex")}var t=require("./Key"),u=require("./Point"),n=require("../util").twoSha256,i=(require("buffertools"),require("bignum"));r.prototype.getSequence=function(r,t){var u=r?1:0,o=e.concat([new e(t+":"+u+":","utf8"),this.mpk]);return i.fromBuffer(n(o))},r.prototype.generatePubKey=function(r,n){var o=i.fromBuffer(this.mpk.slice(0,32),{size:32}),f=i.fromBuffer(this.mpk.slice(32,64),{size:32}),c=new u(o,f),p=this.getSequence(n,r),s=new t;s.private=p.toBuffer(),s.regenerateSync(),s.compressed=!1;var a=u.fromUncompressedPubKey(s.public);pt=u.add(c,a);var m=pt.x.toBuffer({size:32}),b=pt.y.toBuffer({size:32}),h=new e([4]),l=new t;return l.compressed=!1,l.public=e.concat([h,m,b]),l.public},r.prototype.generateChangePubKey=function(e){return this.generatePubKey(e,!0)},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"./Key":"ALJ4PS","./Point":"6tXgqr","bignum":59,"buffer":93,"buffertools":"fugeBw"}],"x1O6JW":[function(require,module,exports){
(function(e){function i(e,i){if(e.length<i)throw new Error("not enough data");for(var t=0,n=0;i>n;n++)t*=256,t+=e[n];return t}function t(e){return i(e,1)}function n(e){return i(e,4)}var r=require("./Base58").base58,s=require("../util"),h=require("./Key"),a=require("./Point"),c=require("./SecureRandom"),o=require("bignum"),d=require("../networks"),l=new o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",16),u=(new o("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",16),function(i){if("undefined"==typeof i||"mainnet"==i||"livenet"==i?(i="livenet",this.version=d.livenet.hkeyPrivateVersion):"testnet"==i&&(this.version=d.testnet.hkeyPrivateVersion),"livenet"==i||"testnet"==i)return this.depth=0,this.parentFingerprint=new e([0,0,0,0]),this.childIndex=new e([0,0,0,0]),this.chainCode=c.getRandomBuffer(32),this.eckey=h.generateSync(),this.hasPrivateKey=!0,this.pubKeyHash=s.sha256ripe160(this.eckey.public),this.buildExtendedPublicKey(),void this.buildExtendedPrivateKey();if("string"==typeof i){var t=r.decode(i);if(82!=t.length)throw new Error("Not enough data, expected 82 and received "+t.length);var n=t.slice(78,82);i=t.slice(0,78);var a=s.sha256(s.sha256(i));if(a[0]!=n[0]||a[1]!=n[1]||a[2]!=n[2]||a[3]!=n[3])throw new Error("Invalid checksum")}void 0!==i&&null!==i&&this.initFromBytes(i)});u.seed=function(i,t){if(t||(t="livenet"),e.isBuffer(i)||(i=new e(i,"hex")),i.length<16)return!1;if(i.length>64)return!1;var n=s.sha512hmac(i,new e("Bitcoin seed")),r=new u(null);return r.depth=0,r.parentFingerprint=new e([0,0,0,0]),r.childIndex=new e([0,0,0,0]),r.chainCode=n.slice(32,64),r.version=d[t].hkeyPrivateVersion,r.eckey=new h,r.eckey.private=n.slice(0,32),r.eckey.regenerateSync(),r.hasPrivateKey=!0,r.pubKeyHash=s.sha256ripe160(r.eckey.public),r.buildExtendedPublicKey(),r.buildExtendedPrivateKey(),r},u.prototype.initFromBytes=function(e){if(78!=e.length)throw new Error("not enough data");this.version=n(e.slice(0,4)),this.depth=t(e.slice(4,5)),this.parentFingerprint=e.slice(5,9),this.childIndex=n(e.slice(9,13)),this.chainCode=e.slice(13,45);var i=e.slice(45,78),r=this.version==d.livenet.hkeyPrivateVersion||this.version==d.testnet.hkeyPrivateVersion,a=this.version==d.livenet.hkeyPublicVersion||this.version==d.testnet.hkeyPublicVersion;if(r&&0==i[0])this.eckey=new h,this.eckey.private=i.slice(1,33),this.eckey.compressed=!0,this.eckey.regenerateSync(),this.pubKeyHash=s.sha256ripe160(this.eckey.public),this.hasPrivateKey=!0;else{if(!a||2!=i[0]&&3!=i[0])throw new Error("Invalid key");this.eckey=new h,this.eckey.public=i,this.pubKeyHash=s.sha256ripe160(this.eckey.public),this.hasPrivateKey=!1}this.buildExtendedPublicKey(),this.buildExtendedPrivateKey()},u.prototype.buildExtendedPublicKey=function(){this.extendedPublicKey=new e([]);var i=null;switch(this.version){case d.livenet.hkeyPublicVersion:case d.livenet.hkeyPrivateVersion:i=d.livenet.hkeyPublicVersion;break;case d.testnet.hkeyPublicVersion:case d.testnet.hkeyPrivateVersion:i=d.testnet.hkeyPublicVersion;break;default:throw new Error("Unknown version")}this.extendedPublicKey=e.concat([new e([i>>24]),new e([i>>16&255]),new e([i>>8&255]),new e([255&i]),new e([this.depth]),this.parentFingerprint,new e([this.childIndex>>>24]),new e([this.childIndex>>>16&255]),new e([this.childIndex>>>8&255]),new e([255&this.childIndex]),this.chainCode,this.eckey.public])},u.prototype.extendedPublicKeyString=function(i){if(void 0===i||"base58"===i){var t=s.sha256(s.sha256(this.extendedPublicKey)),n=t.slice(0,4),h=e.concat([this.extendedPublicKey,n]);return r.encode(h)}if("hex"===i)return this.extendedPublicKey.toString("hex");throw new Error("bad format")},u.prototype.buildExtendedPrivateKey=function(){if(this.hasPrivateKey){this.extendedPrivateKey=new e([]);var i=this.version;this.extendedPrivateKey=e.concat([new e([i>>24]),new e([i>>16&255]),new e([i>>8&255]),new e([255&i]),new e([this.depth]),this.parentFingerprint,new e([this.childIndex>>>24]),new e([this.childIndex>>>16&255]),new e([this.childIndex>>>8&255]),new e([255&this.childIndex]),this.chainCode,new e([0]),this.ecke
11 years ago
},{"../networks":"ULNIu2","../util":189,"./Base58":"6VqyzY","./Key":"ALJ4PS","./Point":"6tXgqr","./SecureRandom":"p4SiC2","bignum":59,"buffer":93}],"./lib/HierarchicalKey":[function(require,module,exports){
module.exports=require('x1O6JW');
},{}],"CBDCgz":[function(require,module,exports){
(function(e){"use strict";var n=require("../util"),i=require("./Key"),r=function(){};r.sign=function(e,n){var i=r.magicHash(e),t=n.signSync(i);return t},r.verifyWithPubKey=function(e,n,t){var u=r.magicHash(n),a=new i;return 65==e.length&&(a.compressed=!1),a.public=e,a.verifySignatureSync(u,t)},r.magicBytes=new e("Bitcoin Signed Message:\n"),r.magicHash=function(i){var t=r.magicBytes,u=n.varIntBuf(t.length),a=new e(i),c=n.varIntBuf(a.length),s=e.concat([u,t,c,a]),f=n.twoSha256(s);return f},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"./Key":"ALJ4PS","buffer":93}],"./lib/Message":[function(require,module,exports){
module.exports=require('CBDCgz');
11 years ago
},{}],"qYkfjX":[function(require,module,exports){
var log=require("../util/log"),networks=require("../networks"),Address=require("./Address"),Peer=require("./Peer"),PeerManager=require("./PeerManager"),util=require("util"),EventEmitter=require("events").EventEmitter,preconditions=require("preconditions").singleton(),NetworkMonitor=function(e){preconditions.checkArgument(e),this.peerman=e,this.networkName=e.config.network,this.init()};util.inherits(NetworkMonitor,EventEmitter),NetworkMonitor.create=function(e){this.config=e;var t=new PeerManager({network:e.networkName});return t.addPeer(new Peer(e.host,e.port)),new NetworkMonitor(t)},NetworkMonitor.prototype.init=function(){var e=this,t=function(e){var t=e.message.invs;e.conn.sendGetData(t)},n=function(t){e.emit("block",t.message)},o=function(t){var n=t.message.tx;e.emit("tx",n);for(var o=n.getSendingAddresses(e.config.networkName),r=0;r<o.length;r++){var i=o[r];e.emit("out:"+i,n)}for(var s=n.getReceivingAddresses(e.config.networkName),r=0;r<s.length;r++){var i=s[r];e.emit("in:"+i,n)}};this.peerman.on("connection",function(r){if(e.connection)throw new Error("Cant handle more than one connection");e.connection=r,r.on("inv",t),r.on("block",n),r.on("tx",o)})},NetworkMonitor.prototype.incoming=function(e,t){preconditions.checkArgument(Address.validate(e)),this.on("in:"+e,t)},NetworkMonitor.prototype.outgoing=function(e,t){preconditions.checkArgument(Address.validate(e)),this.on("out:"+e,t)},NetworkMonitor.prototype.start=function(){this.peerman.start()},NetworkMonitor.prototype.stop=function(){this.peerman.stop()},module.exports=NetworkMonitor;
11 years ago
},{"../networks":"ULNIu2","../util/log":"AdF7pF","./Address":"G+CcXD","./Peer":"oolY81","./PeerManager":"nsqKeP","events":"T9Wsc/","preconditions":161,"util":126}],"./lib/NetworkMonitor":[function(require,module,exports){
module.exports=require('qYkfjX');
},{}],"Zm7/h9":[function(require,module,exports){
function Opcode(O){this.code=O}Opcode.prototype.toString=function(){return Opcode.reverseMap[this.code]},Opcode.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},Opcode.reverseMap=[];for(var k in Opcode.map)Opcode.map.hasOwnProperty(k)&&(Opcode.reverseMap[Opcode.map[k]]=k.substr(3));Opcode.asList=function(){var O=[];for(var P in Opcode.map)Opcode.map.hasOwnProperty(P)&&O.push(P);return O},module.exports=Opcode;
},{}],"./lib/Opcode":[function(require,module,exports){
module.exports=require('Zm7/h9');
},{}],"./lib/Peer":[function(require,module,exports){
module.exports=require('oolY81');
},{}],"oolY81":[function(require,module,exports){
(function(t){function e(r,o,s){if("string"==typeof r){if(r.indexOf(":")&&!o){var n=r.split(":");r=n[0],o=n[1]}this.host=r,this.port=+o||8333}else if(r instanceof e)this.host=r.host,this.port=r.port;else{if(!t.isBuffer(r))throw new Error("Could not instantiate peer, invalid parameter type: "+typeof r);if(0!=i.compare(e.IPV6_IPV4_PADDING,r.slice(0,12)))throw new Error("IPV6 not supported yet! Cannot instantiate host.");this.host=Array.prototype.slice.apply(r.slice(12)).join("."),this.port=+o||8333}this.services=s?s:null,this.lastSeen=0}var r=require("net"),o=require("binary"),i=require("buffertools");e.IPV6_IPV4_PADDING=new t([0,0,0,0,0,0,0,0,0,0,255,255]),e.prototype.createConnection=function(){return this.connection=r.createConnection(this.port,this.host),this.connection},e.prototype.getHostAsBuffer=function(){return new t(this.host.split("."))},e.prototype.toString=function(){return this.host+":"+this.port},e.prototype.toBuffer=function(){var t=o.put();return t.word32le(this.lastSeen),t.word64le(this.services),t.put(this.getHostAsBuffer()),t.word16be(this.port),t.buffer()},module.exports=e}).call(this,require("buffer").Buffer);
11 years ago
},{"binary":81,"buffer":93,"buffertools":"fugeBw","net":89}],"./lib/PeerManager":[function(require,module,exports){
module.exports=require('nsqKeP');
},{}],"nsqKeP":[function(require,module,exports){
function PeerManager(e){this.config=e||{};for(var n in bitcoreDefaults)bitcoreDefaults.hasOwnProperty(n)&&void 0===this.config[n]&&(this.config[n]=bitcoreDefaults[n]);this.active=!1,this.timer=null,this.peers=[],this.pool=[],this.connections=[],this.isConnected=!1,this.peerDiscovery=!1,this.interval=5e3,this.minConnections=8,this.minKnownPeers=10,this.seeds={resolved:[],failed:[]}}var log=require("../util/log"),bitcoreDefaults=require("../config"),Connection=require("./Connection"),Peer=require("./Peer"),async=require("async"),dns=require("dns"),networks=require("../networks"),util=require("util");GetAdjustedTime=function(){return Math.floor((new Date).getTime()/1e3)};var EventEmitter=require("events").EventEmitter;util.inherits(PeerManager,EventEmitter),PeerManager.Connection=Connection,PeerManager.prototype.start=function(){this.active=!0,this.timer||(this.timer=setInterval(this.checkStatus.bind(this),this.interval))},PeerManager.prototype.stop=function(){this.active=!1,this.timer&&(clearInterval(this.timer),this.timer=null);for(var e=0;e<this.connections.length;e++)this.connections[e].socket.end()},PeerManager.prototype.addPeer=function(e,n){if(e instanceof Peer)this.peers.push(e);else{if("string"!=typeof e)throw log.err("Node.addPeer(): Invalid value provided for peer",{val:e}),"Node.addPeer(): Invalid value provided for peer.";this.addPeer(new Peer(e,n))}},PeerManager.prototype.removePeer=function(e){var n=this.peers.indexOf(e),t=!!~n;return t&&this.peers.splice(n,1),t},PeerManager.prototype.checkStatus=function(){if(this.peers.length){var e={};this.peers.forEach(function(n){e[n.toString()]=n}),this.connections.forEach(function(n){var t=n.peer.toString();"undefined"!==e[t]&&delete e[t]});var n=0;this.peers.forEach(function(e){e.connection&&!e.connection._connecting&&n++}),log.debug(n+" of "+this.peers.length+" peers connected"),Object.keys(e).forEach(function(n){this.connectTo(e[n])}.bind(this))}},PeerManager.prototype.connectTo=function(e){log.info("connecting to "+e);try{return this.addConnection(e.createConnection(),e)}catch(n){return log.err("creating connection",n),null}},PeerManager.prototype.addConnection=function(e,n){var t=new Connection(e,n,this.config);return this.connections.push(t),this.emit("connection",t),t.addListener("version",this.handleVersion.bind(this)),t.addListener("verack",this.handleReady.bind(this)),t.addListener("addr",this.handleAddr.bind(this)),t.addListener("getaddr",this.handleGetAddr.bind(this)),t.addListener("error",this.handleError.bind(this)),t.addListener("disconnect",this.handleDisconnect.bind(this)),t},PeerManager.prototype.handleVersion=function(e){e.peer.version=e.message.version,e.peer.start_height=e.message.start_height,!e.conn.inbound,this.peerDiscovery&&(e.message.version>=31402||this.peers.length<1e3)&&(e.conn.sendGetAddr(),e.conn.getaddr=!0)},PeerManager.prototype.handleReady=function(e){log.info("connected to "+e.conn.peer.host+":"+e.conn.peer.port),this.emit("connect",{pm:this,conn:e.conn,socket:e.socket,peer:e.peer}),0==this.isConnected&&(this.emit("netConnected",e),this.isConnected=!0)},PeerManager.prototype.handleAddr=function(e){if(this.peerDiscovery){var n=GetAdjustedTime();e.message.addrs.forEach(function(e){try{(e.time<=1e8||e.time>n+600)&&(e.time=n-432e3);var t=new Peer(e.ip,e.port,e.services);t.lastSeen=e.time,this.peers.push(t)}catch(r){log.warn("Invalid addr received: "+r.message)}}.bind(this)),e.message.addrs.length<1e3&&(e.conn.getaddr=!1)}},PeerManager.prototype.handleGetAddr=function(){},PeerManager.prototype.handleError=function(e){log.err("unkown error with peer "+e.peer+" (disconnecting): "+e.err),this.handleDisconnect.apply(this,[].slice.call(arguments))},PeerManager.prototype.handleDisconnect=function(e){log.info("disconnected from peer "+e.peer);var n=this.connections.indexOf(e.conn);-1!=n&&this.connections.splice(n,1),this.removePeer(e.peer),this.pool.length&&(log.info("replacing peer using the pool of "+this.pool.length+" seeds"),this.addPeer(this.pool.pop())),this.connections.length||(this.emit("netDisconnected"),this.isConnected=!1)},PeerManag
11 years ago
},{"../config":"4itQ50","../networks":"ULNIu2","../util/log":"AdF7pF","./Connection":"DB/p3X","./Peer":"oolY81","async":80,"dns":89,"events":"T9Wsc/","util":126}],"izTl9z":[function(require,module,exports){
(function(t){function i(t,e,r){i.super_.call(this,t,e),void 0!==r&&this.compressed(r)}var e=require("../util/VersionedData"),r=require("../util/EncodedData"),n=require("../networks"),a=require("util");a.inherits(i,e),r.applyEncodingsTo(i),i.prototype.validate=function(){if(this.doAsBinary(function(){if(i.super_.prototype.validate.call(this),this.data.length<32||this.data.length>33&&!this.compressed()||34==this.data.length&&1!=this.data[33]||this.data.length>34)throw new Error("invalid data length")}),"undefined"==typeof this.network())throw new Error("invalid network")},i.prototype.payload=function(t){if(t)return this.doAsBinary(function(){t.copy(this.data,1)}),t;var i=this.as("binary");return 34==i.length?i.slice(1,33):33==i.length?i.slice(1):void 0},i.prototype.compressed=function(i){if(void 0===i){var e=34,r=this.as("binary");if(r.length==e&&1==r[e-1])return!0;if(r.length==e-1)return!1;throw new Error("invalid private key")}this.doAsBinary(function(){var e=34;if(i){var r=new t(e);this.data.copy(r),this.data=r,this.data[e-1]=1}else this.data=this.data.slice(0,e-1)})},i.prototype.network=function(){var t,i=this.version(),e=n.livenet,r=n.testnet;return i===e.privKeyVersion?t=e:i===r.privKeyVersion&&(t=r),t},module.exports=i}).call(this,require("buffer").Buffer);
11 years ago
},{"../networks":"ULNIu2","../util/EncodedData":"eLfUFE","../util/VersionedData":"QLzNQg","buffer":93,"util":126}],"./lib/PrivateKey":[function(require,module,exports){
module.exports=require('izTl9z');
},{}],"./lib/RpcClient":[function(require,module,exports){
module.exports=require('7siE1N');
},{}],"7siE1N":[function(require,module,exports){
(function(t){function e(t){t=t||{},this.host=t.host||"127.0.0.1",this.port=t.port||8332,this.user=t.user||"user",this.pass=t.pass||"pass",this.protocol="http"==t.protocol?n:o,this.batchedCalls=null,this.disableAgent=t.disableAgent||!1}function r(t,e,r){function s(t,e){return function(){var s=arguments.length-1;if(this.batchedCalls)var s=arguments.length;for(var n=0;s>n;n++)e[n]&&(arguments[n]=e[n](arguments[n]));this.batchedCalls?this.batchedCalls.push({jsonrpc:"2.0",method:t,params:l(arguments)}):r.call(this,{method:t,params:l(arguments,0,arguments.length-1)},arguments[arguments.length-1])}}var n={str:function(t){return t.toString()},"int":function(t){return parseFloat(t)},"float":function(t){return parseFloat(t)},bool:function(t){return t===!0||"1"==t||"true"==t||"true"==t.toString().toLowerCase()}};for(var o in e)if(e.hasOwnProperty(o)){for(var i=e[o].split(" "),a=0;a<i.length;a++)i[a]=n[i[a]]?n[i[a]]:n.string;var c=o.toLowerCase();t.prototype[o]=s(c,i),t.prototype[c]=t.prototype[o]}}function s(e,r){var e,s=this;e=JSON.stringify(e);var n=t(s.user+":"+s.pass).toString("base64"),o={host:s.host,path:"/",method:"POST",port:s.port,agent:s.disableAgent?!1:void 0};if(s.httpOptions)for(var a in s.httpOptions)o[a]=s.httpOptions[a];var l=null,c=this.protocol.request(o,function(t){var e="";t.on("data",function(t){e+=t}),t.on("end",function(){if(401==t.statusCode)return void r(new Error("bitcoin JSON-RPC connection rejected: 401 unauthorized"));if(403==t.statusCode)return void r(new Error("bitcoin JSON-RPC connection rejected: 403 forbidden"));if(l)return void r(l);try{var s=JSON.parse(e)}catch(n){return i.err(n.stack),i.err(e),i.err("HTTP Status code:"+t.statusCode),void r(n)}r(s.error,s)})});c.on("error",function(t){var e=new Error("Could not connect to bitcoin via RPC: "+t.message);i.err(e),r(e)}),c.setHeader("Content-Length",e.length),c.setHeader("Content-Type","application/json"),c.setHeader("Authorization","Basic "+n),c.write(e),c.end()}var n=require("http"),o=require("https"),i=require("../util/log");e.prototype.batch=function(t,e){this.batchedCalls=[],t(),s.call(this,this.batchedCalls,e),this.batchedCalls=null};var a={addMultiSigAddress:"",addNode:"",backupWallet:"",createMultiSig:"",createRawTransaction:"",decodeRawTransaction:"",dumpPrivKey:"",encryptWallet:"",getAccount:"",getAccountAddress:"str",getAddedNodeInfo:"",getAddressesByAccount:"",getBalance:"str int",getBestBlockHash:"",getBlock:"",getBlockCount:"",getBlockHash:"int",getBlockNumber:"",getBlockTemplate:"",getConnectionCount:"",getDifficulty:"",getGenerate:"",getHashesPerSec:"",getInfo:"",getMemoryPool:"",getMiningInfo:"",getNewAddress:"",getPeerInfo:"",getRawMemPool:"",getRawTransaction:"str int",getReceivedByAccount:"str int",getReceivedByAddress:"str int",getTransaction:"",getTxOut:"str int bool",getTxOutSetInfo:"",getWork:"",help:"",importAddress:"str str bool",importPrivKey:"str str bool",keyPoolRefill:"",listAccounts:"int",listAddressGroupings:"",listReceivedByAccount:"int bool",listReceivedByAddress:"int bool",listSinceBlock:"str int",listTransactions:"str int int",listUnspent:"int int",listLockUnspent:"bool",lockUnspent:"",move:"str str float int str",sendFrom:"str str float int str str",sendMany:"str str int str",sendRawTransaction:"",sendToAddress:"str float str str",setAccount:"",setGenerate:"bool int",setTxFee:"float",signMessage:"",signRawTransaction:"",stop:"",submitBlock:"",validateAddress:"",verifyMessage:"",walletLock:"",walletPassPhrase:"string int",walletPassphraseChange:""},l=function(t,e,r){return Array.prototype.slice.call(t,e,r)};r(e,a,s),module.exports=e}).call(this,require("buffer").Buffer);
11 years ago
},{"../util/log":"AdF7pF","buffer":93,"http":104,"https":108}],"./lib/SIN":[function(require,module,exports){
module.exports=require('tBM27q');
},{}],"tBM27q":[function(require,module,exports){
(function(t){"use strict";function i(n,r){if("number"!=typeof n)return void i.super_.call(this,n,r);if(!t.isBuffer(r)||20!=r.length)throw new Error("Payload must be 20 bytes");this.data=new t(2+r.length),this.converters=this.encodings.binary.converters,this._encoding=this.encodings.binary._encoding,this.encoding("binary"),this.prefix(15),this.type(n),this.payload(r)}var n=require("../util/VersionedData"),r=require("../util/EncodedData"),e=require("util"),o=require("../util");e.inherits(i,n),r.applyEncodingsTo(i),i.SIN_PERSIST_MAINNET=1,i.SIN_PERSIST_TESTNET=17,i.SIN_EPHEM=2,i.prototype.prefix=function(t){return t||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,0)}),t):this.as("binary").readUInt8(0)},i.prototype.type=function(t){return t||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,1)}),t):this.as("binary").readUInt8(1)},i.prototype.payload=function(t){return t?(this.doAsBinary(function(){t.copy(this.data,2)}),t):this.as("binary").slice(1)},i.prototype.validate=function(){this.doAsBinary(function(){if(i.super_.prototype.validate.call(this),22!=this.data.length)throw new Error("invalid data length")})},i.fromPubKey=function(n,r){if(r||(r=i.SIN_EPHEM),!t.isBuffer(n)||33!==n.length&&65!=n.length)throw new Error("Invalid public key");var e=o.sha256ripe160(n);return new i(e,r)},module.exports=i}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"../util/EncodedData":"eLfUFE","../util/VersionedData":"QLzNQg","buffer":93,"util":126}],"./lib/SINKey":[function(require,module,exports){
module.exports=require('EyghZQ');
},{}],"EyghZQ":[function(require,module,exports){
function SINKey(e){"object"!=typeof e&&(e={}),this.created=e.created,this.privKey=e.privKey}var coinUtil=require("../util"),timeUtil=require("../util/time"),Key=require("./Key"),SIN=require("./SIN");SINKey.prototype.generate=function(){this.privKey=Key.generateSync(),this.created=timeUtil.curtime()},SINKey.prototype.pubkeyHash=function(){return coinUtil.sha256ripe160(this.privKey.public)},SINKey.prototype.storeObj=function(){var e=this.privKey.public.toString("hex"),t=this.pubkeyHash(),i=new SIN(SIN.SIN_EPHEM,t),r={created:this.created,priv:this.privKey.private.toString("hex"),pub:e,sin:i.toString()};return r},module.exports=SINKey;
11 years ago
},{"../util":189,"../util/time":192,"./Key":"ALJ4PS","./SIN":"tBM27q"}],"hQ0t76":[function(require,module,exports){
(function(t){function e(t){this.buffer=t?t:f.EMPTY_BUFFER,this.chunks=[],this.parse()}function r(t){return t==h.map.OP_0||t>=h.map.OP_1&&t<=h.map.OP_16}function n(t){return t<h.map.OP_PUSHDATA1?1:255>=t?2:65535>=t?3:5}function s(e){var r=void 0;return e<h.map.OP_PUSHDATA1?(r=new t(1),r.writeUInt8(e,0)):255>=e?(r=new t(2),r.writeUInt8(h.map.OP_PUSHDATA1,0),r.writeUInt8(e,1)):65535>=e?(r=new t(3),r.writeUInt8(h.map.OP_PUSHDATA2,0),r.writeUInt16LE(e,1)):(r=new t(5),r.writeUInt8(h.map.OP_PUSHDATA4,0),r.writeUInt32LE(e,1)),r}var u=(require("../config"),require("../util/log")),h=require("./Opcode"),o=require("buffertools"),f=require("../util/util"),c=require("../util/BinaryParser"),p=require("bufferput"),a=0,l=1,g=2,k=3,w=4,y=["unknown","pubkey","pubkeyhash","multisig","scripthash"];e.TX_UNKNOWN=a,e.TX_PUBKEY=l,e.TX_PUBKEYHASH=g,e.TX_MULTISIG=k,e.TX_SCRIPTHASH=w,e.prototype.parse=function(){this.chunks=[];for(var t=new c(this.buffer);!t.eof();){var e,r,n=t.word8();n>0&&n<h.map.OP_PUSHDATA1?this.chunks.push(t.buffer(n)):n===h.map.OP_PUSHDATA1?(e=t.word8(),r=t.buffer(e),this.chunks.push(r)):n===h.map.OP_PUSHDATA2?(e=t.word16le(),r=t.buffer(e),this.chunks.push(r)):n===h.map.OP_PUSHDATA4?(e=t.word32le(),r=t.buffer(e),this.chunks.push(r)):this.chunks.push(n)}},e.prototype.isPushOnly=function(){for(var e=0;e<this.chunks.length;e++){var r=this.chunks[e];if(!t.isBuffer(r)&&r>h.map.OP_16)return!1}return!0},e.prototype.isP2SH=function(){return 3==this.chunks.length&&this.chunks[0]==h.map.OP_HASH160&&t.isBuffer(this.chunks[1])&&20==this.chunks[1].length&&this.chunks[2]==h.map.OP_EQUAL},e.prototype.isPubkey=function(){return 2==this.chunks.length&&t.isBuffer(this.chunks[0])&&this.chunks[1]==h.map.OP_CHECKSIG},e.prototype.isPubkeyHash=function(){return 5==this.chunks.length&&this.chunks[0]==h.map.OP_DUP&&this.chunks[1]==h.map.OP_HASH160&&t.isBuffer(this.chunks[2])&&20==this.chunks[2].length&&this.chunks[3]==h.map.OP_EQUALVERIFY&&this.chunks[4]==h.map.OP_CHECKSIG},e.prototype.isMultiSig=function(){return this.chunks.length>3&&r(this.chunks[0])&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return t.isBuffer(e)})&&r(this.chunks[this.chunks.length-2])&&this.chunks[this.chunks.length-1]==h.map.OP_CHECKMULTISIG},e.prototype.isP2shScriptSig=function(){if(!r(this.chunks[0])||0!==this.chunks[0])return!1;var t=new e(this.chunks[this.chunks.length-1]),n=t.classify();return n!==a},e.prototype.isMultiSigScriptSig=function(){return r(this.chunks[0])&&0===this.chunks[0]?!this.isP2shScriptSig():!1},e.prototype.countSignatures=function(){var t=0,e=this.chunks.length;return t=this.isMultiSigScriptSig()?e-1:this.isP2shScriptSig()?e-2:0===o.compare(this.getBuffer(),f.EMPTY_BUFFER)?0:1},e.prototype.countMissingSignatures=function(){if(this.isMultiSig())return u.debug("Can not count missing signatures on normal Multisig script"),null;var t=0,n=this.chunks.length;if(r(this.chunks[0])&&0===this.chunks[0]){var i=new e(this.chunks[n-1]);if(r(i.chunks[0])){var s=i.chunks[0]-80;t=s-(n-2)}else u.debug("Unrecognized script type")}else 0===o.compare(this.getBuffer(),f.EMPTY_BUFFER)&&(t=1);return t},e.prototype.finishedMultiSig=function(){var t=this.countMissingSignatures();return null===t?null:0===t},e.prototype.getMultiSigInfo=function(){if(!this.isMultiSig())throw new Error("Script.getMultiSigInfo(): Not a multiSig script.");for(var t=this.chunks[0]-80,e=this.chunks[this.chunks.length-2]-80,r=[],n=1;n<this.chunks.length-2;n++)r.push(this.chunks[n]);if(r.length!=e)throw new Error("Script.getMultiSigInfo(): Amount of PKs does not match what the script specifies.");return{nsigs:t,npubkeys:e,pubkeys:r}},e.prototype.prependOp0=function(){var t=[0];for(i in this.chunks)this.chunks.hasOwnProperty(i)&&t.push(this.chunks[i]);return this.chunks=t,this.updateBuffer(),this},e.prototype.classify=function(){return this.isPubkeyHash()?g:this.isP2SH()?w:this.isMultiSig()?k:this.isPubkey()?l:a},e.prototype.capture=function(){var t=this.classify(),e=[];switch(t){case l:e.push(this.chunks[0]);break;case g:e.push(this.chunks[2]);break;case k:for(var r=1;r<this.chunks.leng
11 years ago
},{"../config":"4itQ50","../util/BinaryParser":"b3ZSD7","../util/log":"AdF7pF","../util/util":"ACyo5H","./Opcode":"Zm7/h9","buffer":93,"bufferput":"aXRuS6","buffertools":"fugeBw"}],"./lib/Script":[function(require,module,exports){
module.exports=require('hQ0t76');
},{}],"Q/ZWXW":[function(require,module,exports){
(function(a,t){function e(a){this.opts=a||{},this.stack=[],this.disableUnsafeOpcodes=!0}var s=(require("../config"),require("../util/log"),require("../util"),require("./Opcode")),r=require("buffertools"),c=require("bignum"),i=require("../util"),o=require("./Script"),n=require("./Key"),p=i.intToBufferSM,h=i.bufferSMToInt,P=e.SIGHASH_ALL=1,O=(e.SIGHASH_NONE=2,e.SIGHASH_SINGLE=3),k=e.SIGHASH_ANYONECANPAY=128;e.prototype.eval=function(a,e,n,P,O){function k(O){function T(){if(j&&z>0){var a=X[Z],r=q[J];l(a,r,Y,e,n,P,function(a,t){!a&&t?(Z++,z--):(J++,x--,z>x&&(j=!1)),T.call(this)}.bind(this))}else{if(this.stack.push(new t([j?1:0])),g===s.map.OP_CHECKMULTISIGVERIFY){if(!j)throw new Error("OP_CHECKMULTISIGVERIFY negative");this.stackPop()}k.call(this,O)}}try{if(_>=a.chunks.length)return f.length?void O(new Error("Execution stack ended non-empty")):void O(null);var S=!~f.indexOf(!1),g=a.chunks[_++];if(g.length>520)throw new Error("Max push value size exceeded (>520)");if(g>s.map.OP_16&&++v>201)throw new Error("Opcode limit exceeded (>200)");if(this.disableUnsafeOpcodes&&"number"==typeof g&&(g===s.map.OP_CAT||g===s.map.OP_SUBSTR||g===s.map.OP_LEFT||g===s.map.OP_RIGHT||g===s.map.OP_INVERT||g===s.map.OP_AND||g===s.map.OP_OR||g===s.map.OP_XOR||g===s.map.OP_2MUL||g===s.map.OP_2DIV||g===s.map.OP_MUL||g===s.map.OP_DIV||g===s.map.OP_MOD||g===s.map.OP_LSHIFT||g===s.map.OP_RSHIFT))throw new Error("Encountered a disabled opcode");if(S&&t.isBuffer(g))this.stack.push(g);else if(S||s.map.OP_IF<=g&&g<=s.map.OP_ENDIF)switch(g){case s.map.OP_0:this.stack.push(new t([]));break;case s.map.OP_1NEGATE:case s.map.OP_1:case s.map.OP_2:case s.map.OP_3:case s.map.OP_4:case s.map.OP_5:case s.map.OP_6:case s.map.OP_7:case s.map.OP_8:case s.map.OP_9:case s.map.OP_10:case s.map.OP_11:case s.map.OP_12:case s.map.OP_13:case s.map.OP_14:case s.map.OP_15:case s.map.OP_16:var b=g-s.map.OP_1+1,d=p(b);this.stack.push(d);break;case s.map.OP_NOP:case s.map.OP_NOP1:case s.map.OP_NOP2:case s.map.OP_NOP3:case s.map.OP_NOP4:case s.map.OP_NOP5:case s.map.OP_NOP6:case s.map.OP_NOP7:case s.map.OP_NOP8:case s.map.OP_NOP9:case s.map.OP_NOP10:break;case s.map.OP_IF:case s.map.OP_NOTIF:var I=!1;S&&(I=m(this.stackPop()),g===s.map.OP_NOTIF&&(I=!I)),f.push(I);break;case s.map.OP_ELSE:if(f.length<1)throw new Error("Unmatched OP_ELSE");f[f.length-1]=!f[f.length-1];break;case s.map.OP_ENDIF:if(f.length<1)throw new Error("Unmatched OP_ENDIF");f.pop();break;case s.map.OP_VERIFY:var I=m(this.stackTop());if(!I)throw new Error("OP_VERIFY negative");this.stackPop();break;case s.map.OP_RETURN:throw new Error("OP_RETURN");case s.map.OP_TOALTSTACK:E.push(this.stackPop());break;case s.map.OP_FROMALTSTACK:if(E.length<1)throw new Error("OP_FROMALTSTACK with alt stack empty");this.stack.push(E.pop());break;case s.map.OP_2DROP:this.stackPop(),this.stackPop();break;case s.map.OP_2DUP:var N=this.stackTop(2),A=this.stackTop(1);this.stack.push(N),this.stack.push(A);break;case s.map.OP_3DUP:var N=this.stackTop(3),A=this.stackTop(2),R=this.stackTop(1);this.stack.push(N),this.stack.push(A),this.stack.push(R);break;case s.map.OP_2OVER:var N=this.stackTop(4),A=this.stackTop(3);this.stack.push(N),this.stack.push(A);break;case s.map.OP_2ROT:var N=this.stackTop(6),A=this.stackTop(5);this.stack.splice(this.stack.length-6,2),this.stack.push(N),this.stack.push(A);break;case s.map.OP_2SWAP:this.stackSwap(4,2),this.stackSwap(3,1);break;case s.map.OP_IFDUP:var I=this.stackTop();m(I)&&this.stack.push(I);break;case s.map.OP_DEPTH:var I=c(this.stack.length);this.stack.push(p(I));break;case s.map.OP_DROP:this.stackPop();break;case s.map.OP_DUP:this.stack.push(this.stackTop());break;case s.map.OP_NIP:if(this.stack.length<2)throw new Error("OP_NIP insufficient stack size");this.stack.splice(this.stack.length-2,1);break;case s.map.OP_OVER:this.stack.push(this.stackTop(2));break;case s.map.OP_PICK:case s.map.OP_ROLL:var L=u(this.stackPop());if(0>L||L>=this.stack.length)throw new Error("OP_PICK/OP_ROLL insufficient stack size");var I=this.stackTop(L+1);g===s.map.OP_ROLL&&this.stack.splice(this.stack.length-L-1,1),this.stac
11 years ago
},{"../config":"4itQ50","../util":189,"../util/log":"AdF7pF","./Key":"ALJ4PS","./Opcode":"Zm7/h9","./Script":"hQ0t76","/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"bignum":59,"buffer":93,"buffertools":"fugeBw"}],"./lib/ScriptInterpreter":[function(require,module,exports){
module.exports=require('Q/ZWXW');
11 years ago
},{}],"./lib/Transaction":[function(require,module,exports){
module.exports=require('LJhYtm');
11 years ago
},{}],"LJhYtm":[function(require,module,exports){
(function(t){function e(e){if("object"!=typeof e&&(e={}),e.o)this.o=e.o;else if(e.oTxHash&&"undefined"!=typeof e.oIndex&&e.oIndex>=0){var i=new t(e.oTxHash,"hex");i=p.reverse(i);var s=new t(4);s.writeUInt32LE(e.oIndex,0),this.o=t.concat([i,s])}this.s=t.isBuffer(e.s)?e.s:t.isBuffer(e.script)?e.script:h.EMPTY_BUFFER,this.q=e.q?e.q:e.sequence}function i(t){"object"!=typeof t&&(t={}),this.v=t.v?t.v:t.value,this.s=t.s?t.s:t.script}function s(t){"object"!=typeof t&&(t={}),this.hash=t.hash||null,this.version=t.version,this.lock_time=t.lock_time,this.ins=Array.isArray(t.ins)?t.ins.map(function(t){var i=new e;return i.s=t.s,i.q=t.q,i.o=t.o,i}):[],this.outs=Array.isArray(t.outs)?t.outs.map(function(t){var e=new i;return e.v=t.v,e.s=t.s,e}):[],t.buffer&&(this._buffer=t.buffer)}{var n=(require("../config"),require("../util/log"),require("./Address")),r=require("./Script"),o=require("./ScriptInterpreter"),h=require("../util"),u=require("bignum"),a=require("bufferput"),f=require("../util/BinaryParser"),p=(require("step"),require("buffertools")),c=(require("../util/error"),require("./WalletKey"),require("./PrivateKey"),t.concat([h.NULL_HASH,new t("FFFFFFFF","hex")]));parseInt(1e-4*h.COIN)}s.COINBASE_OP=c,e.MAX_SEQUENCE=4294967295,e.prototype.getScript=function(){return new r(this.s)},e.prototype.isCoinBase=function(){return this.o?0===p.compare(new t(this.o),c):!1},e.prototype.serialize=function(){var e=h.varIntBuf(this.s.length),i=new t(4);i.writeUInt32LE(this.q,0);var s=t.concat([this.o,e,this.s,i]);return s},e.prototype.getOutpointHash=function(){return"undefined"!=typeof this.o.outHashCache?this.o.outHashCache:this.o.outHashCache=this.o.slice(0,32)},e.prototype.getOutpointIndex=function(){return this.o[32]+(this.o[33]<<8)+(this.o[34]<<16)+(this.o[35]<<24)},e.prototype.setOutpointIndex=function(t){this.o[32]=255&t,this.o[33]=t>>8&255,this.o[34]=t>>16&255,this.o[35]=t>>24&255},i.prototype.getValue=function(){return new f(this.v).word64lu()},i.prototype.getScript=function(){return new r(this.s)},i.prototype.serialize=function(){var e=h.varIntBuf(this.s.length);return t.concat([this.v,e,this.s])},s.In=e,s.Out=i,s.prototype.isCoinBase=function(){return 1==this.ins.length&&this.ins[0].isCoinBase()},s.prototype.isStandard=function(){var t;for(t=0;t<this.ins.length;t++)if("Strange"==this.ins[t].getScript().getInType())return!1;for(t=0;t<this.outs.length;t++)if("Strange"==this.outs[t].getScript().getOutType())return!1;return!0},s.prototype.serialize=function(){var e=[],i=new t(4);i.writeUInt32LE(this.version,0),e.push(i),e.push(h.varIntBuf(this.ins.length)),this.ins.forEach(function(t){e.push(t.serialize())}),e.push(h.varIntBuf(this.outs.length)),this.outs.forEach(function(t){e.push(t.serialize())});var i=new t(4);return i.writeUInt32LE(this.lock_time,0),e.push(i),this._buffer=t.concat(e),this._buffer},s.prototype.getBuffer=function(){return this._buffer?this._buffer:this.serialize()},s.prototype.calcHash=function(){return this.hash=h.twoSha256(this.getBuffer()),this.hash},s.prototype.checkHash=function(){return this.hash&&this.hash.length?0===p.compare(this.calcHash(),this.hash):!1},s.prototype.getHash=function(){return this.hash&&this.hash.length||(this.hash=this.calcHash()),this.hash},s.prototype.calcNormalizedHash=function(){return this.normalizedHash=this.hashForSignature(new r,0,g),this.normalizedHash},s.prototype.getNormalizedHash=function(){return this.normalizedHash&&this.normalizedHash.length||(this.normalizedHash=this.calcNormalizedHash()),this.normalizedHash},s.prototype.inputs=function(){for(var t=[],e=0;e<this.ins.length;e++){var i=this.ins[e],s=i.getOutpointHash(),n=i.getOutpointIndex();t.push([s,n])}return t},s.prototype.verifyInput=function(t,e,i,s){var n=this.ins[t].getScript();return o.verifyFull(n,e,this,t,0,i,s)},s.prototype.getAffectedKeys=function(t){if(!this.affects||!this.affects.length){this.affects=[];for(var e=0,i=this.outs.length;i>e;e++){var s=this.outs[e],n=s.getScript(),r=n.simpleOutPubKeyHash();r&&this.affects.push(r)}for(var o=t.txIndex,e=0,i=this.ins.length;i>e;e++){var h=this.ins[e];if(!h.isCoinBase()){v
},{"../config":"4itQ50","../util":189,"../util/BinaryParser":"b3ZSD7","../util/error":188,"../util/log":"AdF7pF","./Address":"G+CcXD","./PrivateKey":"izTl9z","./Script":"hQ0t76","./ScriptInterpreter":"Q/ZWXW","./WalletKey":"wWje7g","bignum":59,"buffer":93,"bufferput":"aXRuS6","buffertools":"fugeBw","step":176}],"./lib/TransactionBuilder":[function(require,module,exports){
module.exports=require('D1Ge6m');
},{}],"D1Ge6m":[function(require,module,exports){
(function(t){"use strict";function e(t){return t=t||{},this.lockTime=t.lockTime||0,this.spendUnconfirmed=t.spendUnconfirmed||!1,(t.fee||t.feeSat)&&(this.givenFeeSat=t.fee?t.fee*n.COIN:t.feeSat),this.remainderOut=t.remainderOut,this.signhash=t.signhash||f.SIGHASH_ALL,this.tx={},this.inputsSigned=0,this.signaturesAdded=0,this}var r=require("./Address"),i=require("./Script"),n=require("../util"),s=require("bignum"),a=require("buffertools"),u=require("../networks"),o=require("./WalletKey"),h=require("./PrivateKey"),p=require("./Key"),c=require("../util/log"),f=require("./Transaction"),d=parseInt(1e-4*n.COIN);e.FEE_PER_1000B_SAT=d,e._scriptForPubkeys=function(e){for(var r=e.pubkeys.length,n=[],s=0;r>s;s++)n.push(new t(e.pubkeys[s],"hex"));return i.createMultisig(e.nreq,n)},e._scriptForOut=function(t){var e;if(t.address)e=new r(t.address).getScriptPubKey();else{if(!(t.pubkeys||t.nreq||t.nreq>1))throw new Error("unknown out type");e=this._scriptForPubkeys(t)}return e},e.infoForP2sh=function(t,e){var i=this._scriptForOut(t),s=n.sha256ripe160(i.getBuffer()),a="testnet"===e?u.testnet.P2SHVersion:u.livenet.P2SHVersion,o=new r(a,s),h=o.as("base58");return{script:i,scriptBufHex:i.getBuffer().toString("hex"),hash:s,address:h}},e.prototype.setUnspent=function(t){return this.utxos=t,this},e.prototype._setInputMap=function(){for(var e=[],r=this.selectedUtxos.length,n=0;r>n;n++){var s=this.selectedUtxos[n],a=new t(s.scriptPubKey,"hex"),u=new i(a),o=u.classify();if(o===i.TX_UNKNOWN)throw new Error("unkown output type at:"+n+" Type:"+u.getRawOutType());e.push({address:s.address,scriptPubKey:u,scriptType:o,i:n})}return this.inputMap=e,this},e.prototype.getSelectedUnspent=function(){return this.selectedUtxos},e.prototype._selectUnspent=function(t){if(!this.utxos||!this.utxos.length)throw new Error("unspent not set");var e=[6,1];this.spendUnconfirmed&&e.push(0);var r=[],i=s(0),a=!1,u=null,o=this.utxos.length;do{for(var h=e.shift(),p=0;o>p;p++){var c=this.utxos[p],f=c.confirmations||0;if(!(h>f||u&&f>=u)){var d=c.amountSat||n.parseValue(c.amount);if(i=i.add(d),r.push(c),i.cmp(t)>=0){a=!0;break}}}u=h}while(!a&&e.length);if(!a)throw new Error("not enough unspent tx outputs to fulfill totalNeededAmount [SAT]:"+t);return this.selectedUtxos=r,this._setInputMap(),this},e.prototype._setInputs=function(e){var r=this.selectedUtxos,i=r.length,u=s(0);e.ins=[];for(var o=0;i>o;o++){u=u.add(n.parseValue(r[o].amount));var h={};h.s=n.EMPTY_BUFFER,h.q=4294967295;var p=new t(r[o].txid,"hex"),c=a.reverse(p),f=parseInt(r[o].vout),d=new t(4);d.writeUInt32LE(f,0),h.o=t.concat([c,d]),e.ins.push(h)}return this.valueInSat=u,this},e.prototype._setFee=function(t){if("undefined"==typeof this.valueOutSat)throw new Error("valueOutSat undefined");var e=this.valueOutSat.add(t);if(this.valueInSat.cmp(e)<0){var r=this.valueInSat.toString(),i=e.toString();throw new Error("transaction input amount is less than outputs: "+r+" < "+i+" [SAT]")}return this.feeSat=t,this},e.prototype._setRemainder=function(t,r){if("undefined"==typeof this.valueInSat||"undefined"==typeof this.valueOutSat)throw new Error("valueInSat / valueOutSat undefined");var i=this.valueInSat.sub(this.valueOutSat).sub(this.feeSat),a=t.outs.length;if(this.remainderSat=s(0),a>r&&t.outs.pop(),i.cmp(0)>0){var u=this.remainderOut||this.selectedUtxos[0],o=n.bigIntToValue(i),h=e._scriptForOut(u),p={v:o,s:h.getBuffer()};t.outs.push(p),this.remainderSat=i}return this},e.prototype._setFeeAndRemainder=function(t){var e,r=500,i=t.outs.length;do{e=parseInt(r/1e3)+1;var n=this.givenFeeSat?this.givenFeeSat:e*d,s=this.valueOutSat.add(n);this._selectUnspent(s)._setInputs(t)._setFee(n)._setRemainder(t,i),r=new f(t).getSize()}while(r>1e3*(e+1));return this},e.prototype.setOutputs=function(t){var r=s(0),i={};i.version=1,i.lock_time=this.lockTime||0,i.ins=[],i.outs=[];for(var a=t.length,u=0;a>u;u++){var o=t[u].amountSat||n.parseValue(t[u].amount),h=n.bigIntToValue(o),p=e._scriptForOut(t[u]),c={v:h,s:p.getBuffer()};i.outs.push(c);var d=t[u].amountSat||n.parseValue(t[u].amount);r=r.add(d)}return this.valueOutSat=r,this._setFeeAndRemainder
11 years ago
},{"../networks":"ULNIu2","../util":189,"../util/log":"AdF7pF","./Address":"G+CcXD","./Key":"ALJ4PS","./PrivateKey":"izTl9z","./Script":"hQ0t76","./Transaction":"LJhYtm","./WalletKey":"wWje7g","bignum":59,"buffer":93,"buffertools":"fugeBw"}],"./lib/Wallet":[function(require,module,exports){
module.exports=require('yUY4WV');
},{}],"yUY4WV":[function(require,module,exports){
(function(t){function e(t){"object"!=typeof t&&(t={}),this.datastore=JSON.parse(t.datastore?JSON.stringify(t.datastore):JSON.stringify(h)),this.network=void 0,this.dirty=t.dirty||!0}var r=function(e){return new t(e,"hex")},i=require("fs"),n=require("../util/EncFile"),s=require("./Address"),o=require("../networks"),a=require("../util"),d="aes-256-cbc",h={client:"libcoin",client_version:"0.0.1",network:"testnet",version:1,best_hash:null,best_height:-1,keys:[],sin:{},scripts:{}};e.prototype.readSync=function(t,e){this.datastore=n.readJFileSync(d,e,t),this.dirty=!1},e.prototype.writeSync=function(t,e){var r=t+".tmp";n.writeJFileSync(d,e,r,this.datastore),i.renameSync(r,t),this.dirty=!1},e.prototype.setNetwork=function(t){switch(t||(t=this.datastore.network),t){case"mainnet":case"livenet":this.network=o.livenet;break;case"testnet":this.network=o.testnet;break;default:throw new Error("Unsupported network")}this.datastore.network=this.network.name,this.dirty=!0},e.prototype.addKey=function(t){this.datastore.keys.push(t),this.dirty=!0},e.prototype.addSIN=function(t){this.datastore.sin[t.sin]=t,this.dirty=!0},e.prototype.findKeyHash=function(t){for(var e=t.toString(),r=0;r<this.datastore.keys.length;r++){var i=this.datastore.keys[r],n=i.addr,o=new s(n);if(o.payload().toString()==e)return i}return void 0},e.prototype.expandKey=function(t){var e=new s(t);try{e.validate();var i=e.payload(),n=this.findKeyHash(i);t=n.pub}catch(o){}var a=/^[a-fA-F0-9]+$/;if(!t.match(a))throw new Error("Unknown key type");return r(t)},e.prototype.expandKeys=function(t){var e=[],r=this;return t.forEach(function(t){var i=r.expandKey(t);e.push(i)}),e},e.prototype.addScript=function(t){var e=t.getBuffer(),r=a.sha256ripe160(e),i=new s(this.network.P2SHVersion,r),n=i.as("base58");return this.datastore.scripts[n]=e.toString("hex"),this.dirty=!0,n},module.exports=e}).call(this,require("buffer").Buffer);
11 years ago
},{"../networks":"ULNIu2","../util":189,"../util/EncFile":183,"./Address":"G+CcXD","buffer":93,"fs":89}],"./lib/WalletKey":[function(require,module,exports){
module.exports=require('wWje7g');
},{}],"wWje7g":[function(require,module,exports){
(function(e){function r(e){if(e||(e={}),!e.network)throw new Error("network parameter is required");this.network=e.network,this.created=e.created,this.privKey=e.privKey}var i=require("../util"),t=require("../util/time"),s=require("./Key"),p=require("./PrivateKey"),n=require("./Address");r.prototype.generate=function(){this.privKey=s.generateSync(),this.created=t.curtime()},r.prototype.storeObj=function(){var e=this.privKey.public.toString("hex"),r=i.sha256ripe160(this.privKey.public),t=new n(this.network.addressVersion,r),s=new p(this.network.privKeyVersion,this.privKey.private,this.privKey.compressed),o={created:this.created,priv:s.toString(),pub:e,addr:t.toString()};return o},r.prototype.fromObj=function(r){if(this.created=r.created,this.privKey=new s,64==r.priv.length)this.privKey.private=new e(r.priv,"hex"),this.privKey.compressed="undefined"==typeof r.compressed?!0:r.compressed;else{var i=new p(r.priv);i.validate(),this.privKey.private=new e(i.payload()),this.privKey.compressed=i.compressed()}this.privKey.regenerateSync()},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../util":189,"../util/time":192,"./Address":"G+CcXD","./Key":"ALJ4PS","./PrivateKey":"izTl9z","buffer":93}],59:[function(require,module,exports){
(function(t){function e(t){r.prototype["_"+t]=n.prototype[t];var e=function(e){return"string"==typeof e?e=new n(e):"number"==typeof e&&(e=new n(e.toString())),this["_"+t](e)};r.prototype[t]=e}var n=require("bn.js"),r=function o(t){return this instanceof o?(arguments[0]=t,n.apply(this,arguments)):new r(t)};r.prototype=n.prototype;var i=function(t,e){for(var n=0;n<t.length;n++)e[n]=t[t.length-1-n]};r.fromBuffer=function(e,n){if("undefined"!=typeof n&&"little"===n.endian){var o=new t(e.length);i(e,o),e=o}var f=e.toString("hex");f.length%2&&(f="0"+f);var u=new r(f,16);return u},r.prototype.toBuffer=function(e){var n;if(e&&e.size){var r=this.toString(16);r.length%2&&(r="0"+r);var o=r.length/2;if(n=new t(r,"hex"),o==e.size)n=n;else if(o>e.size)n=n.slice(o-n.length,n.length);else if(o<e.size){for(var f=new t(e.size),u=0;u<n.length;u++)f[f.length-1-u]=n[n.length-1-u];for(var u=0;u<e.size-o;u++)f[u]=0;n=f}}else{var r=this.toString(16);r.length%2&&(r="0"+r),n=new t(r,"hex")}if("undefined"!=typeof e&&"little"===e.endian){var p=new t(n.length);i(n,p),n=p}return n},n.prototype.gt=function(t){return this.cmp(t)>0},n.prototype.lt=function(t){return this.cmp(t)<0},e("add"),e("sub"),e("mul"),e("mod"),e("div"),e("cmp"),e("gt"),e("lt"),r.prototype.toNumber=function(){return parseInt(this.toString(10),10)},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"bn.js":86,"buffer":93}],"./lib/ECIES":[function(require,module,exports){
module.exports=require('0Qraa1');
},{}],"0Qraa1":[function(require,module,exports){
(function(e){"use strict";var t=require("../sjcl"),c=require("../common/ECIES");c.symmetricEncrypt=function(c,r,o){var i=t.codec.hex.toBits(c.toString("hex")),s=t.codec.hex.toBits(r.toString("hex")),n=t.codec.hex.toBits(o.toString("hex"));t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();var h=new t.cipher.aes(i),d=t.mode.cbc.encrypt(h,n,s),a=new e(t.codec.hex.fromBits(d),"hex"),x=e.concat([r,a]);return x},c.symmetricDecrypt=function(c,r){var o=t.codec.hex.toBits(c.toString("hex")),i=r.slice(0,16),s=r.slice(16,r.length);t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();var n=t.codec.hex.toBits(s.toString("hex")),h=t.codec.hex.toBits(i.toString("hex")),d=new t.cipher.aes(o),a=t.mode.cbc.decrypt(d,n,h),x=new e(t.codec.hex.fromBits(a),"hex");return x},module.exports=c}).call(this,require("buffer").Buffer);
11 years ago
},{"../common/ECIES":70,"../sjcl":"oLMOpG","buffer":93}],"./lib/Key":[function(require,module,exports){
module.exports=require('ALJ4PS');
},{}],"ALJ4PS":[function(require,module,exports){
(function(e){var r=require("../SecureRandom"),t=require("bignum"),i=require("elliptic"),s=require("./Point"),n=require("../common/Key"),o=(require("util"),function(){this._pub=null,this._compressed=!0});for(var u in n)n.hasOwnProperty(u)&&(o[u]=n[u]);o.bufferToArray=function(e){for(var r=[],t=e.length,i=0;t>i;i++)r.push(e.readUInt8(i));return r};Object.defineProperty(o.prototype,"public",{set:function(r){if(!e.isBuffer(r))throw new Error("Arg should be a buffer");var t=r[0];this._compressed=4!==t,this._pub=r},get:function(){return this._pub}}),Object.defineProperty(o.prototype,"compressed",{set:function(r){var n=this._compressed;if(this._compressed=!!r,n!=this._compressed){{this._pub}if(this._pub)if(this._compressed){var o=this._pub.slice(1,33),u=this._pub.slice(33,65),p=new t(o),c=new t(u),f=new s(p,c);this._pub=f.toCompressedPubKey()}else{var h=i.curves.secp256k1,o=this._pub.slice(1,33),a=3==this._pub[0]?!0:!1,f=h.curve.pointFromX(a,o),u=new e(f.y.toArray()),y=new t(o),v=new t(u),b=new s(y,v);this._pub=b.toUncompressedPubKey()}!this._compressed}},get:function(){return this._compressed}}),o.generateSync=function(){for(var e,s=i.curves.secp256k1;;)if(e=r.getRandomBuffer(32),t.fromBuffer(e,{size:32}).cmp(s.n)<0)break;var n=new o;return n.private=e,n.regenerateSync(),n},o.prototype.regenerateSync=function(){if(!this.private)throw new Error("Key does not have a private key set");var e=i.curves.secp256k1,r=(e.g,e.g.mul(this.private)),n=new t(r.x.toArray()),o=new t(r.y.toArray()),u=new s(n,o);return this._pub=this.compressed?u.toCompressedPubKey():u.toUncompressedPubKey(),this},o.prototype.signSync=function(r){i.curves.secp256k1;if(!this.private)throw new Error("Key does not have a private key set");if(!e.isBuffer(r)||32!==r.length)throw new Error("Arg should be a 32 bytes hash buffer");var s=new t(this.private),n=o.sign(r,s),u=o.rs2DER(n.r,n.s);return u},o.prototype.verifySignature=function(e,r,t){try{var i=this.verifySignatureSync(e,r);t(null,i)}catch(s){t(s)}},o.prototype.verifySignatureSync=function(e,r){var t=new i.ec(i.curves.secp256k1),s=e.toString("hex"),n=this._pub.toString("hex"),r=r.toString("hex"),o=t.verify(s,r,n);return o},module.exports=o}).call(this,require("buffer").Buffer);
11 years ago
},{"../SecureRandom":"p4SiC2","../common/Key":71,"./Point":"6tXgqr","bignum":59,"buffer":93,"elliptic":131,"util":126}],"EYpU62":[function(require,module,exports){
(function(e){"use strict";var t=(require("./Key"),require("jsrsasign")),r=(require("assert"),require("../common/PayPro")),i=require("../common/RootCerts");r.prototype.x509Sign=function(a){var o=this.get("pki_type"),n=this.get("pki_data");n=r.X509Certificates.decode(n),n=n.certificate;var s=o.split("+")[1].toUpperCase(),p=this.serializeForSig(),c=([].concat(n).every(function(e){var r=e.toString("hex"),a=t.asn1.ASN1Util.getPEMStringFromHex(r,"CERTIFICATE");return i.isTrusted(a)}),new t.RSAKey);c.readPrivateKeyFromPEMString(a.toString()),a=c;var g=new t.crypto.Signature({alg:s.toUpperCase()+"withRSA",prov:"cryptojs/jsrsa"});g.init(a),g.updateHex(p.toString("hex"));var u=new e(g.sign(),"hex");return u},r.prototype.x509Verify=function(){var e=this.get("signature"),a=this.get("pki_type"),o=this.get("pki_data");o=r.X509Certificates.decode(o),o=o.certificate;var n=this.serializeForSig(),s=a.split("+")[1].toUpperCase(),p=new t.crypto.Signature({alg:s.toUpperCase()+"withRSA",prov:"cryptojs/jsrsa"});return[].concat(o).every(function(r){var a=r.toString("hex"),o=t.asn1.ASN1Util.getPEMStringFromHex(a,"CERTIFICATE");return!i.isTrusted(o),p.initVerifyByCertificatePEM(o),p.updateHex(n.toString("hex")),p.verify(e.toString("hex"))})},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../common/PayPro":72,"../common/RootCerts":74,"./Key":"ALJ4PS","assert":90,"buffer":93,"jsrsasign":160}],"./lib/PayPro":[function(require,module,exports){
module.exports=require('EYpU62');
},{}],"6tXgqr":[function(require,module,exports){
(function(e){"use strict";var r=(require("./Key"),require("bignum")),u=(require("assert"),require("elliptic")),i=require("../common/Point");i.add=function(e,r){var t=u.curves.secp256k1,n=t.curve.point(e.x,e.y),s=t.curve.point(r.x,r.y),c=n.add(s),f=new i(c.x,c.y);return f},i.multiply=function(t,n){if(e.isBuffer(n)&&32!==n.length)throw new Error("if x is a buffer, it must be 32 bytes");var s=u.curves.secp256k1,c=s.curve.point(t.x,t.y);"string"==typeof n&&(n=new r(n));var f=c.mul(n),o=new i(f.x,f.y);return o},module.exports=i}).call(this,require("buffer").Buffer);
11 years ago
},{"../common/Point":73,"./Key":"ALJ4PS","assert":90,"bignum":59,"buffer":93,"elliptic":131}],"./lib/Point":[function(require,module,exports){
module.exports=require('6tXgqr');
},{}],"p4SiC2":[function(require,module,exports){
(function(o){var r=require("../common/SecureRandom");r.getRandomBuffer=function(r){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var e=window.msCrypto}var n=new Uint8Array(r);e.getRandomValues(n);var w=new o(n);return w},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"../common/SecureRandom":75,"buffer":93}],"./lib/SecureRandom":[function(require,module,exports){
module.exports=require('p4SiC2');
11 years ago
},{}],70:[function(require,module,exports){
(function(e){"use strict";var r=require("../../util"),t=require("../Point"),i=require("../SecureRandom"),n=require("../Key"),c=function(){};c.encryptObj=function(e,r,t,n){var s=new c;s.KB=e,s.message=r,t=s.getRandomSeed(t);var o=(s.R,s.S=s.getSfromPubkey()),u=c.kdf(o),a=s.kE=u.slice(0,32),p=s.kM=u.slice(32,64);n=n||i.getRandomBuffer(16);{var f=s.c=c.symmetricEncrypt(a,n,r);s.d=c.mac(p,f)}return s},c.encrypt=function(r,t,i,s){var o=c.encryptObj(r,t,i,s),u=new n;u.compressed=!1,u.public=o.R.toUncompressedPubKey(),u.compressed=!0;var a=u.public,p=e.concat([a,o.c,o.d]);return p},c.decryptObj=function(e){var r=e.kB,i=e.R,n=e.c,s=e.d,o=t.multiply(i,r),u=o.x.toBuffer({size:32}),a=c.kdf(u),p=e.kE=a.slice(0,32),f=e.kM=a.slice(32,64),y=c.mac(f,n);if(s.toString("hex")!==y.toString("hex"))throw new Error("MAC check incorrect. Data is invalid.");var h=c.symmetricDecrypt(p,n);return h},c.decrypt=function(e,r){if(r.length<97)throw new Error("invalid length of encrypted data");var i=new c;i.kB=e;var s=r.slice(0,33),o=new n;return o.public=s,o.compressed=!1,i.R=t.fromUncompressedPubKey(o.public),i.c=r.slice(33,r.length-64),i.d=r.slice(r.length-64,r.length),c.decryptObj(i)},c.kdf=function(e){var t=r.sha512(e);return t},c.mac=function(e,t){var i=r.sha512hmac(e,t);return i},c.prototype.getRandomSeed=function(e){return e?(this.key=new n,this.key.private=e,this.key.regenerateSync()):this.key=n.generateSync(),this.r=this.key.private,this.key.compressed=!1,this.R=t.fromUncompressedPubKey(this.key.public),this.r},c.prototype.getSfromPubkey=function(){var e=new n;e.public=this.KB,e.compressed=!1;var r=t.fromUncompressedPubKey(e.public);return this.P=t.multiply(r,this.r),this.S=this.P.x.toBuffer({size:32}),this.S},c.prototype.getSfromPrivkey=function(){var e=this.R,r=this.kB,i=t.multiply(e,r),n=i.x.toBuffer({size:32});return n},module.exports=c}).call(this,require("buffer").Buffer);
11 years ago
},{"../../util":189,"../Key":"ALJ4PS","../Point":"6tXgqr","../SecureRandom":"p4SiC2","buffer":93}],71:[function(require,module,exports){
(function(r){var e=require("bignum"),n=require("./Point"),t=require("./SecureRandom"),o=function(){};o.parseDERsig=function(n){if(!r.isBuffer(n))throw new Error("DER formatted signature should be a buffer");var t=n[0];if(48!==t)throw new Error("Header byte should be 0x30");var o=n[1];if(o!==n.slice(2).length)throw new Error("Length byte should length of what follows");var f=n[2];if(2!==f)throw new Error("Integer byte for r should be 0x02");var u=n[3],i=n.slice(4,4+u),h=e.fromBuffer(i),a=0===n[4]?!0:!1;if(u!==i.length)throw new Error("Length of r incorrect");var g=n[4+u+0];if(2!==g)throw new Error("Integer byte for s should be 0x02");var l=n[4+u+1],w=n.slice(4+u+2,4+u+2+l),s=e.fromBuffer(w),c=0===n[4+u+2+2]?!0:!1;if(l!==w.length)throw new Error("Length of s incorrect");var d=4+u+2+l;if(o!==d-2)throw new Error("Length of signature incorrect");var m={header:t,length:o,rheader:f,rlength:u,rneg:a,rbuf:i,r:h,sheader:g,slength:l,sneg:c,sbuf:w,s:s};return m},o.rs2DER=function(e,n){var t=e.toBuffer(),o=n.toBuffer(),f=128&t[0]?!0:!1,u=128&o[0]?!0:!1,i=f?r.concat([new r([0]),t]):t,h=u?r.concat([new r([0]),o]):o,a=2+i.length+2+h.length,g=i.length,l=h.length,w=2,s=2,c=48,d=r.concat([new r([c,a,w,g]),i,new r([s,l]),h]);return d},o.sign=function(r,t,f){var u=t,i=n.getN(),h=new e(r);do var f=f||o.genk(),a=n.getG(),g=n.multiply(a,f),l=g.x.mod(i),w=f.invm(i).mul(h.add(u.mul(l))).mod(i);while(l.cmp(new e(0))<=0||w.cmp(new e(0))<=0);return{r:l,s:w}},o.genk=function(){return new e(t.getRandomBuffer(8))},module.exports=o}).call(this,require("buffer").Buffer);
11 years ago
},{"./Point":73,"./SecureRandom":75,"bignum":59,"buffer":93}],72:[function(require,module,exports){
(function(e){"use strict";function t(){this.messageType=null,this.message=null}{var i=require("protobufjs/dist/ProtoBuf"),r=require("../Message");require("../common/RootCerts")}t.PAYMENT_REQUEST_MAX_SIZE=5e4,t.PAYMENT_MAX_SIZE=5e4,t.PAYMENT_ACK_MAX_SIZE=6e4,t.PAYMENT_REQUEST_CONTENT_TYPE="application/bitcoin-paymentrequest",t.PAYMENT_CONTENT_TYPE="application/bitcoin-payment",t.PAYMENT_ACK_CONTENT_TYPE="application/bitcoin-paymentack",t.proto={},t.proto.Output="message Output { optional uint64 amount = 1 [default = 0]; optional bytes script = 2;}\n",t.proto.PaymentDetails='message PaymentDetails { optional string network = 1 [default = "main"]; repeated Output outputs = 2; required uint64 time = 3; optional uint64 expires = 4; optional string memo = 5; optional string payment_url = 6; optional bytes merchant_data = 7;}\n',t.proto.PaymentRequest='message PaymentRequest { optional uint32 payment_details_version = 1 [default = 1]; optional string pki_type = 2 [default = "none"]; optional bytes pki_data = 3; required bytes serialized_payment_details = 4; optional bytes signature = 5;}\n',t.proto.Payment="message Payment { optional bytes merchant_data = 1; repeated bytes transactions = 2; repeated Output refund_to = 3; optional string memo = 4;}\n",t.proto.PaymentACK="message PaymentACK { required Payment payment = 1; optional string memo = 2;}\n",t.proto.X509Certificates="message X509Certificates { repeated bytes certificate = 1;}\n",t.proto.all="",t.proto.all=t.proto.all+t.proto.Output,t.proto.all=t.proto.all+t.proto.PaymentDetails,t.proto.all=t.proto.all+t.proto.PaymentRequest,t.proto.all=t.proto.all+t.proto.Payment,t.proto.all=t.proto.all+t.proto.PaymentACK,t.proto.all=t.proto.all+t.proto.X509Certificates,t.builder=i.loadProto(t.proto.all),t.Output=t.builder.build("Output"),t.PaymentDetails=t.builder.build("PaymentDetails"),t.PaymentRequest=t.builder.build("PaymentRequest"),t.Payment=t.builder.build("Payment"),t.PaymentACK=t.builder.build("PaymentACK"),t.X509Certificates=t.builder.build("X509Certificates"),t.prototype.makeOutput=function(e){return this.messageType="Output",this.message=new t.Output,this.setObj(e),this},t.prototype.makePaymentDetails=function(e){return this.messageType="PaymentDetails",this.message=new t.PaymentDetails,this.setObj(e),this},t.prototype.makePaymentRequest=function(e){return this.messageType="PaymentRequest",this.message=new t.PaymentRequest,this.setObj(e),this},t.prototype.makePayment=function(e){return this.messageType="Payment",this.message=new t.Payment,this.setObj(e),this},t.prototype.makePaymentACK=function(e){return this.messageType="PaymentACK",this.message=new t.PaymentACK,this.setObj(e),this},t.prototype.makeX509Certificates=function(e){return this.messageType="X509Certificates",this.message=new t.X509Certificates,this.setObj(e),this},t.prototype.isValidSize=function(){var e=this.serialize();return"PaymentRequest"==this.messageType?e.length<t.PAYMENT_REQUEST_MAX_SIZE:"Payment"==this.messageType?e.length<t.PAYMENT_MAX_SIZE:"PaymentACK"==this.messageType?e.length<t.PAYMENT_ACK_MAX_SIZE:!0},t.prototype.getContentType=function(){if("PaymentRequest"==this.messageType)return t.PAYMENT_REQUEST_CONTENT_TYPE;if("Payment"==this.messageType)return t.PAYMENT_CONTENT_TYPE;if("PaymentACK"==this.messageType)return t.PAYMENT_ACK_CONTENT_TYPE;throw new Error("No known content type for this message type")},t.prototype.set=function(e,t){return this.message.set(e,t),this},t.prototype.get=function(t){var i=this.message.get(t);if(null===i)return i;if("undefined"!=typeof i.low&&"undefined"!=typeof i.high)return i.toInt();if("undefined"!=typeof i.toBuffer){var r=i.toBuffer();return e.isBuffer(r)?r:new e(new Uint8Array(r))}return i},t.prototype.setObj=function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];this.message.set(t,i)}return this},t.prototype.serializeForSig=function(){if("PaymentRequest"!==this.messageType)throw new Error("serializeForSig is only for PaymentRequest");var t=this.message.get("signature");this.message.set("signature",new e([]));var i=this.serialize();retu
11 years ago
},{"../Message":"CBDCgz","../common/RootCerts":74,"buffer":93,"protobufjs/dist/ProtoBuf":166}],73:[function(require,module,exports){
(function(e){var r=require("bignum"),F=function(e,r){this.x=e,this.y=r},f=r.fromBuffer(new e("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex"),{size:32});F.getN=function(){return f};var t;F.getG=function(){return t=t||new F(r.fromBuffer(new e("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex"),{size:32}),r.fromBuffer(new e("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex"),{size:32}))},F.fromUncompressedPubKey=function(e){var f=new F;return f.x=r.fromBuffer(e.slice(1,33),{size:32}),f.y=r.fromBuffer(e.slice(33,65),{size:32}),f},F.prototype.toUncompressedPubKey=function(){var r=this.x.toBuffer({size:32}),F=this.y.toBuffer({size:32}),f=new e([4]),t=e.concat([f,r,F]);return t},F.prototype.toCompressedPubKey=function(){var r=this.x.toBuffer({size:32}),F=this.y.toBuffer({size:32});if(F[F.length-1]%2)var f=e.concat([new e([3]),r]);else var f=e.concat([new e([2]),r]);return f},module.exports=F}).call(this,require("buffer").Buffer);
11 years ago
},{"bignum":59,"buffer":93}],74:[function(require,module,exports){
function isTrusted(A){return A+="",A=A.replace(/\s+/g,""),!!RootCerts[A]}var RootCerts=["-----BEGIN CERTIFICATE-----\nMIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9H\nVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5j\nLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAw\nWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0\naW9uMScwJQYDVQQLEx5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMT\nGkdURSBDeWJlclRydXN0IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\ngQCVD6C28FCc6HrHiM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwef\nU/ltWJTSr41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4\n04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR\n22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq\n81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0PlZPvy5TYnh+dXIVtx6quTx8i\ntc2VrbqnzPmrC3p/\n-----END CERTIFICATE-----\n","-----BEGIN CERTIFICATE-----\nMIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNV\nBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUg\nQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lv\nbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNl\ncnRzQHRoYXd0ZS5jb20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkG\nA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0w\nGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT\nZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3\nDQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ\nAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC\n6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCXL+eQbcAoQpnXTEPew/UhbVSf\nXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJ\nKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllD\nfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAb\ni8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc=\n-----END CERTIFICATE-----\n","-----BEGIN CERTIFICATE-----\nMIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNV\nBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUg\nQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lv\nbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlw\ncmVtaXVtLXNlcnZlckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1\nOVowgc4xCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNh\ncGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRp\nZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl\ncnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzAN\nBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhI\nNTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQug2SBhRz1JPLlyoAnFxODLz6\nFVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/qgeN9EJN50CdHDcCAwEAAaMTMBEw\nDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJ\neGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu\n1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcU\nQg==\n-----END CERTIFICATE-----\n","-----BEGIN CERTIFICATE-----\nMIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4G\nA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0\naG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMx\nEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRl\nIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2R\nFGiYCh7+2gRvE4RiIcPRfM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP\n/PvwDN1Dulsr4R+AcJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/\nFP3gx7kCAwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ\nMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUg\nQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjAL\nBgNVHQ8EBAMCAQYwHwYDVR0jBB
RootCerts=RootCerts.reduce(function(A,B){return B=B.replace(/\s+/g,""),A[B]=!0,A},{}),exports=RootCerts,exports.isTrusted=isTrusted,module.exports=exports;
11 years ago
},{}],75:[function(require,module,exports){
(function(f){var e=function(){};e.getRandomBuffer=function(){},e.getPseudoRandomBuffer=function(e){for(var n=4294967296,o=new f(e),u=0;e>=u;u++){var t=Math.floor(u/4),a=u-4*t;0==a?(r=Math.random()*n,o[u]=255&r):o[u]=255&(r>>>=8)}return o},module.exports=e}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93}],"oLMOpG":[function(require,module,exports){
"use strict";function l(t){throw t}function aa(t,e,s){4!==e.length&&l(new sjcl.exception.invalid("invalid aes block size"));var i=t.a[s],n=e[0]^i[0],c=e[s?3:1]^i[1],r=e[2]^i[2];e=e[s?1:3]^i[3];var o,a,h,u,d=i.length/4-2,p=4,f=[0,0,0,0];o=t.m[s],t=o[0];var m=o[1],j=o[2],g=o[3],y=o[4];for(u=0;d>u;u++)o=t[n>>>24]^m[c>>16&255]^j[r>>8&255]^g[255&e]^i[p],a=t[c>>>24]^m[r>>16&255]^j[e>>8&255]^g[255&n]^i[p+1],h=t[r>>>24]^m[e>>16&255]^j[n>>8&255]^g[255&c]^i[p+2],e=t[e>>>24]^m[n>>16&255]^j[c>>8&255]^g[255&r]^i[p+3],p+=4,n=o,c=a,r=h;for(u=0;4>u;u++)f[s?3&-u:u]=y[n>>>24]<<24^y[c>>16&255]<<16^y[r>>8&255]<<8^y[255&e]^i[p++],o=n,n=c,c=r,r=e,e=o;return f}function ca(t,e){var s,i=sjcl.random.A[t],n=[];for(s in i)i.hasOwnProperty(s)&&n.push(i[s]);for(s=0;s<n.length;s++)n[s](e)}function U(t){window&&window.performance&&"function"==typeof window.performance.now?sjcl.random.addEntropy(window.performance.now(),t,"loadtime"):sjcl.random.addEntropy((new Date).valueOf(),t,"loadtime")}function ba(t){t.a=S(t).concat(S(t)),t.B=new sjcl.cipher.aes(t.a)}function S(t){for(var e=0;4>e&&(t.i[e]=t.i[e]+1|0,!t.i[e]);e++);return t.B.encrypt(t.i)}function T(t,e){return function(){e.apply(t,arguments)}}var s=void 0,v=!1,sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(t){this.toString=function(){return"CORRUPT: "+this.message},this.message=t},invalid:function(t){this.toString=function(){return"INVALID: "+this.message},this.message=t},bug:function(t){this.toString=function(){return"BUG: "+this.message},this.message=t},notReady:function(t){this.toString=function(){return"NOT READY: "+this.message},this.message=t}}};"undefined"!=typeof module&&module.exports&&(module.exports=sjcl),sjcl.cipher.aes=function(t){this.m[0][0][0]||this.q();var e,s,i,n,c=this.m[0][4],r=this.m[1];e=t.length;var o=1;for(4!==e&&6!==e&&8!==e&&l(new sjcl.exception.invalid("invalid aes key size")),this.a=[i=t.slice(0),n=[]],t=e;4*e+28>t;t++)s=i[t-1],(0===t%e||8===e&&4===t%e)&&(s=c[s>>>24]<<24^c[s>>16&255]<<16^c[s>>8&255]<<8^c[255&s],0===t%e&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7))),i[t]=i[t-e]^s;for(e=0;t;e++,t--)s=i[3&e?t:t-4],n[e]=4>=t||4>e?s:r[0][c[s>>>24]]^r[1][c[s>>16&255]]^r[2][c[s>>8&255]]^r[3][c[255&s]]},sjcl.cipher.aes.prototype={encrypt:function(t){return aa(this,t,0)},decrypt:function(t){return aa(this,t,1)},m:[[[],[],[],[],[]],[[],[],[],[],[]]],q:function(){var t,e,s,i,n,c,r,o=this.m[0],a=this.m[1],l=o[4],h=a[4],u=[],d=[];for(t=0;256>t;t++)d[(u[t]=t<<1^283*(t>>7))^t]=t;for(e=s=0;!l[e];e^=i||1,s=d[s]||1)for(c=s^s<<1^s<<2^s<<3^s<<4,c=c>>8^255&c^99,l[e]=c,h[c]=e,n=u[t=u[i=u[e]]],r=16843009*n^65537*t^257*i^16843008*e,n=257*u[c]^16843008*c,t=0;4>t;t++)o[t][e]=n=n<<24^n>>>8,a[t][c]=r=r<<24^r>>>8;for(t=0;5>t;t++)o[t]=o[t].slice(0),a[t]=a[t].slice(0)}},sjcl.bitArray={bitSlice:function(t,e,i){return t=sjcl.bitArray.O(t.slice(e/32),32-(31&e)).slice(1),i===s?t:sjcl.bitArray.clamp(t,i-e)},extract:function(t,e,s){var i=Math.floor(-e-s&31);return(-32&(e+s-1^e)?t[e/32|0]<<32-i^t[e/32+1|0]>>>i:t[e/32|0]>>>i)&(1<<s)-1},concat:function(t,e){if(0===t.length||0===e.length)return t.concat(e);var s=t[t.length-1],i=sjcl.bitArray.getPartial(s);return 32===i?t.concat(e):sjcl.bitArray.O(e,i,0|s,t.slice(0,t.length-1))},bitLength:function(t){var e=t.length;return 0===e?0:32*(e-1)+sjcl.bitArray.getPartial(t[e-1])},clamp:function(t,e){if(32*t.length<e)return t;t=t.slice(0,Math.ceil(e/32));var s=t.length;return e&=31,s>0&&e&&(t[s-1]=sjcl.bitArray.partial(e,t[s-1]&2147483648>>e-1,1)),t},partial:function(t,e,s){return 32===t?e:(s?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(sjcl.bitArray.bitLength(t)!==sjcl.bitArray.bitLength(e))return v;var s,i=0;for(s=0;s<t.length;s++)i|=t[s]^e[s];return 0===i},O:function(t,e,i,n){var c;for(c=0,n===s&&(n=[]);e>=32;e-=32)n.push(i),i=0;if(0===e)return n.concat(t);for(c=0;c<t.length;c++)n.push(i|t[c]>>>e),i=t[c]<<32-e;return c=t.length?t[t.length-1]:0,t=sjcl.bitArray.getPartial(c),n.push(sjcl.bitArray.partial(e+t&31,e+t>32?i:n.pop(),1)),n},t:function(t,e){return[t[0]
11 years ago
},{"crypto":97}],"./lib/sjcl":[function(require,module,exports){
module.exports=require('oLMOpG');
},{}],"ULNIu2":[function(require,module,exports){
(function(e){var t=(require("bufferput"),require("buffertools")),s=function(t){return new e(t,"hex")};exports.livenet={name:"livenet",magic:s("f9beb4d9"),addressVersion:0,privKeyVersion:128,P2SHVersion:5,hkeyPublicVersion:76067358,hkeyPrivateVersion:76066276,genesisBlock:{hash:s("6FE28C0AB6F1B372C1A6A246AE63F74F931E8365E15A089C68D6190000000000"),merkle_root:s("3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A"),height:0,nonce:2083236893,version:1,prev_hash:t.fill(new e(32),0),timestamp:1231006505,bits:486604799},dnsSeeds:["seed.bitcoin.sipa.be","dnsseed.bluematt.me","dnsseed.bitcoin.dashjr.org","seed.bitcoinstats.com","seed.bitnodes.io","bitseed.xf2.org"],defaultClientPort:8333},exports.mainnet=exports.livenet,exports.testnet={name:"testnet",magic:s("0b110907"),addressVersion:111,privKeyVersion:239,P2SHVersion:196,hkeyPublicVersion:70617039,hkeyPrivateVersion:70615956,genesisBlock:{hash:s("43497FD7F826957108F4A30FD9CEC3AEBA79972084E90EAD01EA330900000000"),merkle_root:s("3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A"),height:0,nonce:414098458,version:1,prev_hash:t.fill(new e(32),0),timestamp:1296688602,bits:486604799},dnsSeeds:["testnet-seed.bitcoin.petertodd.org","testnet-seed.bluematt.me"],defaultClientPort:18333}}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93,"bufferput":"aXRuS6","buffertools":"fugeBw"}],"./networks":[function(require,module,exports){
module.exports=require('ULNIu2');
11 years ago
},{}],80:[function(require,module,exports){
(function(n){!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(e,arguments)}}var e,r,u={};e=this,null!=e&&(r=e.async),u.noConflict=function(){return e.async=r,u};var i=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return i(n,function(n,r,u){e.push(t(n,r,u))}),e},o=function(n,t,e){return n.reduce?n.reduce(t,e):(i(n,function(n,r,u){e=t(e,n,r,u)}),e)},a=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof n&&n.nextTick?(u.nextTick=n.nextTick,u.setImmediate="undefined"!=typeof setImmediate?function(n){setImmediate(n)}:u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(n){setImmediate(n)},u.setImmediate=u.nextTick):(u.nextTick=function(n){setTimeout(n,0)},u.setImmediate=u.nextTick),u.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var u=0;i(n,function(i){e(i,t(function(t){t?(r(t),r=function(){}):(u+=1,u>=n.length&&r(null))}))})},u.forEach=u.each,u.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,u=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):u())})};u()},u.forEachSeries=u.eachSeries,u.eachLimit=function(n,t,e,r){var u=l(t);u.apply(null,[n,e,r])},u.forEachLimit=u.eachLimit;var l=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var u=0,i=0,c=0;!function o(){if(u>=t.length)return r();for(;n>c&&i<t.length;)i+=1,c+=1,e(t[i-1],function(n){n?(r(n),r=function(){}):(u+=1,c-=1,u>=t.length?r():o())})}()}},f=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.each].concat(t))}},s=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[l(n)].concat(e))}},p=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.eachSeries].concat(t))}},m=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){u[n.index]=r,t(e)})},function(n){r(n,u)})};u.map=f(m),u.mapSeries=p(m),u.mapLimit=function(n,t,e,r){return y(t)(n,e,r)};var y=function(n){return s(n,m)};u.reduce=function(n,t,e,r){u.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();u.reduce(i,t,e,r)},u.foldr=u.reduceRight;var h=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.filter=f(h),u.filterSeries=p(h),u.select=u.filter,u.selectSeries=u.filterSeries;var v=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.reject=f(v),u.rejectSeries=p(v);var d=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};u.detect=f(d),u.detectSeries=p(d),u.some=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},u.any=u.some,u.every=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},u.all=u.every,u.sortBy=function(n,t,e){u.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},u.auto=function(n,t){t=t||function(){};var e=a(n);if(!e.length)return t(null);var r={},c=[],l=function(n){c.unshift(n)},f=function(n){for(var t=0;t<c.length;t+=1)if(c[t]===n)return void c.splice(t,1)},s=function(){i(c.slice(0),function(n){n()})};l(function(){a(r).length===e.length&&(
11 years ago
},{"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110}],81:[function(require,module,exports){
(function(t){function n(t){for(var n=0,e=0;e<t.length;e++)n+=Math.pow(256,e)*t[e];return n}function e(t){for(var n=0,e=0;e<t.length;e++)n+=Math.pow(256,t.length-e-1)*t[e];return n}function r(t){var n=e(t);return 128==(128&t[0])&&(n-=Math.pow(256,t.length)),n}function o(t){var e=n(t);return 128==(128&t[t.length-1])&&(e-=Math.pow(256,t.length)),e}function i(t){var i={};return[1,2,4,8].forEach(function(u){var s=8*u;i["word"+s+"le"]=i["word"+s+"lu"]=t(u,n),i["word"+s+"ls"]=t(u,o),i["word"+s+"be"]=i["word"+s+"bu"]=t(u,e),i["word"+s+"bs"]=t(u,r)}),i.word8=i.word8u=i.word8be,i.word8s=i.word8bs,i}var u=require("chainsaw"),s=require("events").EventEmitter,f=require("buffers"),c=require("./lib/vars.js"),l=require("stream").Stream;exports=module.exports=function(n,e){if(t.isBuffer(n))return exports.parse(n);var r=exports.stream();return n&&n.pipe?n.pipe(r):n&&(n.on(e||"data",function(t){r.write(t)}),n.on("end",function(){r.end()})),r},exports.stream=function(n){function e(t,n,e){a={bytes:t,skip:e,cb:function(t){a=null,n(t)}},r()}function r(){if(!a)return void(b&&(w=!0));if("function"==typeof a)a();else{var t=p+a.bytes;if(g.length>=t){var n;null==p?(n=g.splice(0,t),a.skip||(n=n.slice())):(a.skip||(n=g.slice(p,t)),p=t),a.skip?a.cb():a.cb(n)}}}function o(n){function o(){w||n.next()}var u=i(function(t,n){return function(r){e(t,function(t){v.set(r,n(t)),o()})}});return u.tap=function(t){n.nest(t,v.store)},u.into=function(t,e){v.get(t)||v.set(t,{});var r=v;v=c(r.get(t)),n.nest(function(){e.apply(this,arguments),this.tap(function(){v=r})},v.store)},u.flush=function(){v.store={},o()},u.loop=function(t){var e=!1;n.nest(!1,function r(){this.vars=v.store,t.call(this,function(){e=!0,o()},v.store),this.tap(function(){e?n.next():r.call(this)}.bind(this))},v.store)},u.buffer=function(t,n){"string"==typeof n&&(n=v.get(n)),e(n,function(n){v.set(t,n),o()})},u.skip=function(t){"string"==typeof t&&(t=v.get(t)),e(t,function(){o()})},u.scan=function(n,e){if("string"==typeof e)e=new t(e);else if(!t.isBuffer(e))throw new Error("search must be a Buffer or a string");var i=0;a=function(){var t=g.indexOf(e,p+i),u=t-p-i;-1!==t?(a=null,null!=p?(v.set(n,g.slice(p,p+i+u)),p+=i+u+e.length):(v.set(n,g.slice(0,i+u)),g.splice(0,i+u+e.length)),o(),r()):u=Math.max(g.length-e.length-p-i,0),i+=u},r()},u.peek=function(t){p=0,n.nest(function(){t.call(this,v.store),this.tap(function(){p=null})})},u}if(n)return exports.apply(null,arguments);var a=null,p=null,h=u.light(o);h.writable=!0;var g=f();h.write=function(t){g.push(t),r()};var v=c(),w=!1,b=!1;return h.end=function(){b=!0},h.pipe=l.prototype.pipe,Object.getOwnPropertyNames(s.prototype).forEach(function(t){h[t]=s.prototype[t]}),h},exports.parse=function(n){var e=i(function(t,i){return function(u){if(r+t<=n.length){var s=n.slice(r,r+t);r+=t,o.set(u,i(s))}else o.set(u,null);return e}}),r=0,o=c();return e.vars=o.store,e.tap=function(t){return t.call(e,o.store),e},e.into=function(t,n){o.get(t)||o.set(t,{});var r=o;return o=c(r.get(t)),n.call(e,o.store),o=r,e},e.loop=function(t){for(var n=!1,r=function(){n=!0};n===!1;)t.call(e,r,o.store);return e},e.buffer=function(t,i){"string"==typeof i&&(i=o.get(i));var u=n.slice(r,Math.min(n.length,r+i));return r+=i,o.set(t,u),e},e.skip=function(t){return"string"==typeof t&&(t=o.get(t)),r+=t,e},e.scan=function(i,u){if("string"==typeof u)u=new t(u);else if(!t.isBuffer(u))throw new Error("search must be a Buffer or a string");o.set(i,null);for(var s=0;s+r<=n.length-u.length+1;s++){for(var f=0;f<u.length&&n[r+s+f]===u[f];f++);if(f===u.length)break}return o.set(i,n.slice(r,r+s)),r+=s+u.length,e},e.peek=function(t){var n=r;return t.call(e,o.store),r=n,e},e.flush=function(){return o.store={},e},e.eof=function(){return r>=n.length},e}}).call(this,require("buffer").Buffer);
11 years ago
},{"./lib/vars.js":82,"buffer":93,"buffers":"OBo3aV","chainsaw":83,"events":"T9Wsc/","stream":117}],82:[function(require,module,exports){
module.exports=function(t){function n(t,n){var e=r.store,o=t.split(".");o.slice(0,-1).forEach(function(t){void 0===e[t]&&(e[t]={}),e=e[t]});var u=o[o.length-1];return 1==arguments.length?e[u]:e[u]=n}var r={get:function(t){return n(t)},set:function(t,r){return n(t,r)},store:t||{}};return r};
11 years ago
},{}],83:[function(require,module,exports){
(function(n){function t(n){var e=t.saw(n,{}),r=n.call(e.handlers,e);return void 0!==r&&(e.handlers=r),e.record(),e.chain()}function e(n){n.step=0,n.pop=function(){return n.actions[n.step++]},n.trap=function(t,e){var r=Array.isArray(t)?t:[t];n.actions.push({path:r,step:n.step,cb:e,trap:!0})},n.down=function(t){var e=(Array.isArray(t)?t:[t]).join("/"),r=n.actions.slice(n.step).map(function(t){return t.trap&&t.step<=n.step?!1:t.path.join("/")==e}).indexOf(!0);r>=0?n.step+=r:n.step=n.actions.length;var a=n.actions[n.step-1];a&&a.trap?(n.step=a.step,a.cb()):n.next()},n.jump=function(t){n.step=t,n.next()}}var r=require("traverse"),a=require("events").EventEmitter;module.exports=t,t.light=function(n){var e=t.saw(n,{}),r=n.call(e.handlers,e);return void 0!==r&&(e.handlers=r),e.chain()},t.saw=function(o,s){var i=new a;return i.handlers=s,i.actions=[],i.chain=function(){var t=r(i.handlers).map(function(n){if(this.isRoot)return n;var e=this.path;"function"==typeof n&&this.update(function(){return i.actions.push({path:e,args:[].slice.call(arguments)}),t})});return n.nextTick(function(){i.emit("begin"),i.next()}),t},i.pop=function(){return i.actions.shift()},i.next=function(){var n=i.pop();if(n){if(!n.trap){var t=i.handlers;n.path.forEach(function(n){t=t[n]}),t.apply(i.handlers,n.args)}}else i.emit("end")},i.nest=function(n){var e=[].slice.call(arguments,1),r=!0;if("boolean"==typeof n){var r=n;n=e.shift()}var a=t.saw(o,{}),s=o.call(a.handlers,a);void 0!==s&&(a.handlers=s),"undefined"!=typeof i.step&&a.record(),n.apply(a.chain(),e),r!==!1&&a.on("end",i.next)},i.record=function(){e(i)},["trap","down","jump"].forEach(function(n){i[n]=function(){throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.")}}),i}}).call(this,require("/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
11 years ago
},{"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"events":"T9Wsc/","traverse":84}],84:[function(require,module,exports){
function Traverse(e){return this instanceof Traverse?void(this.value=e):new Traverse(e)}function walk(e,t,r){var n=[],o=[],a=!0;return function i(e){var c=r?copy(e):e,s={},f={node:c,node_:e,path:[].concat(n),parent:o.slice(-1)[0],key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(e){f.isRoot||(f.parent.node[f.key]=e),f.node=e},"delete":function(){delete f.parent.node[f.key]},remove:function(){Array.isArray(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key]},before:function(e){s.before=e},after:function(e){s.after=e},pre:function(e){s.pre=e},post:function(e){s.post=e},stop:function(){a=!1}};if(!a)return f;if("object"==typeof c&&null!==c){f.isLeaf=0==Object.keys(c).length;for(var u=0;u<o.length;u++)if(o[u].node_===e){f.circular=o[u];break}}else f.isLeaf=!0;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot;var l=t.call(f,f.node);if(void 0!==l&&f.update&&f.update(l),s.before&&s.before.call(f,f.node),"object"==typeof f.node&&null!==f.node&&!f.circular){o.push(f);var p=Object.keys(f.node);p.forEach(function(e,t){n.push(e),s.pre&&s.pre.call(f,f.node[e],e);var o=i(f.node[e]);r&&Object.hasOwnProperty.call(f.node,e)&&(f.node[e]=o.node),o.isLast=t==p.length-1,o.isFirst=0==t,s.post&&s.post.call(f,o),n.pop()}),o.pop()}return s.after&&s.after.call(f,f.node),f}(e).node}function copy(e){if("object"==typeof e&&null!==e){var t;return t=Array.isArray(e)?[]:e instanceof Date?new Date(e):e instanceof Boolean?new Boolean(e):e instanceof Number?new Number(e):e instanceof String?new String(e):Object.create(Object.getPrototypeOf(e)),Object.keys(e).forEach(function(r){t[r]=e[r]}),t}return e}module.exports=Traverse,Traverse.prototype.get=function(e){for(var t=this.value,r=0;r<e.length;r++){var n=e[r];if(!Object.hasOwnProperty.call(t,n)){t=void 0;break}t=t[n]}return t},Traverse.prototype.set=function(e,t){for(var r=this.value,n=0;n<e.length-1;n++){var o=e[n];Object.hasOwnProperty.call(r,o)||(r[o]={}),r=r[o]}return r[e[n]]=t,t},Traverse.prototype.map=function(e){return walk(this.value,e,!0)},Traverse.prototype.forEach=function(e){return this.value=walk(this.value,e,!1),this.value},Traverse.prototype.reduce=function(e,t){var r=1===arguments.length,n=r?this.value:t;return this.forEach(function(t){this.isRoot&&r||(n=e.call(this,n,t))}),n},Traverse.prototype.deepEqual=function(e){if(1!==arguments.length)throw new Error("deepEqual requires exactly one object to compare against");var t=!0,r=e;return this.forEach(function(n){var o=function(){return void(t=!1)}.bind(this);if(!this.isRoot){if("object"!=typeof r)return o();r=r[this.key]}var a=r;this.post(function(){r=a});var i=function(e){return Object.prototype.toString.call(e)};if(this.circular)Traverse(e).get(this.circular.path)!==a&&o();else if(typeof a!=typeof n)o();else if(null===a||null===n||void 0===a||void 0===n)a!==n&&o();else if(a.__proto__!==n.__proto__)o();else if(a===n);else if("function"==typeof a)a instanceof RegExp?a.toString()!=n.toString()&&o():a!==n&&o();else if("object"==typeof a)if("[object Arguments]"===i(n)||"[object Arguments]"===i(a))i(a)!==i(n)&&o();else if(a instanceof Date||n instanceof Date)a instanceof Date&&n instanceof Date&&a.getTime()===n.getTime()||o();else{var c=Object.keys(a),s=Object.keys(n);if(c.length!==s.length)return o();for(var f=0;f<c.length;f++){var u=c[f];Object.hasOwnProperty.call(n,u)||o()}}}),t},Traverse.prototype.paths=function(){var e=[];return this.forEach(function(){e.push(this.path)}),e},Traverse.prototype.nodes=function(){var e=[];return this.forEach(function(){e.push(this.node)}),e},Traverse.prototype.clone=function(){var e=[],t=[];return function r(n){for(var o=0;o<e.length;o++)if(e[o]===n)return t[o];if("object"==typeof n&&null!==n){var a=copy(n);return e.push(n),t.push(a),Object.keys(n).forEach(function(e){a[e]=r(n[e])}),e.pop(),t.pop(),a}return n}(this.value)},Object.keys(Traverse.prototype).forEach(function(e){Traverse[e]=function(t){var r=[].slice.call(arguments,1),n=Traverse(t);return n[e].apply(n,r)}});
11 years ago
},{}],85:[function(require,module,exports){
(function(e,r){function o(e){"string"==typeof e?e={bindings:e}:e||(e={}),e.__proto__=d,e.module_root||(e.module_root=exports.getRoot(exports.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var r,o,n,s=[],a=0,u=e.try.length;u>a;a++){r=t.apply(null,e.try[a].map(function(r){return e[r]||r})),s.push(r);try{return o=e.path?require.resolve(r):require(r),e.path||(o.path=r),o}catch(l){if(!/not find/i.test(l.message))throw l}}throw n=new Error("Could not locate the bindings file. Tried:\n"+s.map(function(r){return e.arrow+r}).join("\n")),n.tries=s,n}var n=require("fs"),i=require("path"),t=i.join,s=i.dirname,a=n.existsSync||i.existsSync,d={arrow:e.env.NODE_BINDINGS_ARROW||" → ",compiled:e.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:e.platform,arch:e.arch,version:e.versions.node,bindings:"bindings.node","try":[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"]]};module.exports=exports=o,exports.getFileName=function(){var e,o=Error.prepareStackTrace,n=Error.stackTraceLimit,i={};return Error.stackTraceLimit=10,Error.prepareStackTrace=function(o,n){for(var i=0,t=n.length;t>i;i++)if(e=n[i].getFileName(),e!==r)return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=o,Error.stackTraceLimit=n,e},exports.getRoot=function(r){for(var o,n=s(r);;){if("."===n&&(n=e.cwd()),a(t(n,"package.json"))||a(t(n,"node_modules")))return n;if(o===n)throw new Error('Could not find module root given file: "'+r+'". Do you have a `package.json` file? ');o=n,n=t(n,"..")}}}).call(this,require("/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/bindings/bindings.js");
11 years ago
},{"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"fs":89,"path":111}],86:[function(require,module,exports){
function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function assertEqual(t,i,r){if(t!=i)throw new Error(r||"Assertion failed: "+t+" != "+i)}function inherits(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function BN(t,i){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,void(null!==t&&this._init(t||0,i||10)))}function zero6(t){return 5===t.length?"0"+t:4===t.length?"00"+t:3===t.length?"000"+t:2===t.length?"0000"+t:1===t.length?"00000"+t:t}function zero14(t){return 13===t.length?"0"+t:12===t.length?"00"+t:11===t.length?"000"+t:10===t.length?"0000"+t:9===t.length?"00000"+t:8===t.length?"000000"+t:7===t.length?"0000000"+t:6===t.length?"00000000"+t:5===t.length?"000000000"+t:4===t.length?"0000000000"+t:3===t.length?"00000000000"+t:2===t.length?"000000000000"+t:1===t.length?"0000000000000"+t:t}function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new BN(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r.invm(this.m),this.minv=this.rinv.mul(this.r).sub(new BN(1)).div(this.m).neg().mod(this.r)}"object"==typeof module&&(module.exports=BN),BN.BN=BN,BN.wordSize=26,BN.prototype._init=function(t,i){if("number"==typeof t)return 0>t&&(this.sign=!0,t=-t),void(67108864>t?(this.words=[67108863&t],this.length=1):(this.words=[67108863&t,t/67108864&67108863],this.length=2));if("object"==typeof t){assert("number"==typeof t.length),this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var s=0,r=t.length-1,n=0;r>=0;r-=3){var e=t[r]|t[r-1]<<8|t[r-2]<<16;this.words[n]|=e<<s&67108863,this.words[n+1]=e>>>26-s&67108863,s+=24,s>=26&&(s-=26,n++)}return this.strip()}"hex"===i&&(i=16),assert(16>=i),t=t.toString().replace(/\s+/g,"");var o=0;"-"===t[0]&&o++,16===i?this._parseHex(t,o):this._parseBase(t,i,o),"-"===t[0]&&(this.sign=!0),this.strip()},BN.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var s=0,r=t.length-6,n=0;r>=i;r-=6){var e=parseInt(t.slice(r,r+6),16);this.words[n]|=e<<s&67108863,this.words[n+1]|=e>>>26-s&4194303,s+=24,s>=26&&(s-=26,n++)}if(r+6!==i){var e=parseInt(t.slice(i,r+6),16);this.words[n]|=e<<s&67108863,this.words[n+1]|=e>>>26-s&4194303}this.strip()},BN.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var s=0,n=1,e=0,o=null,h=r;h<t.length;h++){var f,d=t[h];f=10===i||"9">=d?0|d:d>="a"?d.charCodeAt(0)-97+10:d.charCodeAt(0)-65+10,s*=i,s+=f,n*=i,e++,n>1048575&&(assert(67108863>=n),o||(o=new BN(n)),this.mul(o).copy(this),this.iadd(new BN(s)),s=0,n=1,e=0)}0!==e&&(this.mul(new BN(n)).copy(this),this.iadd(new BN(s)))},BN.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.sign=this.sign,t.red=this.red},BN.prototype.clone=function(){var t=new BN(null);return this.copy(t),t},BN.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+
},{}],"buffertools":[function(require,module,exports){
module.exports=require('fugeBw');
},{}],"fugeBw":[function(require,module,exports){
(function(t){"use strict";function r(){this.writable=!0,this.buffer=null}var e=require("events"),n=require("util"),i={};module.exports.Buffer=t;var o=function(r){return r instanceof t||r instanceof Uint8Array},f=function(t){return function(){var r=this;if(o(r));else{if(!o(arguments[0]))throw new Error("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}return t.apply(r,arguments)}},u=function(t){return function(){var r=this;if(o(r));else{if(!o(arguments[0]))throw Error("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}var e=arguments[0];if("string"==typeof e||e instanceof String||o(e))return t.apply(r,arguments);throw new Error("Second argument must be a string or a buffer.")}};i.clear=f(function(){for(var t=0;t<this.length;t++)this[t]=0;return this}),i.fill=f(function(t){for(var r="undefined"==typeof t.length?1:t.length,e=0;e<this.length;e+=r)for(var n=0;r>n;n++)this[e+n]="undefined"==typeof t.length?t:"string"==typeof t[n]?t[n].charCodeAt(0):t[n];return this}),i.indexOf=f(function(t,r){if(r=r||0,0===t.length)return-1;for(var e=r;e<this.length-t.length+1;e+=1){for(var n=!0,i=0;i<t.length;i++){var o=this[e+i],f=t[i];if("string"==typeof f&&(f=f.charCodeAt(0)),o!==f){n=!1;break}}if(n)return e}return-1}),i.equals=u(function(t){return 0===i.compare(this,t)}),i.compare=u(function(t){var r=this,e=r.length,n=t.length;if(e!==n)return e>n?1:-1;for(var i=0;e>i;i++){var o=r[i],f=t[i];if("string"==typeof f&&(f=f.charCodeAt(0)),o!==f)return o>f?1:-1}return 0}),i.concat=function(){for(var r=0,e=0;e<arguments.length;e++){if(void 0===arguments[e].length)throw Error("all arguments must be strings or Buffers");r+=arguments[e].length}for(var n=new t(r),i=0,e=0;e<arguments.length;e++)for(var o=0;o<arguments[e].length;o++)n[i++]="string"==typeof arguments[e][o]?arguments[e][o].charCodeAt(0):arguments[e][o];return n},i.reverse=f(function(){for(var r=new t(this.length),e=0;e<this.length;e++)r[e]=this[this.length-e-1];return r}),i.toHex=f(function(){for(var t="",r=0;r<this.length;r++){var e=this[r].toString(16);1==e.length&&(e="0"+e),e.length>2&&(e=e.substring(1,3)),t+=e}return t}),i.fromHex=f(function(){var r=this.length;if(r%2!==0)throw new Error("Invalid hex string length");for(var e=new t(r/2),n=0;n<e.length;n++){var i=String.fromCharCode(this[2*n]),o=String.fromCharCode(this[2*n+1]);e[n]=parseInt(i+o,16)}return e}),exports.extend=function(){var r;r=arguments.length>0?Array.prototype.slice.call(arguments):"function"==typeof Uint8Array?[t.prototype,Uint8Array.prototype]:[t.prototype];for(var e=0,n=r.length;n>e;e+=1){var o=r[e];for(var f in i)o[f]=i[f];o!==exports&&(o.concat=function(){var t=[this].concat(Array.prototype.slice.call(arguments));return i.concat.apply(i,t)})}},exports.extend(exports),n.inherits(r,e.EventEmitter),r.prototype._append=function(r,e){if(!this.writable)throw new Error("Stream is not writable.");if(t.isBuffer(r));else{if("string"!=typeof r)throw new Error("Argument should be either a buffer or a string.");r=new t(r,e||"utf8")}this.buffer?this.buffer=i.concat(this.buffer,r):(this.buffer=new t(r.length),r.copy(this.buffer))},r.prototype.write=function(t,r){return this._append(t,r),!0},r.prototype.end=function(t,r){t&&this._append(t,r),this.emit("close"),this.writable=!1},r.prototype.getBuffer=function(){return this.buffer?this.buffer:new t(0)},r.prototype.toString=function(){return this.getBuffer().toString()},exports.WritableBufferStream=r}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93,"events":"T9Wsc/","util":126}],89:[function(require,module,exports){
11 years ago
},{}],90:[function(require,module,exports){
function replacer(t,e){return util.isUndefined(e)?""+e:!util.isNumber(e)||!isNaN(e)&&isFinite(e)?util.isFunction(e)||util.isRegExp(e)?e.toString():e:e.toString()}function truncate(t,e){return util.isString(t)?t.length<e?t:t.slice(0,e):t}function getMessage(t){return truncate(JSON.stringify(t.actual,replacer),128)+" "+t.operator+" "+truncate(JSON.stringify(t.expected,replacer),128)}function fail(t,e,r,i,s){throw new assert.AssertionError({message:r,actual:t,expected:e,operator:i,stackStartFunction:s})}function ok(t,e){t||fail(t,!0,e,"==",assert.ok)}function _deepEqual(t,e){if(t===e)return!0;if(util.isBuffer(t)&&util.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return util.isDate(t)&&util.isDate(e)?t.getTime()===e.getTime():util.isRegExp(t)&&util.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:util.isObject(t)||util.isObject(e)?objEquiv(t,e):t==e}function isArguments(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function objEquiv(t,e){if(util.isNullOrUndefined(t)||util.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(isArguments(t))return isArguments(e)?(t=pSlice.call(t),e=pSlice.call(e),_deepEqual(t,e)):!1;try{var r,i,s=objectKeys(t),n=objectKeys(e)}catch(a){return!1}if(s.length!=n.length)return!1;for(s.sort(),n.sort(),i=s.length-1;i>=0;i--)if(s[i]!=n[i])return!1;for(i=s.length-1;i>=0;i--)if(r=s[i],!_deepEqual(t[r],e[r]))return!1;return!0}function expectedException(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function _throws(t,e,r,i){var s;util.isString(r)&&(i=r,r=null);try{e()}catch(n){s=n}if(i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!s&&fail(s,r,"Missing expected exception"+i),!t&&expectedException(s,r)&&fail(s,r,"Got unwanted exception"+i),t&&s&&r&&!expectedException(s,r)||!t&&s)throw s}var util=require("util/"),pSlice=Array.prototype.slice,hasOwn=Object.prototype.hasOwnProperty,assert=module.exports=ok;assert.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var e=t.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,s=e.name,n=i.indexOf("\n"+s);if(n>=0){var a=i.indexOf("\n",n+1);i=i.substring(a+1)}this.stack=i}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(t,e,r){t!=e&&fail(t,e,r,"==",assert.equal)},assert.notEqual=function(t,e,r){t==e&&fail(t,e,r,"!=",assert.notEqual)},assert.deepEqual=function(t,e,r){_deepEqual(t,e)||fail(t,e,r,"deepEqual",assert.deepEqual)},assert.notDeepEqual=function(t,e,r){_deepEqual(t,e)&&fail(t,e,r,"notDeepEqual",assert.notDeepEqual)},assert.strictEqual=function(t,e,r){t!==e&&fail(t,e,r,"===",assert.strictEqual)},assert.notStrictEqual=function(t,e,r){t===e&&fail(t,e,r,"!==",assert.notStrictEqual)},assert.throws=function(){_throws.apply(this,[!0].concat(pSlice.call(arguments)))},assert.doesNotThrow=function(){_throws.apply(this,[!1].concat(pSlice.call(arguments)))},assert.ifError=function(t){if(t)throw t};var objectKeys=Object.keys||function(t){var e=[];for(var r in t)hasOwn.call(t,r)&&e.push(r);return e};
11 years ago
},{"util/":92}],91:[function(require,module,exports){
module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8};
11 years ago
},{}],92:[function(require,module,exports){
(function(e,t){function r(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&exports._extend(r,t),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=n),s(r,e,r.depth)}function n(e,t){var n=r.styles[t];return n?"["+r.colors[n][0]+"m"+e+"["+r.colors[n][1]+"m":e}function o(e){return e}function i(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function s(e,t,r){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==exports.inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return x(n)||(n=s(e,n,r)),n}var o=u(e,t);if(o)return o;var g=Object.keys(t),y=i(g);if(e.showHidden&&(g=Object.getOwnPropertyNames(t)),O(t)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return c(t);if(0===g.length){if(S(t)){var d=t.name?": "+t.name:"";return e.stylize("[Function"+d+"]","special")}if(v(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(j(t))return e.stylize(Date.prototype.toString.call(t),"date");if(O(t))return c(t)}var m="",h=!1,b=["{","}"];if(f(t)&&(h=!0,b=["[","]"]),S(t)){var w=t.name?": "+t.name:"";m=" [Function"+w+"]"}if(v(t)&&(m=" "+RegExp.prototype.toString.call(t)),j(t)&&(m=" "+Date.prototype.toUTCString.call(t)),O(t)&&(m=" "+c(t)),0===g.length&&(!h||0==t.length))return b[0]+m+b[1];if(0>r)return v(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var z;return z=h?l(e,t,r,y,g):g.map(function(n){return a(e,t,r,y,n,h)}),e.seen.pop(),p(z,m,b)}function u(e,t){if(b(t))return e.stylize("undefined","undefined");if(x(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,o){for(var i=[],s=0,u=t.length;u>s;++s)i.push(_(t,String(s))?a(e,t,r,n,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(a(e,t,r,n,o,!0))}),i}function a(e,t,r,n,o,i){var u,c,l;if(l=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},l.get?c=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(c=e.stylize("[Setter]","special")),_(n,o)||(u="["+o+"]"),c||(e.seen.indexOf(l.value)<0?(c=y(r)?s(e,l.value,null):s(e,l.value,r-1),c.indexOf("\n")>-1&&(c=i?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n"))):c=e.stylize("[Circular]","special")),b(u)){if(i&&o.match(/^\d+$/))return c;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+c}function p(e,t,r){var n=0,o=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function f(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function d(e){return null==e}function m(e){return"number"==typeof e}function x(e){return"string"==typeof e}function h(e){return"symbol"==typeof e}function b(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===E(e)}function w(e){return"object"==typeof e&&null!==e}function j(e){return w(e)&&"[object Date]"===E(e)}function O(e){return w(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function z(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function E(e){return Object.prototype.toString.call(e)}function D(e){return 10>e?"0"+e.toString(10):e.toString(10)}function N(){var e=new Date,t=[D(e.getHours()),D(e.getMinutes()),D(e.getSeconds())].join(":");return[
11 years ago
},{"./support/isBuffer":91,"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"inherits":109}],93:[function(require,module,exports){
function Buffer(e,t,r){if(!(this instanceof Buffer))return new Buffer(e,t,r);var n=typeof e;if("base64"===t&&"string"===n)for(e=stringtrim(e);e.length%4!==0;)e+="=";var i;if("number"===n)i=coerce(e);else if("string"===n)i=Buffer.byteLength(e,t);else{if("object"!==n)throw new Error("First argument needs to be a number, array or string.");i=coerce(e.length)}var s;Buffer._useTypedArrays?s=Buffer._augment(new Uint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);var a;if(Buffer._useTypedArrays&&"number"==typeof e.byteLength)s._set(e);else if(isArrayish(e))for(a=0;i>a;a++)s[a]=Buffer.isBuffer(e)?e.readUInt8(a):e[a];else if("string"===n)s.write(e,0,t);else if("number"===n&&!Buffer._useTypedArrays&&!r)for(a=0;i>a;a++)s[a]=0;return s}function _hexWrite(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;assert(s%2===0,"Invalid hex string"),n>s/2&&(n=s/2);for(var a=0;n>a;a++){var o=parseInt(t.substr(2*a,2),16);assert(!isNaN(o),"Invalid hex string"),e[r+a]=o}return Buffer._charsWritten=2*a,a}function _utf8Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf8ToBytes(t),e,r,n);return i}function _asciiWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(asciiToBytes(t),e,r,n);return i}function _binaryWrite(e,t,r,n){return _asciiWrite(e,t,r,n)}function _base64Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(base64ToBytes(t),e,r,n);return i}function _utf16leWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf16leToBytes(t),e,r,n);return i}function _base64Slice(e,t,r){return base64.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function _utf8Slice(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var s=t;r>s;s++)e[s]<=127?(n+=decodeUtf8Char(i)+String.fromCharCode(e[s]),i=""):i+="%"+e[s].toString(16);return n+decodeUtf8Char(i)}function _asciiSlice(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function _binarySlice(e,t,r){return _asciiSlice(e,t,r)}function _hexSlice(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=t;r>s;s++)i+=toHex(e[s]);return i}function _utf16leSlice(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function _readUInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(s=e[t],i>t+1&&(s|=e[t+1]<<8)):(s=e[t]<<8,i>t+1&&(s|=e[t+1])),s}}function _readUInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(i>t+2&&(s=e[t+2]<<16),i>t+1&&(s|=e[t+1]<<8),s|=e[t],i>t+3&&(s+=e[t+3]<<24>>>0)):(i>t+1&&(s=e[t+1]<<16),i>t+2&&(s|=e[t+2]<<8),i>t+3&&(s|=e[t+3]),s+=e[t]<<24>>>0),s}}function _readInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt16(e,t,r,!0),a=32768&s;return a?-1*(65535-s+1):s}}function _readInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt32(e,t,r,!0),a=2147483648&s;return a?-1*(4294967295-s+1):s}}function _readFloat(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+3<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,23,4)}function _readDouble(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+7<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,52,8)}function _writeUInt16(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"trying to write beyond b
11 years ago
},{"base64-js":94,"ieee754":95}],94:[function(require,module,exports){
var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function r(t){var r=t.charCodeAt(0);return r===h?62:r===c?63:o>r?-1:o+10>r?r-o+26+26:i+26>r?r-i:A+26>r?r-A+26:void 0}function e(t){function e(t){i[f++]=t}var n,h,c,o,A,i;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;A="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,i=new a(3*t.length/4-A),c=A>0?t.length-4:t.length;var f=0;for(n=0,h=0;c>n;n+=4,h+=3)o=r(t.charAt(n))<<18|r(t.charAt(n+1))<<12|r(t.charAt(n+2))<<6|r(t.charAt(n+3)),e((16711680&o)>>16),e((65280&o)>>8),e(255&o);return 2===A?(o=r(t.charAt(n))<<2|r(t.charAt(n+1))>>4,e(255&o)):1===A&&(o=r(t.charAt(n))<<10|r(t.charAt(n+1))<<4|r(t.charAt(n+2))>>2,e(o>>8&255),e(255&o)),i}function n(t){function r(t){return lookup.charAt(t)}function e(t){return r(t>>18&63)+r(t>>12&63)+r(t>>6&63)+r(63&t)}var n,a,h,c=t.length%3,o="";for(n=0,h=t.length-c;h>n;n+=3)a=(t[n]<<16)+(t[n+1]<<8)+t[n+2],o+=e(a);switch(c){case 1:a=t[t.length-1],o+=r(a>>2),o+=r(a<<4&63),o+="==";break;case 2:a=(t[t.length-2]<<8)+t[t.length-1],o+=r(a>>10),o+=r(a>>4&63),o+=r(a<<2&63),o+="="}return o}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,h="+".charCodeAt(0),c="/".charCodeAt(0),o="0".charCodeAt(0),A="a".charCodeAt(0),i="A".charCodeAt(0);t.toByteArray=e,t.fromByteArray=n}("undefined"==typeof exports?this.base64js={}:exports);
11 years ago
},{}],95:[function(require,module,exports){
exports.read=function(o,t,a,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,n=a?h-1:0,s=a?-1:1,N=o[t+n];for(n+=s,M=N&(1<<-i)-1,N>>=-i,i+=w;i>0;M=256*M+o[t+n],n+=s,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+o[t+n],n+=s,i-=8);if(0===M)M=1-e;else{if(M===f)return p?0/0:1/0*(N?-1:1);p+=Math.pow(2,r),M-=e}return(N?-1:1)*p*Math.pow(2,M-r)},exports.write=function(o,t,a,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,n=i>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:M-1,u=r?1:-1,l=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(w=isNaN(t)?1:0,p=i):(p=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-p))<1&&(p--,f*=2),t+=p+n>=1?s/f:s*Math.pow(2,1-n),t*f>=2&&(p++,f/=2),p+n>=i?(w=0,p=i):p+n>=1?(w=(t*f-1)*Math.pow(2,h),p+=n):(w=t*Math.pow(2,n-1)*Math.pow(2,h),p=0));h>=8;o[a+N]=255&w,N+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;o[a+N]=255&p,N+=u,p/=256,e-=8);o[a+N-u]|=128*l};
11 years ago
},{}],96:[function(require,module,exports){
function toArray(r,e){if(r.length%intSize!==0){var f=r.length+(intSize-r.length%intSize);r=Buffer.concat([r,zeroBuffer],f)}for(var t=[],n=e?r.readInt32BE:r.readInt32LE,u=0;u<r.length;u+=intSize)t.push(n.call(r,u));return t}function toBuffer(r,e,f){for(var t=new Buffer(e),n=f?t.writeInt32BE:t.writeInt32LE,u=0;u<r.length;u++)n.call(t,r[u],4*u,!0);return t}function hash(r,e,f,t){Buffer.isBuffer(r)||(r=new Buffer(r));var n=e(toArray(r,t),r.length*chrsz);return toBuffer(n,f,t)}var Buffer=require("buffer").Buffer,intSize=4,zeroBuffer=new Buffer(intSize);zeroBuffer.fill(0);var chrsz=8;module.exports={hash:hash};
11 years ago
},{"buffer":93}],97:[function(require,module,exports){
function hmac(e,r,f){Buffer.isBuffer(r)||(r=new Buffer(r)),Buffer.isBuffer(f)||(f=new Buffer(f)),r.length>blocksize?r=e(r):r.length<blocksize&&(r=Buffer.concat([r,zeroBuffer],blocksize));for(var t=new Buffer(blocksize),n=new Buffer(blocksize),i=0;blocksize>i;i++)t[i]=54^r[i],n[i]=92^r[i];var c=e(Buffer.concat([t,f]));return e(Buffer.concat([n,c]))}function hash(e,r){e=e||"sha1";var f=algorithms[e],t=[],n=0;return f||error("algorithm:",e,"is not yet supported"),{update:function(e){return Buffer.isBuffer(e)||(e=new Buffer(e)),t.push(e),n+=e.length,this},digest:function(e){var n=Buffer.concat(t),i=r?hmac(f,r,n):f(n);return t=null,e?i.toString(e):i}}}function error(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function each(e,r){for(var f in e)r(e[f],f)}var Buffer=require("buffer").Buffer,sha=require("./sha"),sha256=require("./sha256"),rng=require("./rng"),md5=require("./md5"),algorithms={sha1:sha,sha256:sha256,md5:md5},blocksize=64,zeroBuffer=new Buffer(blocksize);zeroBuffer.fill(0),exports.createHash=function(e){return hash(e)},exports.createHmac=function(e,r){return hash(e,r)},exports.randomBytes=function(e,r){if(!r||!r.call)return new Buffer(rng(e));try{r.call(this,void 0,new Buffer(rng(e)))}catch(f){r(f)}},each(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){exports[e]=function(){error("sorry,",e,"is not implemented yet")}});
11 years ago
},{"./md5":98,"./rng":99,"./sha":100,"./sha256":101,"buffer":93}],98:[function(require,module,exports){
function md5_vm_test(){return"900150983cd24fb0d6963f7d28e17f72"==hex_md5("abc")}function core_md5(d,_){d[_>>5]|=128<<_%32,d[(_+64>>>9<<4)+14]=_;for(var m=1732584193,f=-271733879,i=-1732584194,h=271733878,r=0;r<d.length;r+=16){var n=m,e=f,g=i,t=h;m=md5_ff(m,f,i,h,d[r+0],7,-680876936),h=md5_ff(h,m,f,i,d[r+1],12,-389564586),i=md5_ff(i,h,m,f,d[r+2],17,606105819),f=md5_ff(f,i,h,m,d[r+3],22,-1044525330),m=md5_ff(m,f,i,h,d[r+4],7,-176418897),h=md5_ff(h,m,f,i,d[r+5],12,1200080426),i=md5_ff(i,h,m,f,d[r+6],17,-1473231341),f=md5_ff(f,i,h,m,d[r+7],22,-45705983),m=md5_ff(m,f,i,h,d[r+8],7,1770035416),h=md5_ff(h,m,f,i,d[r+9],12,-1958414417),i=md5_ff(i,h,m,f,d[r+10],17,-42063),f=md5_ff(f,i,h,m,d[r+11],22,-1990404162),m=md5_ff(m,f,i,h,d[r+12],7,1804603682),h=md5_ff(h,m,f,i,d[r+13],12,-40341101),i=md5_ff(i,h,m,f,d[r+14],17,-1502002290),f=md5_ff(f,i,h,m,d[r+15],22,1236535329),m=md5_gg(m,f,i,h,d[r+1],5,-165796510),h=md5_gg(h,m,f,i,d[r+6],9,-1069501632),i=md5_gg(i,h,m,f,d[r+11],14,643717713),f=md5_gg(f,i,h,m,d[r+0],20,-373897302),m=md5_gg(m,f,i,h,d[r+5],5,-701558691),h=md5_gg(h,m,f,i,d[r+10],9,38016083),i=md5_gg(i,h,m,f,d[r+15],14,-660478335),f=md5_gg(f,i,h,m,d[r+4],20,-405537848),m=md5_gg(m,f,i,h,d[r+9],5,568446438),h=md5_gg(h,m,f,i,d[r+14],9,-1019803690),i=md5_gg(i,h,m,f,d[r+3],14,-187363961),f=md5_gg(f,i,h,m,d[r+8],20,1163531501),m=md5_gg(m,f,i,h,d[r+13],5,-1444681467),h=md5_gg(h,m,f,i,d[r+2],9,-51403784),i=md5_gg(i,h,m,f,d[r+7],14,1735328473),f=md5_gg(f,i,h,m,d[r+12],20,-1926607734),m=md5_hh(m,f,i,h,d[r+5],4,-378558),h=md5_hh(h,m,f,i,d[r+8],11,-2022574463),i=md5_hh(i,h,m,f,d[r+11],16,1839030562),f=md5_hh(f,i,h,m,d[r+14],23,-35309556),m=md5_hh(m,f,i,h,d[r+1],4,-1530992060),h=md5_hh(h,m,f,i,d[r+4],11,1272893353),i=md5_hh(i,h,m,f,d[r+7],16,-155497632),f=md5_hh(f,i,h,m,d[r+10],23,-1094730640),m=md5_hh(m,f,i,h,d[r+13],4,681279174),h=md5_hh(h,m,f,i,d[r+0],11,-358537222),i=md5_hh(i,h,m,f,d[r+3],16,-722521979),f=md5_hh(f,i,h,m,d[r+6],23,76029189),m=md5_hh(m,f,i,h,d[r+9],4,-640364487),h=md5_hh(h,m,f,i,d[r+12],11,-421815835),i=md5_hh(i,h,m,f,d[r+15],16,530742520),f=md5_hh(f,i,h,m,d[r+2],23,-995338651),m=md5_ii(m,f,i,h,d[r+0],6,-198630844),h=md5_ii(h,m,f,i,d[r+7],10,1126891415),i=md5_ii(i,h,m,f,d[r+14],15,-1416354905),f=md5_ii(f,i,h,m,d[r+5],21,-57434055),m=md5_ii(m,f,i,h,d[r+12],6,1700485571),h=md5_ii(h,m,f,i,d[r+3],10,-1894986606),i=md5_ii(i,h,m,f,d[r+10],15,-1051523),f=md5_ii(f,i,h,m,d[r+1],21,-2054922799),m=md5_ii(m,f,i,h,d[r+8],6,1873313359),h=md5_ii(h,m,f,i,d[r+15],10,-30611744),i=md5_ii(i,h,m,f,d[r+6],15,-1560198380),f=md5_ii(f,i,h,m,d[r+13],21,1309151649),m=md5_ii(m,f,i,h,d[r+4],6,-145523070),h=md5_ii(h,m,f,i,d[r+11],10,-1120210379),i=md5_ii(i,h,m,f,d[r+2],15,718787259),f=md5_ii(f,i,h,m,d[r+9],21,-343485551),m=safe_add(m,n),f=safe_add(f,e),i=safe_add(i,g),h=safe_add(h,t)}return Array(m,f,i,h)}function md5_cmn(d,_,m,f,i,h){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,h)),i),m)}function md5_ff(d,_,m,f,i,h,r){return md5_cmn(_&m|~_&f,d,_,i,h,r)}function md5_gg(d,_,m,f,i,h,r){return md5_cmn(_&f|m&~f,d,_,i,h,r)}function md5_hh(d,_,m,f,i,h,r){return md5_cmn(_^m^f,d,_,i,h,r)}function md5_ii(d,_,m,f,i,h,r){return md5_cmn(m^(_|~f),d,_,i,h,r)}function safe_add(d,_){var m=(65535&d)+(65535&_),f=(d>>16)+(_>>16)+(m>>16);return f<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}var helpers=require("./helpers");module.exports=function(d){return helpers.hash(d,core_md5,16)};
11 years ago
},{"./helpers":96}],99:[function(require,module,exports){
!function(){var r,n,t=this;r=function(r){for(var n,n,t=new Array(r),o=0;r>o;o++)0==(3&o)&&(n=4294967296*Math.random()),t[o]=n>>>((3&o)<<3)&255;return t},t.crypto&&crypto.getRandomValues&&(n=function(r){var n=new Uint8Array(r);return crypto.getRandomValues(n),n}),module.exports=n||r}();
11 years ago
},{}],100:[function(require,module,exports){
function core_sha1(r,a){r[a>>5]|=128<<24-a%32,r[(a+64>>9<<4)+15]=a;for(var e=Array(80),d=1732584193,s=-271733879,f=-1732584194,n=271733878,t=-1009589776,o=0;o<r.length;o+=16){for(var _=d,u=s,h=f,l=n,c=t,i=0;80>i;i++){e[i]=16>i?r[o+i]:rol(e[i-3]^e[i-8]^e[i-14]^e[i-16],1);var v=safe_add(safe_add(rol(d,5),sha1_ft(i,s,f,n)),safe_add(safe_add(t,e[i]),sha1_kt(i)));t=n,n=f,f=rol(s,30),s=d,d=v}d=safe_add(d,_),s=safe_add(s,u),f=safe_add(f,h),n=safe_add(n,l),t=safe_add(t,c)}return Array(d,s,f,n,t)}function sha1_ft(r,a,e,d){return 20>r?a&e|~a&d:40>r?a^e^d:60>r?a&e|a&d|e&d:a^e^d}function sha1_kt(r){return 20>r?1518500249:40>r?1859775393:60>r?-1894007588:-899497514}function safe_add(r,a){var e=(65535&r)+(65535&a),d=(r>>16)+(a>>16)+(e>>16);return d<<16|65535&e}function rol(r,a){return r<<a|r>>>32-a}var helpers=require("./helpers");module.exports=function(r){return helpers.hash(r,core_sha1,20,!0)};
11 years ago
},{"./helpers":96}],101:[function(require,module,exports){
var helpers=require("./helpers"),safe_add=function(a,e){var r=(65535&a)+(65535&e),d=(a>>16)+(e>>16)+(r>>16);return d<<16|65535&r},S=function(a,e){return a>>>e|a<<32-e},R=function(a,e){return a>>>e},Ch=function(a,e,r){return a&e^~a&r},Maj=function(a,e,r){return a&e^a&r^e&r},Sigma0256=function(a){return S(a,2)^S(a,13)^S(a,22)},Sigma1256=function(a){return S(a,6)^S(a,11)^S(a,25)},Gamma0256=function(a){return S(a,7)^S(a,18)^R(a,3)},Gamma1256=function(a){return S(a,17)^S(a,19)^R(a,10)},core_sha256=function(a,e){var r,d,n,f,s,t,u,_,o,i,S,c,m=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),h=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),g=new Array(64);a[e>>5]|=128<<24-e%32,a[(e+64>>9<<4)+15]=e;for(var o=0;o<a.length;o+=16){r=h[0],d=h[1],n=h[2],f=h[3],s=h[4],t=h[5],u=h[6],_=h[7];for(var i=0;64>i;i++)g[i]=16>i?a[i+o]:safe_add(safe_add(safe_add(Gamma1256(g[i-2]),g[i-7]),Gamma0256(g[i-15])),g[i-16]),S=safe_add(safe_add(safe_add(safe_add(_,Sigma1256(s)),Ch(s,t,u)),m[i]),g[i]),c=safe_add(Sigma0256(r),Maj(r,d,n)),_=u,u=t,t=s,s=safe_add(f,S),f=n,n=d,d=r,r=safe_add(S,c);h[0]=safe_add(r,h[0]),h[1]=safe_add(d,h[1]),h[2]=safe_add(n,h[2]),h[3]=safe_add(f,h[3]),h[4]=safe_add(s,h[4]),h[5]=safe_add(t,h[5]),h[6]=safe_add(u,h[6]),h[7]=safe_add(_,h[7])}return h};module.exports=function(a){return helpers.hash(a,core_sha256,32,!0)};
11 years ago
},{"./helpers":96}],"events":[function(require,module,exports){
module.exports=require('T9Wsc/');
},{}],"T9Wsc/":[function(require,module,exports){
function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,n,s,i,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],isUndefined(n))return!1;if(isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];n.apply(this,i)}else if(isObject(n)){for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(o=n.slice(),s=o.length,r=0;s>r;r++)o[r].apply(this,i)}return!0},EventEmitter.prototype.addListener=function(e,t){var n;if(!isFunction(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned){var n;n=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){function n(){this.removeListener(e,n),s||(s=!0,t.apply(this,arguments))}if(!isFunction(t))throw TypeError("listener must be a function");var s=!1;return n.listener=t,this.on(e,n),this},EventEmitter.prototype.removeListener=function(e,t){var n,s,i,r;if(!isFunction(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,s=-1,n===t||isFunction(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(isObject(n)){for(r=i;r-->0;)if(n[r]===t||n[r].listener&&n[r].listener===t){s=r;break}if(0>s)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],isFunction(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},EventEmitter.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?isFunction(e._events[t])?1:e._events[t].length:0};
11 years ago
},{}],104:[function(require,module,exports){
var http=module.exports,EventEmitter=require("events").EventEmitter,Request=require("./lib/request"),url=require("url");http.request=function(e,t){"string"==typeof e&&(e=url.parse(e)),e||(e={}),e.host||e.port||(e.port=parseInt(window.location.port,10)),!e.host&&e.hostname&&(e.host=e.hostname),e.scheme||(e.scheme=window.location.protocol.split(":")[0]),e.host||(e.host=window.location.hostname||window.location.host),/:/.test(e.host)&&(e.port||(e.port=e.host.split(":")[1]),e.host=e.host.split(":")[0]),e.port||(e.port="https"==e.scheme?443:80);var o=new Request(new xhrHttp,e);return t&&o.on("response",t),o},http.get=function(e,t){e.method="GET";var o=http.request(e,t);return o.end(),o},http.Agent=function(){},http.Agent.defaultMaxSockets=4;var xhrHttp=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{var o=new window.ActiveXObject(e[t]);return function(){if(o){var r=o;return o=null,r}return new window.ActiveXObject(e[t])}}catch(r){}throw new Error("ajax not supported in this browser")}throw new Error("ajax not supported in this browser")}();http.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};
11 years ago
},{"./lib/request":105,"events":"T9Wsc/","url":124}],105:[function(require,module,exports){
var Stream=require("stream"),Response=require("./response"),Base64=require("Base64"),inherits=require("inherits"),Request=module.exports=function(e,t){var r=this;r.writable=!0,r.xhr=e,r.body=[],r.uri=(t.scheme||"http")+"://"+t.host+(t.port?":"+t.port:"")+(t.path||"/"),"undefined"==typeof t.withCredentials&&(t.withCredentials=!0);try{e.withCredentials=t.withCredentials}catch(s){}if(e.open(t.method||"GET",r.uri,!0),r._headers={},t.headers)for(var o=objectKeys(t.headers),i=0;i<o.length;i++){var n=o[i];if(r.isSafeRequestHeader(n)){var a=t.headers[n];r.setHeader(n,a)}}t.auth&&this.setHeader("Authorization","Basic "+Base64.btoa(t.auth));var h=new Response;h.on("close",function(){r.emit("close")}),h.on("ready",function(){r.emit("response",h)}),e.onreadystatechange=function(){e.__aborted||h.handle(e)}};inherits(Request,Stream),Request.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t},Request.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]},Request.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},Request.prototype.write=function(e){this.body.push(e)},Request.prototype.destroy=function(){this.xhr.__aborted=!0,this.xhr.abort(),this.emit("close")},Request.prototype.end=function(e){void 0!==e&&this.body.push(e);for(var t=objectKeys(this._headers),r=0;r<t.length;r++){var s=t[r],o=this._headers[s];if(isArray(o))for(var i=0;i<o.length;i++)this.xhr.setRequestHeader(s,o[i]);else this.xhr.setRequestHeader(s,o)}if(0===this.body.length)this.xhr.send("");else if("string"==typeof this.body[0])this.xhr.send(this.body.join(""));else if(isArray(this.body[0])){for(var n=[],r=0;r<this.body.length;r++)n.push.apply(n,this.body[r]);this.xhr.send(n)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){for(var a=0,r=0;r<this.body.length;r++)a+=this.body[r].length;for(var n=new this.body[0].constructor(a),h=0,r=0;r<this.body.length;r++)for(var d=this.body[r],i=0;i<d.length;i++)n[h++]=d[i];this.xhr.send(n)}else{for(var n="",r=0;r<this.body.length;r++)n+=this.body[r].toString();this.xhr.send(n)}},Request.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],Request.prototype.isSafeRequestHeader=function(e){return e?-1===indexOf(Request.unsafeHeaders,e.toLowerCase()):!1};var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1};
11 years ago
},{"./response":106,"Base64":107,"inherits":109,"stream":117}],106:[function(require,module,exports){
function parseHeaders(e){for(var t=e.getAllResponseHeaders().split(/\r?\n/),s={},r=0;r<t.length;r++){var a=t[r];if(""!==a){var i=a.match(/^([^:]+):\s*(.*)/);if(i){var o=i[1].toLowerCase(),n=i[2];void 0!==s[o]?isArray(s[o])?s[o].push(n):s[o]=[s[o],n]:s[o]=n}else s[a]=!0}}return s}var Stream=require("stream"),util=require("util"),Response=module.exports=function(){this.offset=0,this.readable=!0};util.inherits(Response,Stream);var capable={streaming:!0,status2:!0};Response.prototype.getResponse=function(e){var t=String(e.responseType).toLowerCase();return"blob"===t?e.responseBlob||e.response:"arraybuffer"===t?e.response:e.responseText},Response.prototype.getHeader=function(e){return this.headers[e.toLowerCase()]},Response.prototype.handle=function(e){if(2===e.readyState&&capable.status2){try{this.statusCode=e.status,this.headers=parseHeaders(e)}catch(t){capable.status2=!1}capable.status2&&this.emit("ready")}else if(capable.streaming&&3===e.readyState){try{this.statusCode||(this.statusCode=e.status,this.headers=parseHeaders(e),this.emit("ready"))}catch(t){}try{this._emitData(e)}catch(t){capable.streaming=!1}}else 4===e.readyState&&(this.statusCode||(this.statusCode=e.status,this.emit("ready")),this._emitData(e),e.error?this.emit("error",this.getResponse(e)):this.emit("end"),this.emit("close"))},Response.prototype._emitData=function(e){var t=this.getResponse(e);return t.toString().match(/ArrayBuffer/)?(this.emit("data",new Uint8Array(t,this.offset)),void(this.offset=t.byteLength)):void(t.length>this.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};
11 years ago
},{"stream":117,"util":126}],107:[function(require,module,exports){
!function(){function t(t){this.message=t}var e="undefined"!=typeof exports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var o,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-a%1*8)){if(n=e.charCodeAt(a+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return c}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),e.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)n=r.indexOf(n);return c})}();
11 years ago
},{}],108:[function(require,module,exports){
var http=require("http"),https=module.exports;for(var key in http)http.hasOwnProperty(key)&&(https[key]=http[key]);https.request=function(t,e){return t||(t={}),t.scheme="https",http.request.call(this,t,e)};
11 years ago
},{"http":104}],109:[function(require,module,exports){
module.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t};
11 years ago
},{}],110:[function(require,module,exports){
function noop(){}var process=module.exports={};process.nextTick=function(){var o="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(o)return function(o){return window.setImmediate(o)};if(e){var n=[];return window.addEventListener("message",function(o){var e=o.source;if((e===window||null===e)&&"process-tick"===o.data&&(o.stopPropagation(),n.length>0)){var s=n.shift();s()}},!0),function(o){n.push(o),window.postMessage("process-tick","*")}}return function(o){setTimeout(o,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.on=noop,process.once=noop,process.off=noop,process.emit=noop,process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
11 years ago
},{}],111:[function(require,module,exports){
(function(r){function t(r,t){for(var e=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(r){return n.exec(r).slice(1)};exports.resolve=function(){for(var n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i=s>=0?arguments[s]:r.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(n=i+"/"+n,o="/"===i.charAt(0))}return n=t(e(n.split("/"),function(r){return!!r}),!o).join("/"),(o?"/":"")+n||"."},exports.normalize=function(r){var n=exports.isAbsolute(r),o="/"===s(r,-1);return r=t(e(r.split("/"),function(r){return!!r}),!n).join("/"),r||n||(r="."),r&&o&&(r+="/"),(n?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(e(r,function(r){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),s=Math.min(n.length,o.length),i=s,u=0;s>u;u++)if(n[u]!==o[u]){i=u;break}for(var l=[],u=i;u<n.length;u++)l.push("..");return l=l.concat(o.slice(i)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){var t=o(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){var e=o(r)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){return o(r)[3]};var s="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return 0>t&&(t=r.length+t),r.substr(t,e)}}).call(this,require("/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
11 years ago
},{"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110}],112:[function(require,module,exports){
(function(e){!function(o){function n(e){throw RangeError(M[e])}function t(e,o){for(var n=e.length;n--;)e[n]=o(e[n]);return e}function r(e,o){return t(e.split(L),o).join(".")}function f(e){for(var o,n,t=[],r=0,f=e.length;f>r;)o=e.charCodeAt(r++),o>=55296&&56319>=o&&f>r?(n=e.charCodeAt(r++),56320==(64512&n)?t.push(((1023&o)<<10)+(1023&n)+65536):(t.push(o),r--)):t.push(o);return t}function i(e){return t(e,function(e){var o="";return e>65535&&(e-=65536,o+=T(e>>>10&1023|55296),e=56320|1023&e),o+=T(e)}).join("")}function u(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:C}function c(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function d(e,o,n){var t=0;for(e=n?R(e/A):e>>1,e+=R(e/o);e>P*j>>1;t+=C)e=R(e/P);return R(t+(P+1)*e/(e+m))}function l(e){var o,t,r,f,c,l,s,p,a,h,v=[],w=e.length,g=0,y=F,m=I;for(t=e.lastIndexOf(E),0>t&&(t=0),r=0;t>r;++r)e.charCodeAt(r)>=128&&n("not-basic"),v.push(e.charCodeAt(r));for(f=t>0?t+1:0;w>f;){for(c=g,l=1,s=C;f>=w&&n("invalid-input"),p=u(e.charCodeAt(f++)),(p>=C||p>R((x-g)/l))&&n("overflow"),g+=p*l,a=m>=s?b:s>=m+j?j:s-m,!(a>p);s+=C)h=C-a,l>R(x/h)&&n("overflow"),l*=h;o=v.length+1,m=d(g-c,o,0==c),R(g/o)>x-y&&n("overflow"),y+=R(g/o),g%=o,v.splice(g++,0,y)}return i(v)}function s(e){var o,t,r,i,u,l,s,p,a,h,v,w,g,y,m,A=[];for(e=f(e),w=e.length,o=F,t=0,u=I,l=0;w>l;++l)v=e[l],128>v&&A.push(T(v));for(r=i=A.length,i&&A.push(E);w>r;){for(s=x,l=0;w>l;++l)v=e[l],v>=o&&s>v&&(s=v);for(g=r+1,s-o>R((x-t)/g)&&n("overflow"),t+=(s-o)*g,o=s,l=0;w>l;++l)if(v=e[l],o>v&&++t>x&&n("overflow"),v==o){for(p=t,a=C;h=u>=a?b:a>=u+j?j:a-u,!(h>p);a+=C)m=p-h,y=C-h,A.push(T(c(h+m%y,0))),p=R(m/y);A.push(T(c(p,0))),u=d(t,g,r==i),t=0,++r}++t,++o}return A.join("")}function p(e){return r(e,function(e){return O.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return S.test(e)?"xn--"+s(e):e})}var h="object"==typeof exports&&exports,v="object"==typeof module&&module&&module.exports==h&&module,w="object"==typeof e&&e;(w.global===w||w.window===w)&&(o=w);var g,y,x=2147483647,C=36,b=1,j=26,m=38,A=700,I=72,F=128,E="-",O=/^xn--/,S=/[^ -~]/,L=/\x2E|\u3002|\uFF0E|\uFF61/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=C-b,R=Math.floor,T=String.fromCharCode;if(g={version:"1.2.4",ucs2:{decode:f,encode:i},decode:l,encode:s,toASCII:a,toUnicode:p},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(h&&!h.nodeType)if(v)v.exports=g;else for(y in g)g.hasOwnProperty(y)&&(h[y]=g[y]);else o.punycode=g}(this)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
11 years ago
},{}],113:[function(require,module,exports){
"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;p>y;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
11 years ago
},{}],114:[function(require,module,exports){
"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?r[n].map(function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
11 years ago
},{}],115:[function(require,module,exports){
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
11 years ago
},{"./decode":113,"./encode":114}],116:[function(require,module,exports){
function Duplex(e){return this instanceof Duplex?(Readable.call(this,e),Writable.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",onend)):new Duplex(e)}function onend(){if(!this.allowHalfOpen&&!this._writableState.ended){var e=this;setImmediate(function(){e.end()})}}module.exports=Duplex;var inherits=require("inherits"),setImmediate=require("process/browser.js").nextTick,Readable=require("./readable.js"),Writable=require("./writable.js");inherits(Duplex,Readable),Duplex.prototype.write=Writable.prototype.write,Duplex.prototype.end=Writable.prototype.end,Duplex.prototype._write=Writable.prototype._write;
11 years ago
},{"./readable.js":120,"./writable.js":122,"inherits":109,"process/browser.js":118}],117:[function(require,module,exports){
function Stream(){EE.call(this)}module.exports=Stream;var EE=require("events").EventEmitter,inherits=require("inherits");inherits(Stream,EE),Stream.Readable=require("./readable.js"),Stream.Writable=require("./writable.js"),Stream.Duplex=require("./duplex.js"),Stream.Transform=require("./transform.js"),Stream.PassThrough=require("./passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(e,r){function t(r){e.writable&&!1===e.write(r)&&m.pause&&m.pause()}function n(){m.readable&&m.resume&&m.resume()}function o(){u||(u=!0,e.end())}function i(){u||(u=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(a(),0===EE.listenerCount(this,"error"))throw e}function a(){m.removeListener("data",t),e.removeListener("drain",n),m.removeListener("end",o),m.removeListener("close",i),m.removeListener("error",s),e.removeListener("error",s),m.removeListener("end",a),m.removeListener("close",a),e.removeListener("close",a)}var m=this;m.on("data",t),e.on("drain",n),e._isStdio||r&&r.end===!1||(m.on("end",o),m.on("close",i));var u=!1;return m.on("error",s),e.on("error",s),m.on("end",a),m.on("close",a),e.on("close",a),e.emit("pipe",m),e};
11 years ago
},{"./duplex.js":116,"./passthrough.js":119,"./readable.js":120,"./transform.js":121,"./writable.js":122,"events":"T9Wsc/","inherits":109}],118:[function(require,module,exports){
var process=module.exports={};process.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){var r=o.shift();r()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
11 years ago
},{}],119:[function(require,module,exports){
function PassThrough(r){return this instanceof PassThrough?void Transform.call(this,r):new PassThrough(r)}module.exports=PassThrough;var Transform=require("./transform.js"),inherits=require("inherits");inherits(PassThrough,Transform),PassThrough.prototype._transform=function(r,s,o){o(null,r)};
11 years ago
},{"./transform.js":121,"inherits":109}],120:[function(require,module,exports){
(function(e){function t(e){e=e||{};var t=e.highWaterMark;this.highWaterMark=t||0===t?t:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(_||(_=require("string_decoder").StringDecoder),this.decoder=new _(e.encoding),this.encoding=e.encoding)}function n(e){return this instanceof n?(this._readableState=new t(e,this),this.readable=!0,void S.call(this)):new n(e)}function r(e,t,n,r,a){var o=d(t,n);if(o)e.emit("error",o);else if(null===n||void 0===n)t.reading=!1,t.ended||s(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!a){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&a){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||a||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,a?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),h(e,t);else a||(t.reading=!1);return i(t)}function i(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=L)e=L;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function o(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function s(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):v(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?E(function(){u(e)}):u(e))}function u(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,E(function(){f(e,t)}))}function f(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function p(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&c(e)}}function c(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(M.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,c(this))}function b(e,t){var n=e._readableState;if(n.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=S.prototype.pipe,e.on=e.addListener=S.prototype.on,e.on("readable",function(){i=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?E(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(o)n=r.shift();else if(!e||e>=i)n=a?r.join(""):R.concat(r,i),r.length=0;else if(e<r[0].length){var d=r[0];n=d.slice(0,e),r[0]=d.slice(e)}else if(e===r[0].length)n=r.shift();else{n=a?"":new R(e);for(var s=0,l=0,u=r.length;u>l&&e>s;l++){var d=r[0],h=Math.min(e-s,d.length);a?n+=d.slice(0,h):d.copy(n,s,0,h),h<d.length?r[0]=d.slice(h):r.shift(),s+=h}}return n}function v(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,E(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.r
11 years ago
},{"./index.js":117,"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"buffer":93,"events":"T9Wsc/","inherits":109,"process/browser.js":118,"string_decoder":123}],121:[function(require,module,exports){
function TransformState(r,t){this.afterTransform=function(r,n){return afterTransform(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function afterTransform(r,t,n){var e=r._transformState;e.transforming=!1;var a=e.writecb;if(!a)return r.emit("error",new Error("no writecb in Transform class"));e.writechunk=null,e.writecb=null,null!==n&&void 0!==n&&r.push(n),a&&a(t);var i=r._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&r._read(i.highWaterMark)}function Transform(r){if(!(this instanceof Transform))return new Transform(r);Duplex.call(this,r);var t=(this._transformState=new TransformState(r,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(r){done(t,r)}):done(t)})}function done(r,t){if(t)return r.emit("error",t);var n=r._writableState,e=(r._readableState,r._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(e.transforming)throw new Error("calling transform done when still transforming");return r.push(null)}module.exports=Transform;var Duplex=require("./duplex.js"),inherits=require("inherits");inherits(Transform,Duplex),Transform.prototype.push=function(r,t){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(){throw new Error("not implemented")},Transform.prototype._write=function(r,t,n){var e=this._transformState;if(e.writecb=n,e.writechunk=r,e.writeencoding=t,!e.transforming){var a=this._readableState;(e.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(){var r=this._transformState;r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0};
11 years ago
},{"./duplex.js":116,"inherits":109}],122:[function(require,module,exports){
function WriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}function WritableState(e,t){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}function Writable(e){return this instanceof Writable||this instanceof Stream.Duplex?(this._writableState=new WritableState(e,this),this.writable=!0,void Stream.call(this)):new Writable(e)}function writeAfterEnd(e,t,r){var i=new Error("write after end");e.emit("error",i),setImmediate(function(){r(i)})}function validChunk(e,t,r,i){var n=!0;if(!Buffer.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");e.emit("error",f),setImmediate(function(){i(f)}),n=!1}return n}function decodeChunk(e,t,r){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new Buffer(t,r)),t}function writeOrBuffer(e,t,r,i,n){r=decodeChunk(t,r,i);var f=t.objectMode?1:r.length;t.length+=f;var o=t.length<t.highWaterMark;return t.needDrain=!o,t.writing?t.buffer.push(new WriteReq(r,i,n)):doWrite(e,t,f,r,i,n),o}function doWrite(e,t,r,i,n,f){t.writelen=r,t.writecb=f,t.writing=!0,t.sync=!0,e._write(i,n,t.onwrite),t.sync=!1}function onwriteError(e,t,r,i,n){r?setImmediate(function(){n(i)}):n(i),e.emit("error",i)}function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function onwrite(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{var f=needFinish(e,r);f||r.bufferProcessing||!r.buffer.length||clearBuffer(e,r),i?setImmediate(function(){afterWrite(e,r,f,n)}):afterWrite(e,r,f,n)}}function afterWrite(e,t,r,i){r||onwriteDrain(e,t),i(),r&&finishMaybe(e,t)}function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function clearBuffer(e,t){t.bufferProcessing=!0;for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r],n=i.chunk,f=i.encoding,o=i.callback,a=t.objectMode?1:n.length;if(doWrite(e,t,a,n,f,o),t.writing){r++;break}}t.bufferProcessing=!1,r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}function needFinish(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function finishMaybe(e,t){var r=needFinish(e,t);return r&&(t.finished=!0,e.emit("finish")),r}function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?setImmediate(r):e.once("finish",r)),t.ended=!0}module.exports=Writable,Writable.WritableState=WritableState;var isUint8Array="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array}:function(e){return e&&e.constructor&&"Uint8Array"===e.constructor.name},isArrayBuffer="undefined"!=typeof ArrayBuffer?function(e){return e instanceof ArrayBuffer}:function(e){return e&&e.constructor&&"ArrayBuffer"===e.constructor.name},inherits=require("inherits"),Stream=require("./index.js"),setImmediate=require("process/browser.js").nextTick,Buffer=require("buffer").Buffer;inherits(Writable,Stream),Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},Writable.prototype.write=function(e,t,r){var i=this._writableState,n=!1;return"function"==typeof t&&(r=t,t=null),!Buffer.isBuffer(e)&&isUint8Array(e)&&(e=new Buffer(e)),isArrayBuffer(e)&&"undefined"!=typeof Uint8Array&&(e=new Buffer(new Uint8Array(e))),Buffer.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=function(){}),i.ended?writeAfterEnd(this,i,r):validChunk(this,i,e,r)&&(n=writeOrBuffer(this,i,e,t,r)),n},Writable.prototype._write=function(e,t,r){r(new Error("not implemented"))},Writable.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),i.endin
11 years ago
},{"./index.js":117,"buffer":93,"inherits":109,"process/browser.js":118}],123:[function(require,module,exports){
function assertEncoding(e){if(e&&!Buffer.isEncoding(e))throw new Error("Unknown encoding: "+e)}function passThroughWrite(e){return e.toString(this.encoding)}function utf16DetectIncompleteChar(e){var t=this.charReceived=e.length%2;return this.charLength=t?2:0,t}function base64DetectIncompleteChar(e){var t=this.charReceived=e.length%3;return this.charLength=t?3:0,t}var Buffer=require("buffer").Buffer,StringDecoder=exports.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=base64DetectIncompleteChar;break;default:return void(this.write=passThroughWrite)}this.charBuffer=new Buffer(6),this.charReceived=0,this.charLength=0};StringDecoder.prototype.write=function(e){for(var t="",r=0;this.charLength;){var h=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,r,h),this.charReceived+=h-r,r=h,this.charReceived<this.charLength)return"";t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,h==e.length)return t;e=e.slice(h,e.length);break}this.charLength+=this.surrogateSize,t=""}var c=this.detectIncompleteChar(e),n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-c,n),this.charReceived=c,n-=c),t+=e.toString(this.encoding,0,n);var n=t.length-1,i=t.charCodeAt(n);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(t.charAt(t.length-1),this.encoding),t.substring(0,n)}return t},StringDecoder.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}return t},StringDecoder.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,h=this.charBuffer,i=this.encoding;t+=h.slice(0,r).toString(i)}return t};
11 years ago
},{"buffer":93}],124:[function(require,module,exports){
!function(){"use strict";function t(t,h,a){if(t&&"object"==typeof t&&t.href)return t;if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n={},p=t;p=p.trim();var i=r.exec(p);if(i){i=i[0];var q=i.toLowerCase();n.protocol=q,p=p.substr(i.length)}if(a||i||p.match(/^\/\/[^@\/]+@[^@\/]+/)){var j="//"===p.substr(0,2);!j||i&&g[i]||(p=p.substr(2),n.slashes=!0)}if(!g[i]&&(j||i&&!y[i])){var x=p.indexOf("@");if(-1!==x){for(var A=p.slice(0,x),O=!0,z=0,C=m.length;C>z;z++)if(-1!==A.indexOf(m[z])){O=!1;break}O&&(n.auth=decodeURIComponent(A),p=p.substr(x+1))}for(var Z=-1,z=0,C=f.length;C>z;z++){var k=p.indexOf(f[z]);-1!==k&&(0>Z||Z>k)&&(Z=k)}-1!==Z?(n.host=p.substr(0,Z),p=p.substr(Z)):(n.host=p,p="");for(var w=s(n.host),I=Object.keys(w),z=0,C=I.length;C>z;z++){var R=I[z];n[R]=w[R]}n.hostname=n.hostname||"";var U="["===n.hostname[0]&&"]"===n.hostname[n.hostname.length-1];if(n.hostname.length>l)n.hostname="";else if(!U)for(var $=n.hostname.split(/\./),z=0,C=$.length;C>z;z++){var _=$[z];if(_&&!_.match(u)){for(var L="",E=0,P=_.length;P>E;E++)L+=_.charCodeAt(E)>127?"x":_[E];if(!L.match(u)){var T=$.slice(0,z),B=$.slice(z+1),D=_.match(v);D&&(T.push(D[1]),B.unshift(D[2])),B.length&&(p="/"+B.join(".")+p),n.hostname=T.join(".");break}}}if(n.hostname=n.hostname.toLowerCase(),!U){for(var F=n.hostname.split("."),G=[],z=0;z<F.length;++z){var H=F[z];G.push(H.match(/[^A-Za-z0-9_-]/)?"xn--"+o.encode(H):H)}n.hostname=G.join(".")}n.host=(n.hostname||"")+(n.port?":"+n.port:""),n.href+=n.host,U&&(n.hostname=n.hostname.substr(1,n.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!d[q])for(var z=0,C=c.length;C>z;z++){var J=c[z],K=encodeURIComponent(J);K===J&&(K=escape(J)),p=p.split(J).join(K)}var M=p.indexOf("#");-1!==M&&(n.hash=p.substr(M),p=p.slice(0,M));var N=p.indexOf("?");return-1!==N?(n.search=p.substr(N),n.query=p.substr(N+1),h&&(n.query=b.parse(n.query)),p=p.slice(0,N)):h&&(n.search="",n.query={}),p&&(n.pathname=p),y[i]&&n.hostname&&!n.pathname&&(n.pathname="/"),(n.pathname||n.search)&&(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=e(n),n}function e(e){"string"==typeof e&&(e=t(e));var h=e.auth||"";h&&(h=encodeURIComponent(h),h=h.replace(/%3A/i,":"),h+="@");var a=e.protocol||"",s=e.pathname||"",o=e.hash||"",r=!1,n="";void 0!==e.host?r=h+e.host:void 0!==e.hostname&&(r=h+(-1===e.hostname.indexOf(":")?e.hostname:"["+e.hostname+"]"),e.port&&(r+=":"+e.port)),e.query&&"object"==typeof e.query&&Object.keys(e.query).length&&(n=b.stringify(e.query));var p=e.search||n&&"?"+n||"";return a&&":"!==a.substr(-1)&&(a+=":"),e.slashes||(!a||y[a])&&r!==!1?(r="//"+(r||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):r||(r=""),o&&"#"!==o.charAt(0)&&(o="#"+o),p&&"?"!==p.charAt(0)&&(p="?"+p),a+r+s+p+o}function h(t,h){return e(a(t,h))}function a(h,a){if(!h)return a;if(h=t(e(h),!1,!0),a=t(e(a),!1,!0),h.hash=a.hash,""===a.href)return h.href=e(h),h;if(a.slashes&&!a.protocol)return a.protocol=h.protocol,y[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=e(a),a;if(a.protocol&&a.protocol!==h.protocol){if(!y[a.protocol])return a.href=e(a),a;if(h.protocol=a.protocol,!a.host&&!g[a.protocol]){for(var s=(a.pathname||"").split("/");s.length&&!(a.host=s.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==s[0]&&s.unshift(""),s.length<2&&s.unshift(""),a.pathname=s.join("/")}return h.pathname=a.pathname,h.search=a.search,h.query=a.query,h.host=a.host||"",h.auth=a.auth,h.hostname=a.hostname||a.host,h.port=a.port,(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.slashes=h.slashes||a.slashes,h.href=e(h),h}var o=h.pathname&&"/"===h.pathname.charAt(0),r=void 0!==a.host||a.pathname&&"/"===a.pathname.charAt(0),n=r||o||h.host&&a.pathname,p=n,i=h.pathname&&h.pathname.split("/")||[],s=a.pathname&&a.pathname.split("/")||[],c=h.protocol&&!y[h.protocol];if(c&&(delete h.hostname,delete h.port,h.host&&(""===i[0]?i[0]=h.host:i.unshift(h.host)),delete h.host,a.protocol&&(delete a.hostname,delete a.port,a.host&&(""===s[0]?s[0]=a.host:s.unshift(a.host)),delete a.host),n=n&&(""===s[
11 years ago
},{"punycode":112,"querystring":115}],125:[function(require,module,exports){
module.exports=require(91)
},{}],126:[function(require,module,exports){
module.exports=require(92)
},{"./support/isBuffer":125,"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"inherits":109}],"bufferput":[function(require,module,exports){
module.exports=require('aXRuS6');
},{}],"aXRuS6":[function(require,module,exports){
(function(t){function e(){this.words=[],this.len=0}module.exports=e,e.prototype.put=function(t){return this.words.push({buffer:t}),this.len+=t.length,this},e.prototype.word8=function(t){return this.words.push({bytes:1,value:t}),this.len+=1,this},e.prototype.floatle=function(t){return this.words.push({bytes:"float",endian:"little",value:t}),this.len+=4,this},e.prototype.varint=function(t){253>t?this.word8(t):65536>=t?(this.word8(253),this.word16le(t)):1>=t?(this.word8(254),this.word32le(t)):(this.word8(255),this.word64le(t))},[8,16,24,32,64].forEach(function(t){e.prototype["word"+t+"be"]=function(e){return this.words.push({endian:"big",bytes:t/8,value:e}),this.len+=t/8,this},e.prototype["word"+t+"le"]=function(e){return this.words.push({endian:"little",bytes:t/8,value:e}),this.len+=t/8,this}}),e.prototype.pad=function(t){return this.words.push({endian:"big",bytes:t,value:0}),this.len+=t,this},e.prototype.length=function(){return this.len},e.prototype.buffer=function(){var e=new t(this.len),o=0;return this.words.forEach(function(t){if(t.buffer)t.buffer.copy(e,o,0),o+=t.buffer.length;else if("float"==t.bytes){var r=Math.abs(t.value),i=1*(t.value>=0),n=Math.ceil(Math.log(r)/Math.LN2),s=r/(1<<n);e[o++]=i<<7&~~(n/2),e[o++]=(1&n)<<7&~~(s/65536),e[o++]=0,e[o++]=0,o+=4}else for(var h="big"===t.endian,u=h?[8*(t.bytes-1),-8]:[0,8],l=u[0];h?l>=0:l<8*t.bytes;l+=u[1])e[o++]=l>=32?255&Math.floor(t.value/Math.pow(2,l)):t.value>>l&255}),e},e.prototype.write=function(t){t.write(this.buffer())}}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93}],"buffers":[function(require,module,exports){
module.exports=require('OBo3aV');
},{}],"OBo3aV":[function(require,module,exports){
(function(t){function e(t){return this instanceof e?(this.buffers=t||[],void(this.length=this.buffers.reduce(function(t,e){return t+e.length},0))):new e(t)}module.exports=e,e.prototype.push=function(){for(var e=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))throw new TypeError("Tried to push a non-buffer");for(var e=0;e<arguments.length;e++){var r=arguments[e];this.buffers.push(r),this.length+=r.length}return this.length},e.prototype.unshift=function(){for(var e=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))throw new TypeError("Tried to unshift a non-buffer");for(var e=0;e<arguments.length;e++){var r=arguments[e];this.buffers.unshift(r),this.length+=r.length}return this.length},e.prototype.copy=function(t,e,r,n){return this.slice(r,n).copy(t,e,0,n-r)},e.prototype.splice=function(r,n){var s=this.buffers,i=r>=0?r:this.length-r,h=[].slice.call(arguments,2);void 0===n?n=this.length-i:n>this.length-i&&(n=this.length-i);for(var r=0;r<h.length;r++)this.length+=h[r].length;for(var f=new e,o=0,l=0;l<s.length&&o+s[l].length<i;l++)o+=s[l].length;if(i-o>0){var u=i-o;if(u+n<s[l].length){f.push(s[l].slice(u,u+n));for(var g=s[l],p=new t(u),r=0;u>r;r++)p[r]=g[r];for(var a=new t(g.length-u-n),r=u+n;r<g.length;r++)a[r-n-u]=g[r];if(h.length>0){var c=h.slice();c.unshift(p),c.push(a),s.splice.apply(s,[l,1].concat(c)),l+=c.length,h=[]}else s.splice(l,1,p,a),l+=2}else f.push(s[l].slice(u)),s[l]=s[l].slice(0,u),l++}for(h.length>0&&(s.splice.apply(s,[l,0].concat(h)),l+=h.length);f.length<n;){var v=s[l],b=v.length,y=Math.min(b,n-f.length);y===b?(f.push(v),s.splice(l,1)):(f.push(v.slice(0,y)),s[l]=s[l].slice(y))}return this.length-=f.length,f},e.prototype.slice=function(e,r){var n=this.buffers;void 0===r&&(r=this.length),void 0===e&&(e=0),r>this.length&&(r=this.length);for(var s=0,i=0;i<n.length&&s+n[i].length<=e;i++)s+=n[i].length;for(var h=new t(r-e),f=0,o=i;r-e>f&&o<n.length;o++){var l=n[o].length,u=0===f?e-s:0,g=f+l>=r-e?Math.min(u+(r-e)-f,l):l;n[o].copy(h,f,u,g),f+=g-u}return h},e.prototype.pos=function(t){if(0>t||t>=this.length)throw new Error("oob");for(var e=t,r=0,n=null;;){if(n=this.buffers[r],e<n.length)return{buf:r,offset:e};e-=n.length,r++}},e.prototype.get=function(t){var e=this.pos(t);return this.buffers[e.buf].get(e.offset)},e.prototype.set=function(t,e){var r=this.pos(t);return this.buffers[r.buf].set(r.offset,e)},e.prototype.indexOf=function(e,r){if("string"==typeof e)e=new t(e);else if(!(e instanceof t))throw new Error("Invalid type for a search string");if(!e.length)return 0;if(!this.length)return-1;var n,s=0,i=0,h=0,f=0;if(r){var o=this.pos(r);s=o.buf,i=o.offset,f=r}for(;;){for(;i>=this.buffers[s].length;)if(i=0,s++,s>=this.buffers.length)return-1;var l=this.buffers[s][i];if(l==e[h]){if(0==h&&(n={i:s,j:i,pos:f}),h++,h==e.length)return n.pos}else 0!=h&&(s=n.i,i=n.j,f=n.pos,h=0);i++,f++}},e.prototype.toBuffer=function(){return this.slice()},e.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)}}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93}],131:[function(require,module,exports){
var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("./elliptic/rand"),elliptic.hmacDRBG=require("./elliptic/hmac-drbg"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec");
11 years ago
},{"../package.json":152,"./elliptic/curve":134,"./elliptic/curves":137,"./elliptic/ec":138,"./elliptic/hmac-drbg":141,"./elliptic/rand":142,"./elliptic/utils":143}],132:[function(require,module,exports){
function BaseCurve(t,e){this.type=t,this.p=new bn(e.p,16),this.red=e.prime?bn.red(e.prime):bn.mont(this.p),this.zero=new bn(0).toRed(this.red),this.one=new bn(1).toRed(this.red),this.two=new bn(2).toRed(this.red),this.n=e.n&&new bn(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4)}function BasePoint(t,e){this.curve=t,this.type=e,this.precomputed=null}var assert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),getNAF=elliptic.utils.getNAF,getJSF=elliptic.utils.getJSF;module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(t,e){var n=t._getDoubles(),r=getNAF(e,1),i=(1<<n.step+1)-(n.step%2===0?2:1);i/=3;for(var o=[],s=0;s<r.length;s+=n.step){for(var a=0,e=s+n.step-1;e>=s;e--)a=(a<<1)+r[e];o.push(a)}for(var u=this.jpoint(null,null,null),p=this.jpoint(null,null,null),l=i;l>0;l--){for(var s=0;s<o.length;s++){var a=o[s];a===l?p=p.mixedAdd(n.points[s]):a===-l&&(p=p.mixedAdd(n.points[s].neg()))}u=u.add(p)}return u.toP()},BaseCurve.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=getNAF(e,n),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var e=0;a>=0&&0===o[a];a--)e++;if(a>=0&&e++,s=s.dblp(e),0>a)break;var u=o[a];assert(0!==u),s="affine"===t.type?s.mixedAdd(u>0?i[u-1>>1]:i[-u-1>>1].neg()):s.add(u>0?i[u-1>>1]:i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},BaseCurve.prototype._wnafMulAdd=function(t,e,n,r){for(var i=this._wnafT1,o=this._wnafT2,s=this._wnafT3,a=0,u=0;r>u;u++){var p=e[u],l=p._getNAFPoints(t);i[u]=l.wnd,o[u]=l.points}for(var u=r-1;u>=1;u-=2){var d=u-1,h=u;if(1===i[d]&&1===i[h]){var f=[e[d],null,null,e[h]];0===e[d].y.cmp(e[h].y)?(f[1]=e[d].add(e[h]),f[2]=e[d].toJ().mixedAdd(e[h].neg())):0===e[d].y.cmp(e[h].y.redNeg())?(f[1]=e[d].toJ().mixedAdd(e[h]),f[2]=e[d].add(e[h].neg())):(f[1]=e[d].toJ().mixedAdd(e[h]),f[2]=e[d].toJ().mixedAdd(e[h].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(n[d],n[h]);a=Math.max(g[0].length,a),s[d]=new Array(a),s[h]=new Array(a);for(var m=0;a>m;m++){var c=0|g[0][m],w=0|g[1][m];s[d][m]=v[3*(c+1)+(w+1)],s[h][m]=0,o[d]=f}}else s[d]=getNAF(n[d],i[d]),s[h]=getNAF(n[h],i[h]),a=Math.max(s[d].length,a),a=Math.max(s[h].length,a)}for(var b=this.jpoint(null,null,null),y=this._wnafT4,u=a;u>=0;u--){for(var A=0;u>=0;){for(var _=!0,m=0;r>m;m++)y[m]=0|s[m][u],0!==y[m]&&(_=!1);if(!_)break;A++,u--}if(u>=0&&A++,b=b.dblp(A),0>u)break;for(var m=0;r>m;m++){var p,B=y[m];0!==B&&(B>0?p=o[m][B-1>>1]:0>B&&(p=o[m][-B-1>>1].neg()),b="affine"===p.type?b.mixedAdd(p):b.add(p))}}for(var u=0;r>u;u++)o[u]=null;return b.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.validate=function(){return this.curve.validate(this)},BasePoint.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},BasePoint.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;e>i;i+=t){for(var o=0;t>o;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},BasePoint.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;n>i;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(t){for(var e=this,n=0;t>n;n++)e=e.dbl();return e};
11 years ago
},{"../../elliptic":131,"assert":90,"bn.js":144}],133:[function(require,module,exports){
function EdwardsCurve(t){this.twisted=1!=t.a,this.mOneA=this.twisted&&-1==t.a,this.extended=this.mOneA,Base.call(this,"mont",t),this.a=new bn(t.a,16).mod(this.red.m).toRed(this.red),this.c=new bn(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new bn(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==t.c}function Point(t,e,r,i,d){Base.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new bn(e,16),this.y=new bn(r,16),this.z=i?new bn(i,16):this.curve.one,this.t=d&&new bn(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}var assert=require("assert"),curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,getNAF=elliptic.utils.getNAF;inherits(EdwardsCurve,Base),module.exports=EdwardsCurve,EdwardsCurve.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.point=function(t,e,r,i){return new Point(this,t,e,r,i)},EdwardsCurve.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},EdwardsCurve.prototype.pointFromJSON=function(t){return Point.fromJSON(this,t)},EdwardsCurve.prototype.pointFromX=function(t,e){e=new bn(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),d=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=i.redMul(d.redInvm()).redSqrt(),u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s,curve.one)},EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),d=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(d)},inherits(Point,Base.BasePoint),Point.fromJSON=function(t,e){return new Point(t,e[0],e[1],e[2])},Point.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16)+" y: "+this.y.fromRed().toString(16)+" z: "+this.z.fromRed().toString(16)+">"},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),u=s.redSub(r),n=i.redSub(e),h=d.redMul(u),o=s.redMul(n),l=d.redMul(n),c=u.redMul(s);return this.curve.point(h,o,c,l)},Point.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),e=this.x.redSqr(),r=this.y.redSqr();if(this.curve.twisted){var i=this.curve._mulA(e),d=i.redAdd(r);if(this.zOne)var s=t.redSub(e).redSub(r).redMul(d.redSub(this.curve.two)),u=d.redMul(i.redSub(r)),n=d.redSqr().redSub(d).redSub(d);else var h=this.z.redSqr(),o=d.redSub(h).redISub(h),s=t.redSub(e).redISub(r).redMul(o),u=d.redMul(i.redSub(r)),n=d.redMul(o)}else var i=e.redAdd(r),h=this.curve._mulC(redMul(this.z)).redSqr(),o=i.redSub(h).redSub(h),s=this.curve._mulC(t.redISub(i)).redMul(o),u=this.curve._mulC(i).redMul(e.redISub(r)),n=i.redMul(o);return this.curve.point(s,u,n)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),u=d.redSub(i),n=d.redAdd(i),h=r.redAdd(e),o=s.redMul(u),l=n.redMul(h),c=s.redMul(h),p=u.redMul(n);return this.curve.point(o,l,p,c)},Point.prototype._projAdd=functio
11 years ago
},{"../../elliptic":131,"../curve":134,"assert":90,"bn.js":144,"inherits":151}],134:[function(require,module,exports){
var curve=exports;curve.base=require("./base"),curve.short=require("./short"),curve.mont=require("./mont"),curve.edwards=require("./edwards");
11 years ago
},{"./base":132,"./edwards":133,"./mont":135,"./short":136}],135:[function(require,module,exports){
function MontCurve(t){Base.call(this,"mont",t),this.a=new bn(t.a,16).toRed(this.red),this.b=new bn(t.b,16).toRed(this.red),this.i4=new bn(4).toRed(this.red).redInvm(),this.two=new bn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(t,e,r){Base.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bn(e,16),this.z=new bn(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var assert=require("assert"),curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,getNAF=elliptic.utils.getNAF;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.point=function(t,e){return new Point(this,t,e)},MontCurve.prototype.pointFromJSON=function(t){return Point.fromJSON(this,t)},MontCurve.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e),n=i.redSqrt();return 0===n.redSqr().cmp(i)},inherits(Point,Base.BasePoint),Point.prototype.precompute=function(){},Point.fromJSON=function(t,e){return new Point(t,e[0],e[1]||t.one)},Point.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16)+" z: "+this.z.fromRed().toString(16)+">"},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),i=r.redSqr(),n=e.redSub(i),o=e.redMul(i),d=n.redMul(i.redAdd(this.curve.a24.redMul(n)));return this.curve.point(o,d)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z),d=o.redMul(r),s=n.redMul(i),u=e.z.redMul(d.redAdd(s).redSqr()),h=e.x.redMul(d.redISub(s).redSqr());return this.curve.point(u,h)},Point.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=this,o=[];0!==e.cmpn(0);e.ishrn(1))o.push(e.andln(1));for(var d=o.length-1;d>=0;d--)0===o[d]?(r=r.diffAdd(i,n),i=i.dbl()):(i=r.diffAdd(i,n),r=r.dbl());return i},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()};
11 years ago
},{"../../elliptic":131,"../curve":134,"assert":90,"bn.js":144,"inherits":151}],136:[function(require,module,exports){
function ShortCurve(r){Base.call(this,"short",r),this.a=new bn(r.a,16).toRed(this.red),this.b=new bn(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(r,e,t,d){Base.BasePoint.call(this,r,"affine"),null===e&&null===t?(this.x=null,this.y=null,this.inf=!0):(this.x=new bn(e,16),this.y=new bn(t,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(r,e,t,d){Base.BasePoint.call(this,r,"jacobian"),null===e&&null===t&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bn(0)):(this.x=new bn(e,16),this.y=new bn(t,16),this.z=new bn(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var assert=require("assert"),curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,getNAF=elliptic.utils.getNAF;inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(r){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,t;if(r.beta)e=new bn(r.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);e=d[0].cmp(d[1])<0?d[0]:d[1],e=e.toRed(this.red)}if(r.lambda)t=new bn(r.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?t=i[0]:(t=i[1],assert(0===this.g.mul(t).x.cmp(this.g.x.redMul(e))))}var n;return n=r.basis?r.basis.map(function(r){return{a:new bn(r.a,16),b:new bn(r.b,16)}}):this._getEndoBasis(t),{beta:e,lambda:t,basis:n}}},ShortCurve.prototype._getEndoRoots=function(r){var e=r===this.p?this.red:bn.mont(r),t=new bn(2).toRed(e).redInvm(),d=t.redNeg(),i=(new bn(1).toRed(e),new bn(3).toRed(e).redNeg().redSqrt().redMul(t)),n=d.redAdd(i).fromRed(),u=d.redSub(i).fromRed();return[n,u]},ShortCurve.prototype._getEndoBasis=function(r){for(var e,t,d,i,n,u,s,o=this.n.shrn(Math.floor(this.n.bitLength()/2)),h=r,p=this.n.clone(),l=new bn(1),a=new bn(0),b=new bn(0),f=new bn(1),c=0;0!==h.cmpn(0);){var S=p.div(h),v=p.sub(S.mul(h)),I=b.sub(S.mul(l)),y=f.sub(S.mul(a));if(!d&&v.cmp(o)<0)e=s.neg(),t=l,d=v.neg(),i=I;else if(d&&2===++c)break;s=v,p=h,h=v,b=l,l=I,f=a,a=y}n=v.neg(),u=I;var A=d.sqr().add(i.sqr()),m=n.sqr().add(u.sqr());return m.cmp(A)>=0&&(n=e,u=t),d.sign&&(d=d.neg(),i=i.neg()),n.sign&&(n=n.neg(),u=u.neg()),[{a:d,b:i},{a:n,b:u}]},ShortCurve.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],d=e[1],i=d.b.mul(r).divRound(this.n),n=t.b.neg().mul(r).divRound(this.n),u=i.mul(t.a),s=n.mul(d.a),o=i.mul(t.b),h=n.mul(d.b),p=r.sub(u).sub(s),l=o.add(h).neg();return{k1:p,k2:l}},ShortCurve.prototype.point=function(r,e,t){return new Point(this,r,e,t)},ShortCurve.prototype.pointFromX=function(r,e){e=new bn(e,16),e.red||(e=e.toRed(this.red));var t=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),d=t.redSqrt(),i=d.fromRed().isOdd();return(r&&!i||!r&&i)&&(d=d.redNeg()),this.point(e,d)},ShortCurve.prototype.jpoint=function(r,e,t){return new JPoint(this,r,e,t)},ShortCurve.prototype.pointFromJSON=function(r,e){return Point.fromJSON(this,r,e)},ShortCurve.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,d=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(d).redIAdd(this.b);return 0===t.redSqr().redISub(i).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(r,e){for(var t=this._endoWnafT1,d=this._endoWnafT2,i=0;i<r.length;i++){var n=this._endoSplit(e[i]),u=r[i],s=u._getBeta();n.k1.sign&&(n.k1.sign=!n.k1.sign,u=u.neg(!0)),n.k2.sign&&(n.k2.sign=!n.k2.sign,s=s.neg(!0)),t[2*i]=u,t[2*i+1]=s,d[2*i]=n.k1,d[2*i+1]=n.k2}for(var o=this._wnafMulAdd(1,t,d,2*i),h=0;2*i>h;h++)t[h]=null,d[h]=null;return o},inherits(Point,Base.BasePoint),Point.prototype._getBeta=function(){function r(r){return
11 years ago
},{"../../elliptic":131,"../curve":134,"assert":90,"bn.js":144,"inherits":151}],137:[function(require,module,exports){
function PresetCurve(f){this.curve="short"===f.type?new elliptic.curve.short(f):"edwards"===f.type?new elliptic.curve.edwards(f):new elliptic.curve.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(f,e){Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,get:function(){var d=new PresetCurve(e);return Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,value:d}),d}})}var curves=exports,assert=require("assert"),hash=require("hash.js"),bn=require("bn.js"),elliptic=require("../elliptic");curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]}),defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",{doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b7456388
11 years ago
},{"../elliptic":131,"assert":90,"bn.js":144,"hash.js":145}],138:[function(require,module,exports){
function EC(t){return this instanceof EC?("string"==typeof t&&(t=elliptic.curves[t]),t instanceof elliptic.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),void(this.hash=t.hash||t.curve.hash)):new EC(t)}var assert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(t,e){return new KeyPair(this,t,e)},EC.prototype.genKeyPair=function(t){t||(t={});for(var e=new elliptic.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||elliptic.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new bn(2));;){var r=new bn(e.generate(n));if(!(r.cmp(i)>0))return r.iaddn(1),this.keyPair(r)}},EC.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.shrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},EC.prototype.sign=function(t,e,n){e=this.keyPair(e,"hex"),t=this._truncateToN(new bn(t,16)),n||(n={});for(var i=this.n.byteLength(),r=e.getPrivate().toArray(),h=r.length;21>h;h++)r.unshift(0);for(var s=t.toArray(),h=s.length;i>h;h++)s.unshift(0);for(var u=new elliptic.hmacDRBG({hash:this.hash,entropy:r,nonce:s}),a=this.n.sub(new bn(1));;){var c=new bn(u.generate(this.n.byteLength()));if(c=this._truncateToN(c,!0),!(c.cmpn(1)<=0||c.cmp(a)>=0)){var o=this.g.mul(c);if(!o.isInfinity()){var p=o.getX().mod(this.n);if(0!==p.cmpn(0)){var v=c.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t)).mod(this.n);if(0!==v.cmpn(0))return n.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v)),new Signature(p,v)}}}}},EC.prototype.verify=function(t,e,n){t=this._truncateToN(new bn(t,16)),n=this.keyPair(n,"hex"),e=new Signature(e,"hex");var i=e.r,r=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;var h=r.invm(this.n),s=h.mul(t).mod(this.n),u=h.mul(i).mod(this.n),a=this.g.mulAdd(s,n.getPublic(),u);return a.isInfinity()?!1:0===a.getX().mod(this.n).cmp(i)};
11 years ago
},{"../../elliptic":131,"./key":139,"./signature":140,"assert":90,"bn.js":144}],139:[function(require,module,exports){
function KeyPair(t,i,e){return i instanceof KeyPair?i:e instanceof KeyPair?e:(i||(i=e,e=null),null!==i&&"object"==typeof i&&(i.x?(e=i,i=null):(i.priv||i.pub)&&(e=i.pub,i=i.priv)),this.ec=t,this.priv=null,this.pub=null,void(this._importPublicHex(i,e)||("hex"===e&&(e=null),i&&this._importPrivate(i),e&&this._importPublic(e))))}var assert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=KeyPair,KeyPair.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(t,i){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof t&&(i=t,t=null),!i)return this.pub;for(var e=this.ec.curve.p.byteLength(),r=this.pub.getX().toArray(),n=r.length;e>n;n++)r.unshift(0);if(t)var u=[this.pub.getY().isEven()?2:3].concat(r);else{for(var s=this.pub.getY().toArray(),n=s.length;e>n;n++)s.unshift(0);var u=[4].concat(r,s)}return utils.encode(u,i)},KeyPair.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16):this.priv},KeyPair.prototype._importPrivate=function(t){this.priv=new bn(t,16),this.priv=this.priv.mod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(t){this.pub=this.ec.curve.point(t.x,t.y)},KeyPair.prototype._importPublicHex=function(t,i){t=utils.toArray(t,i);var e=this.ec.curve.p.byteLength();if(4===t[0]&&t.length-1===2*e)this.pub=this.ec.curve.point(t.slice(1,1+e),t.slice(1+e,1+2*e));else{if(2!==t[0]&&3!==t[0]||t.length-1!==e)return!1;this.pub=this.ec.curve.pointFromX(3===t[0],t.slice(1,1+e))}return!0},KeyPair.prototype.derive=function(t){return t.mul(this.priv).getX()},KeyPair.prototype.sign=function(t){return this.ec.sign(t,this)},KeyPair.prototype.verify=function(t,i){return this.ec.verify(t,i,this)},KeyPair.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16))+" pub: "+(this.pub&&this.pub.inspect())+" >"};
11 years ago
},{"../../elliptic":131,"assert":90,"bn.js":144}],140:[function(require,module,exports){
function Signature(t,r){return t instanceof Signature?t:void(this._importDER(t,r)||(assert(t&&r,"Signature without r or s"),this.r=new bn(t,16),this.s=new bn(r,16)))}var assert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=Signature,Signature.prototype._importDER=function(t,r){if(t=utils.toArray(t,r),t.length<6||48!==t[0]||2!==t[2])return!1;var e=t[1];if(1+e>t.length)return!1;var n=t[3];if(n>=128)return!1;if(4+n+2>=t.length)return!1;if(2!==t[4+n])return!1;var i=t[5+n];return i>=128?!1:4+n+2+i>t.length?!1:(this.r=new bn(t.slice(4,4+n)),this.s=new bn(t.slice(4+n+2,4+n+2+i)),!0)},Signature.prototype.toDER=function(t){var r=this.r.toArray(),e=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&e[0]&&(e=[0].concat(e));var n=r.length+e.length+4,i=[48,n,2,r.length];return i=i.concat(r,[2,e.length],e),utils.encode(i,t)};
11 years ago
},{"../../elliptic":131,"assert":90,"bn.js":144}],141:[function(require,module,exports){
function HmacDRBG(t){if(!(this instanceof HmacDRBG))return new HmacDRBG(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=utils.toArray(t.entropy,t.entropyEnc),i=utils.toArray(t.nonce,t.nonceEnc),s=utils.toArray(t.pers,t.persEnc);assert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,i,s)}var assert=require("assert"),hash=require("hash.js"),elliptic=require("../elliptic"),utils=elliptic.utils;module.exports=HmacDRBG,HmacDRBG.prototype._init=function(t,e,i){var s=t.concat(e).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(s),this.reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){return new hash.hmac(this.hash,this.K)},HmacDRBG.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG.prototype.reseed=function(t,e,i,s){"string"!=typeof e&&(s=i,i=e,e=null),t=utils.toBuffer(t,e),i=utils.toBuffer(i,s),assert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(i||[])),this.reseed=1},HmacDRBG.prototype.generate=function(t,e,i,s){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(s=i,i=e,e=null),i&&(i=utils.toArray(i,s),this._update(i));for(var h=[];h.length<t;)this.V=this._hmac().update(this.V).digest(),h=h.concat(this.V);var r=h.slice(0,t);return this._update(i),this.reseed++,utils.encode(r,e)};
11 years ago
},{"../elliptic":131,"assert":90,"hash.js":145}],142:[function(require,module,exports){
function Rand(){}var assert=require("assert"),elliptic=require("../elliptic"),r;if(module.exports=function(t){return r||(r=new Rand),r.generate(t)},Rand.prototype.generate=function(r){return this._rand(r)},"object"==typeof window)Rand.prototype._rand=window.crypto&&window.crypto.getRandomValues?function(r){var t=new Uint8Array(r);return window.crypto.getRandomValues(t),t}:function(){throw new Error("Not implemented yet")};else{var crypto;Rand.prototype._rand=function(r){return crypto||(crypto=require("crypto")),crypto.randomBytes(r)}}
11 years ago
},{"../elliptic":131,"assert":90,"crypto":97}],143:[function(require,module,exports){
function toArray(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var n=[];if("string"==typeof r)if(e){if("hex"===e){r=r.replace(/[^a-z0-9]+/gi,""),r.length%2!==0&&(r="0"+r);for(var t=0;t<r.length;t+=2)n.push(parseInt(r[t]+r[t+1],16))}}else for(var t=0;t<r.length;t++){var a=r.charCodeAt(t),s=a>>8,i=255&a;s?n.push(s,i):n.push(i)}else for(var t=0;t<r.length;t++)n[t]=0|r[t];return n}function toHex(r){for(var e="",n=0;n<r.length;n++)e+=zero2(r[n].toString(16));return e}function zero2(r){return 1===r.length?"0"+r:r}function getNAF(r,e){for(var n=[],t=1<<e+1,a=r.clone();a.cmpn(1)>=0;){var s;if(a.isOdd()){var i=a.andln(t-1);s=i>(t>>1)-1?(t>>1)-i:i,a.isubn(s)}else s=0;n.push(s);for(var o=0!==a.cmpn(0)&&0===a.andln(t-1)?e+1:1,u=1;o>u;u++)n.push(0);a.ishrn(o)}return n}function getJSF(r,e){var n=[[],[]];r=r.clone(),e=e.clone();for(var t=0,a=0;r.cmpn(-t)>0||e.cmpn(-a)>0;){var s=r.andln(3)+t&3,i=e.andln(3)+a&3;3===s&&(s=-1),3===i&&(i=-1);var o;if(0===(1&s))o=0;else{var u=r.andln(7)+t&7;o=3!==u&&5!==u||2!==i?s:-s}n[0].push(o);var l;if(0===(1&i))l=0;else{var u=e.andln(7)+a&7;l=3!==u&&5!==u||2!==s?i:-i}n[1].push(l),2*t===o+1&&(t=1-t),2*a===l+1&&(a=1-a),r.ishrn(1),e.ishrn(1)}return n}var assert=require("assert"),bn=require("bn.js"),utils=exports;utils.toArray=toArray,utils.toHex=toHex,utils.encode=function(r,e){return"hex"===e?toHex(r):r},utils.zero2=zero2,utils.getNAF=getNAF,utils.getJSF=getJSF;
11 years ago
},{"assert":90,"bn.js":144}],144:[function(require,module,exports){
function assert(t,r){if(!t)throw new Error(r||"Assertion failed")}function assertEqual(t,r,i){if(t!=r)throw new Error(i||"Assertion failed: "+t+" != "+r)}function inherits(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function BN(t,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,void(null!==t&&this._init(t||0,r||10)))}function zero6(t){return 5===t.length?"0"+t:4===t.length?"00"+t:3===t.length?"000"+t:2===t.length?"0000"+t:1===t.length?"00000"+t:t}function zero14(t){return 13===t.length?"0"+t:12===t.length?"00"+t:11===t.length?"000"+t:10===t.length?"0000"+t:9===t.length?"00000"+t:8===t.length?"000000"+t:7===t.length?"0000000"+t:6===t.length?"00000000"+t:5===t.length?"000000000"+t:4===t.length?"0000000000"+t:3===t.length?"00000000000"+t:2===t.length?"000000000000"+t:1===t.length?"0000000000000"+t:t}function MPrime(t,r){this.name=t,this.p=new BN(r,16),this.n=this.p.bitLength(),this.k=new BN(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var r=BN._prime(t);this.m=r.p,this.prime=r}else this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new BN(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r.invm(this.m),this.minv=this.rinv.mul(this.r).sub(new BN(1)).div(this.m).neg().mod(this.r)}module.exports=BN,BN.BN=BN,BN.wordSize=26,BN.prototype._init=function(t,r){if("number"==typeof t)return 0>t&&(this.sign=!0,t=-t),this.words=[67108863&t],void(this.length=1);if("object"==typeof t){assert("number"==typeof t.length),this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;for(var s=0,i=t.length-1,n=0;i>=0;i-=3){var e=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[n]|=e<<s&67108863,this.words[n+1]=e>>>26-s&67108863,s+=24,s>=26&&(s-=26,n++)}return this.strip()}"hex"===r&&(r=16),assert(16>=r),t=t.toString().replace(/\s+/g,"");var h=0;"-"===t[0]&&h++,16===r?this._parseHex(t,h):this._parseBase(t,r,h),"-"===t[0]&&(this.sign=!0),this.strip()},BN.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;for(var s=0,i=t.length-6,n=0;i>=r;i-=6){var e=parseInt(t.slice(i,i+6),16);this.words[n]|=e<<s&67108863,this.words[n+1]|=e>>>26-s&4194303,s+=24,s>=26&&(s-=26,n++)}if(i+6!==r){var e=parseInt(t.slice(r,i+6),16);this.words[n]|=e<<s&67108863,this.words[n+1]|=e>>>26-s&4194303}this.strip()},BN.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var s=0,n=1,e=0,h=null,o=i;o<t.length;o++){var f,d=t[o];f=10===r||"9">=d?0|d:d>="a"?d.charCodeAt(0)-97+10:d.charCodeAt(0)-65+10,s*=r,s+=f,n*=r,e++,n>1048575&&(assert(67108863>=n),h||(h=new BN(n)),this.mul(h).copy(this),this.iadd(new BN(s)),s=0,n=1,e=0)}0!==e&&(this.mul(new BN(n)).copy(this),this.iadd(new BN(s)))},BN.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.sign=this.sign,t.red=this.red},BN.prototype.clone=function(){var t=new BN(null);return this.copy(t),t},BN.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var div10=new BN(null);div10.words=[8011776,1490116],div10.length=2,BN.prototype.toString=funct
11 years ago
},{}],145:[function(require,module,exports){
var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.ripemd160=hash.ripemd.ripemd160;
11 years ago
},{"./hash/common":146,"./hash/hmac":147,"./hash/ripemd":148,"./hash/sha":149,"./hash/utils":150}],146:[function(require,module,exports){
function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.endian="big"}var hash=require("../hash"),utils=hash.utils,assert=utils.assert;exports.BlockHash=BlockHash,BlockHash.prototype.update=function(t,i){if(t=utils.toArray(t,i),this.pending=this.pending?this.pending.concat(t):t,this.pendingTotal+=t.length,this.pending.length>=this.blockSize/8){t=this.pending;var n=t.length%(this.blockSize/8);this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=utils.join32(t.slice(0,t.length-n),this.endian);for(var s=0;s<t.length;s+=this.blockSize/32)this._update(t.slice(s,s+this.blockSize/32))}return this},BlockHash.prototype.digest=function(t){return this.update(this._pad()),assert(null===this.pending),this._digest(t)},BlockHash.prototype._pad=function(){var t=this.pendingTotal,i=this.blockSize/8,n=i-(t+8)%i,s=new Array(n+8);s[0]=128;for(var e=1;n>e;e++)s[e]=0;return t<<=3,"big"===this.endian?(s[e++]=0,s[e++]=0,s[e++]=0,s[e++]=0,s[e++]=t>>>24&255,s[e++]=t>>>16&255,s[e++]=t>>>8&255,s[e++]=255&t):(s[e++]=255&t,s[e++]=t>>>8&255,s[e++]=t>>>16&255,s[e++]=t>>>24&255,s[e++]=0,s[e++]=0,s[e++]=0,s[e++]=0),s};
11 years ago
},{"../hash":145}],147:[function(require,module,exports){
function Hmac(t,s,e){return this instanceof Hmac?(this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,void this._init(utils.toArray(s,e))):new Hmac(t,s,e)}var hmac=exports,hash=require("../hash"),utils=hash.utils,assert=utils.assert;module.exports=Hmac,Hmac.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),assert(t.length<=this.blockSize);for(var s=t.length;s<this.blockSize;s++)t.push(0);for(var e=t.slice(),s=0;s<t.length;s++)t[s]^=54,e[s]^=92;this.hash={inner:(new this.Hash).update(t),outer:(new this.Hash).update(e)}},Hmac.prototype.update=function(t,s){return this.hash.inner.update(t,s),this},Hmac.prototype.digest=function(t){return this.hash.outer.update(this.hash.inner.digest()),this.hash.outer.digest(t)};
11 years ago
},{"../hash":145}],148:[function(require,module,exports){
function RIPEMD160(){return this instanceof RIPEMD160?(BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.endian="little")):new RIPEMD160}function f(t,s,h,i){return 15>=t?s^h^i:31>=t?s&h|~s&i:47>=t?(s|~h)^i:63>=t?s&i|h&~i:s^(h|~i)}function K(t){return 15>=t?0:31>=t?1518500249:47>=t?1859775393:63>=t?2400959708:2840853838}function Kh(t){return 15>=t?1352829926:31>=t?1548603684:47>=t?1836072691:63>=t?2053994217:0}var hash=require("../hash"),utils=hash.utils,rotl32=utils.rotl32,sum32=utils.sum32,sum32_3=utils.sum32_3,sum32_4=utils.sum32_4,BlockHash=hash.common.BlockHash;utils.inherits(RIPEMD160,BlockHash),exports.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.prototype._update=function(t){for(var h=this.h[0],i=this.h[1],u=this.h[2],l=this.h[3],o=this.h[4],e=h,n=i,m=u,a=l,c=o,_=0;80>_;_++){var D=sum32(rotl32(sum32_4(h,f(_,i,u,l),t[r[_]],K(_)),s[_]),o);h=o,o=l,l=rotl32(u,10),u=i,i=D,D=sum32(rotl32(sum32_4(e,f(79-_,n,m,a),t[rh[_]],Kh(_)),sh[_]),c),e=c,c=a,a=rotl32(m,10),m=n,n=D}D=sum32_3(this.h[1],u,a),this.h[1]=sum32_3(this.h[2],l,c),this.h[2]=sum32_3(this.h[3],o,e),this.h[3]=sum32_3(this.h[4],h,n),this.h[4]=sum32_3(this.h[0],i,m),this.h[0]=D},RIPEMD160.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h,"little"):utils.split32(this.h,"little")};var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];
11 years ago
},{"../hash":145}],149:[function(require,module,exports){
function SHA256(){return this instanceof SHA256?(BlockHash.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],void(this.k=sha256_K)):new SHA256}function SHA224(){return this instanceof SHA224?(SHA256.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new SHA224}function ch32(t,s,h){return t&s^~t&h}function maj32(t,s,h){return t&s^t&h^s&h}function s0_256(t){return rotr32(t,2)^rotr32(t,13)^rotr32(t,22)}function s1_256(t){return rotr32(t,6)^rotr32(t,11)^rotr32(t,25)}function g0_256(t){return rotr32(t,7)^rotr32(t,18)^t>>>3}function g1_256(t){return rotr32(t,17)^rotr32(t,19)^t>>>10}var hash=require("../hash"),utils=hash.utils,assert=utils.assert,rotr32=utils.rotr32,rotl32=utils.rotl32,sum32=utils.sum32,sum32_4=utils.sum32_4,sum32_5=utils.sum32_5,BlockHash=hash.common.BlockHash,sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];utils.inherits(SHA256,BlockHash),exports.sha256=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.prototype._update=function(t){for(var s=new Array(64),h=0;16>h;h++)s[h]=t[h];for(;h<s.length;h++)s[h]=sum32_4(g1_256(s[h-2]),s[h-7],g0_256(s[h-15]),s[h-16]);var i=this.h[0],r=this.h[1],u=this.h[2],o=this.h[3],n=this.h[4],e=this.h[5],l=this.h[6],a=this.h[7];assert(this.k.length===s.length);for(var h=0;h<s.length;h++){var c=sum32_5(a,s1_256(n),ch32(n,e,l),this.k[h],s[h]),H=sum32(s0_256(i),maj32(i,r,u));a=l,l=e,e=n,n=sum32(o,c),o=u,u=r,r=i,i=sum32(c,H)}this.h[0]=sum32(this.h[0],i),this.h[1]=sum32(this.h[1],r),this.h[2]=sum32(this.h[2],u),this.h[3]=sum32(this.h[3],o),this.h[4]=sum32(this.h[4],n),this.h[5]=sum32(this.h[5],e),this.h[6]=sum32(this.h[6],l),this.h[7]=sum32(this.h[7],a)},SHA256.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h,"big"):utils.split32(this.h,"big")},utils.inherits(SHA224,SHA256),exports.sha224=SHA224,SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h.slice(0,7),"big"):utils.split32(this.h.slice(0,7),"big")};
11 years ago
},{"../hash":145}],150:[function(require,module,exports){
function toArray(t,r){if(Array.isArray(t))return t.slice();if(!t)return[];var e=[];if("string"==typeof t)if(r){if("hex"===r){t=t.replace(/[^a-z0-9]+/gi,""),t.length%2!=0&&(t="0"+t);for(var n=0;n<t.length;n+=2)e.push(parseInt(t[n]+t[n+1],16))}}else for(var n=0;n<t.length;n++){var o=t.charCodeAt(n),u=o>>8,i=255&o;u?e.push(u,i):e.push(i)}else for(var n=0;n<t.length;n++)e[n]=0|t[n];return e}function toHex(t){for(var r="",e=0;e<t.length;e++)r+=zero2(t[e].toString(16));return r}function toHex32(t,r){for(var e="",n=0;n<t.length;n++){var o=t[n];"little"===r&&(o=o>>>24|o>>>8&65280|o<<8&16711680|(255&o)<<24,0>o&&(o+=4294967296)),e+=zero8(o.toString(16))}return e}function zero2(t){return 1===t.length?"0"+t:t}function zero8(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}function join32(t,r){assert(t.length%4===0);for(var e=new Array(t.length/4),n=0,o=0;n<e.length;n++,o+=4){var u;u="big"===r?t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3]:t[o+3]<<24|t[o+2]<<16|t[o+1]<<8|t[o],0>u&&(u+=4294967296),e[n]=u}return e}function split32(t,r){for(var e=new Array(4*t.length),n=0,o=0;n<t.length;n++,o+=4){var u=t[n];"big"===r?(e[o]=u>>>24,e[o+1]=u>>>16&255,e[o+2]=u>>>8&255,e[o+3]=255&u):(e[o+3]=u>>>24,e[o+2]=u>>>16&255,e[o+1]=u>>>8&255,e[o]=255&u)}return e}function rotr32(t,r){return t>>>r|t<<32-r}function rotl32(t,r){return t<<r|t>>>32-r}function sum32(t,r){var e=t+r&4294967295;return 0>e&&(e+=4294967296),e}function sum32_3(t,r,e){var n=t+r+e&4294967295;return 0>n&&(n+=4294967296),n}function sum32_4(t,r,e,n){var o=t+r+e+n&4294967295;return 0>o&&(o+=4294967296),o}function sum32_5(t,r,e,n,o){var u=t+r+e+n+o&4294967295;return 0>u&&(u+=4294967296),u}function assert(t,r){if(!t)throw new Error(r||"Assertion failed")}var utils=exports;utils.toArray=toArray,utils.toHex=toHex,utils.toHex32=toHex32,utils.zero2=zero2,utils.zero8=zero8,utils.join32=join32,utils.split32=split32,utils.rotr32=rotr32,utils.rotl32=rotl32,utils.sum32=sum32,utils.sum32_3=sum32_3,utils.sum32_4=sum32_4,utils.sum32_5=sum32_5,utils.assert=assert,utils.inherits="function"==typeof Object.create?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t};
11 years ago
},{}],151:[function(require,module,exports){
module.exports=require(109)
},{}],152:[function(require,module,exports){
module.exports={
"name": "elliptic",
"version": "0.15.7",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"scripts": {
"test": "mocha --reporter=spec test/*-test.js"
},
"repository": {
"type": "git",
"url": "git@github.com:indutny/elliptic"
},
"keywords": [
"EC",
"Elliptic",
"curve",
"Cryptography"
],
"author": {
"name": "Fedor Indutny",
"email": "fedor@indutny.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/indutny/elliptic/issues"
},
"homepage": "https://github.com/indutny/elliptic",
"devDependencies": {
"browserify": "^3.44.2",
"mocha": "^1.18.2"
},
"dependencies": {
"bn.js": "^0.11.6",
"hash.js": "^0.2.0",
"inherits": "^2.0.1",
"uglify-js": "^2.4.13"
},
"readme": "# Elliptic [![Build Status](https://secure.travis-ci.org/indutny/elliptic.png)](http://travis-ci.org/indutny/elliptic)\n\nFast elliptic-curve cryptography in a plain javascript implementation.\n\nNOTE: Please take a look at http://safecurves.cr.yp.to/ before choosing a curve\nfor your cryptography operations.\n\n## Incentive\n\nECC is much slower than regular RSA cryptography, the JS implementations are\neven more slower.\n\n## Benchmarks\n\n```bash\n$ node benchmarks/index.js\nBenchmarking: sign\nelliptic#sign x 262 ops/sec ±0.51% (177 runs sampled)\neccjs#sign x 55.91 ops/sec ±0.90% (144 runs sampled)\n------------------------\nFastest is elliptic#sign\n========================\nBenchmarking: verify\nelliptic#verify x 113 ops/sec ±0.50% (166 runs sampled)\neccjs#verify x 48.56 ops/sec ±0.36% (125 runs sampled)\n------------------------\nFastest is elliptic#verify\n========================\nBenchmarking: gen\nelliptic#gen x 294 ops/sec ±0.43% (176 runs sampled)\neccjs#gen x 62.25 ops/sec ±0.63% (129 runs sampled)\n------------------------\nFastest is elliptic#gen\n========================\nBenchmarking: ecdh\nelliptic#ecdh x 136 ops/sec ±0.85% (156 runs sampled)\n------------------------\nFastest is elliptic#ecdh\n========================\n```\n\n## API\n\n### ECDSA\n\n```javascript\nvar EC = require('elliptic').ec;\n\n// Create and initialize EC context\n// (better do it once and reuse it)\nvar ec = new EC('secp256k1');\n\n// Generate keys\nvar key = ec.genKeyPair();\n\n// Sign message (must be an array, or it'll be treated as a hex sequence)\nvar msg = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];\nvar signature = key.sign(msg);\n\n// Export DER encoded signature in Array\nvar derSign = signature.toDER();\n\n// Verify signature\nconsole.log(key.verify(msg, derSign));\n```\n\n### ECDH\n\n```javascript\n// Generate keys\nvar key1 = ec.genKeyPair();\nvar key2 = ec.genKeyPair();\n\nvar shared1 = key1.derive(key2.getPublic());\nvar shared2 = key2.derive(key1.getPublic());\n\nconsole.log('Both shared secrets are BN instances');\nconsole.log(shared1.toString(16));\nconsole.log(shared2.toString(16));\n```\n\nNOTE: `.derive()` returns a [BN][1] instance.\n\n## Supported curves\n\nElliptic.js support following curve types:\n\n* Short Weierstrass\n* Montgomery\n* Edwards\n* Twisted Edwards\n\nFollowing curve 'presets' are embedded into the library:\n\n* `secp256k1`\n* `p192`\n* `p224`\n* `p256`\n* `curve25519`\n* `ed25519`\n\nNOTE: That `curve25519` could not be used for ECDSA, use `ed25519` instead.\n\n### Implementation details\n\nECDSA is using deterministic `k` value generation as per [RFC6979][0]. Most of\nthe curve operations are performed on non-affine coordinates (either projective\nor extended), various windowing techniques are used for different cases.\n\nAll operations are performed in reduction context using [bn.js][1], hashing is\nprovided by [hash.js][2]\n\n#### LICENSE\n\nThis software is licensed under the MIT License.\n\nCopyright Fedor Indutny, 2014.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[0]: http://tools.
"readmeFilename": "README.md",
"_id": "elliptic@0.15.7",
"_shasum": "33a3cfb88eeeeb04f0bbd06040f2cfc2fba93d2a",
"_from": "elliptic@=0.15.7",
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-0.15.7.tgz"
}
11 years ago
},{}],153:[function(require,module,exports){
var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.ripemd160=hash.ripemd.ripemd160;
11 years ago
},{"./hash/common":154,"./hash/hmac":155,"./hash/ripemd":156,"./hash/sha":157,"./hash/utils":158}],154:[function(require,module,exports){
arguments[4][146][0].apply(exports,arguments)
},{"../hash":153}],155:[function(require,module,exports){
arguments[4][147][0].apply(exports,arguments)
},{"../hash":153}],156:[function(require,module,exports){
arguments[4][148][0].apply(exports,arguments)
},{"../hash":153}],157:[function(require,module,exports){
function SHA256(){return this instanceof SHA256?(BlockHash.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],void(this.k=sha256_K)):new SHA256}function SHA224(){return this instanceof SHA224?(SHA256.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new SHA224}function SHA1(){return this instanceof SHA1?(BlockHash.call(this),void(this.h=[1732584193,4023233417,2562383102,271733878,3285377520])):new SHA1}function ch32(t,h,s){return t&h^~t&s}function maj32(t,h,s){return t&h^t&s^h&s}function p32(t,h,s){return t^h^s}function s0_256(t){return rotr32(t,2)^rotr32(t,13)^rotr32(t,22)}function s1_256(t){return rotr32(t,6)^rotr32(t,11)^rotr32(t,25)}function g0_256(t){return rotr32(t,7)^rotr32(t,18)^t>>>3}function g1_256(t){return rotr32(t,17)^rotr32(t,19)^t>>>10}function ft_1(t,h,s,i){return 0===t?ch32(h,s,i):1===t||3===t?p32(h,s,i):2===t?maj32(h,s,i):void 0}var hash=require("../hash"),utils=hash.utils,assert=utils.assert,rotr32=utils.rotr32,rotl32=utils.rotl32,sum32=utils.sum32,sum32_4=utils.sum32_4,sum32_5=utils.sum32_5,BlockHash=hash.common.BlockHash,sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],sha1_K=[1518500249,1859775393,2400959708,3395469782];utils.inherits(SHA256,BlockHash),exports.sha256=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.prototype._update=function(t){for(var h=new Array(64),s=0;16>s;s++)h[s]=t[s];for(;s<h.length;s++)h[s]=sum32_4(g1_256(h[s-2]),h[s-7],g0_256(h[s-15]),h[s-16]);var i=this.h[0],r=this.h[1],u=this.h[2],o=this.h[3],n=this.h[4],e=this.h[5],l=this.h[6],a=this.h[7];assert(this.k.length===h.length);for(var s=0;s<h.length;s++){var c=sum32_5(a,s1_256(n),ch32(n,e,l),this.k[s],h[s]),H=sum32(s0_256(i),maj32(i,r,u));a=l,l=e,e=n,n=sum32(o,c),o=u,u=r,r=i,i=sum32(c,H)}this.h[0]=sum32(this.h[0],i),this.h[1]=sum32(this.h[1],r),this.h[2]=sum32(this.h[2],u),this.h[3]=sum32(this.h[3],o),this.h[4]=sum32(this.h[4],n),this.h[5]=sum32(this.h[5],e),this.h[6]=sum32(this.h[6],l),this.h[7]=sum32(this.h[7],a)},SHA256.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h,"big"):utils.split32(this.h,"big")},utils.inherits(SHA224,SHA256),exports.sha224=SHA224,SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h.slice(0,7),"big"):utils.split32(this.h.slice(0,7),"big")},utils.inherits(SHA1,BlockHash),exports.sha1=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.prototype._update=function(t){for(var h=Array(80),s=0;16>s;s++)h[s]=t[s];for(;s<h.length;s++)h[s]=rotl32(h[s-3]^h[s-8]^h[s-14]^h[s-16],1);for(var i=this.h[0],r=this.h[1],u=this.h[2],o=this.h[3],n=this.h[4],s=0;s<h.length;s++){var e=~~(s/20),l=sum32_5(rotl32(i,5),ft_1(e,r,u,o),n,h[s],sha1_K[e]);n=o,o=u,u=rotl32(r,30),r=i,i=l}this.h[0]=sum32(this.h[0],i),this.h[1]=sum32(this.h[1],r),this.h[2]=sum32(this.h[2],u),this.h[3]=sum32(this.h[3],o),this.h[4]=sum32(this.h[4],n)},SHA1.prototype._digest=function(t){return"hex"===t?utils.toHex32(this.h,"big"):utils.split32(this.h,"big")};
11 years ago
},{"../hash":153}],158:[function(require,module,exports){
function toArray(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var n=[];if("string"==typeof r)if(t){if("hex"===t){r=r.replace(/[^a-z0-9]+/gi,""),r.length%2!=0&&(r="0"+r);for(var e=0;e<r.length;e+=2)n.push(parseInt(r[e]+r[e+1],16))}}else for(var e=0;e<r.length;e++){var i=r.charCodeAt(e),u=i>>8,o=255&i;u?n.push(u,o):n.push(o)}else for(var e=0;e<r.length;e++)n[e]=0|r[e];return n}function toHex(r){for(var t="",n=0;n<r.length;n++)t+=zero2(r[n].toString(16));return t}function toHex32(r,t){for(var n="",e=0;e<r.length;e++){var i=r[e];"little"===t&&(i=i>>>24|i>>>8&65280|i<<8&16711680|(255&i)<<24,0>i&&(i+=4294967296)),n+=zero8(i.toString(16))}return n}function zero2(r){return 1===r.length?"0"+r:r}function zero8(r){return 7===r.length?"0"+r:6===r.length?"00"+r:5===r.length?"000"+r:4===r.length?"0000"+r:3===r.length?"00000"+r:2===r.length?"000000"+r:1===r.length?"0000000"+r:r}function join32(r,t){assert(r.length%4===0);for(var n=new Array(r.length/4),e=0,i=0;e<n.length;e++,i+=4){var u;u="big"===t?r[i]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3]:r[i+3]<<24|r[i+2]<<16|r[i+1]<<8|r[i],0>u&&(u+=4294967296),n[e]=u}return n}function split32(r,t){for(var n=new Array(4*r.length),e=0,i=0;e<r.length;e++,i+=4){var u=r[e];"big"===t?(n[i]=u>>>24,n[i+1]=u>>>16&255,n[i+2]=u>>>8&255,n[i+3]=255&u):(n[i+3]=u>>>24,n[i+2]=u>>>16&255,n[i+1]=u>>>8&255,n[i]=255&u)}return n}function rotr32(r,t){return r>>>t|r<<32-t}function rotl32(r,t){return r<<t|r>>>32-t}function sum32(r,t){var n=r+t&4294967295;return 0>n&&(n+=4294967296),n}function sum32_3(r,t,n){var e=r+t+n&4294967295;return 0>e&&(e+=4294967296),e}function sum32_4(r,t,n,e){var i=r+t+n+e&4294967295;return 0>i&&(i+=4294967296),i}function sum32_5(r,t,n,e,i){var u=r+t+n+e+i&4294967295;return 0>u&&(u+=4294967296),u}function assert(r,t){if(!r)throw new Error(t||"Assertion failed")}var utils=exports,inherits=require("inherits");utils.toArray=toArray,utils.toHex=toHex,utils.toHex32=toHex32,utils.zero2=zero2,utils.zero8=zero8,utils.join32=join32,utils.split32=split32,utils.rotr32=rotr32,utils.rotl32=rotl32,utils.sum32=sum32,utils.sum32_3=sum32_3,utils.sum32_4=sum32_4,utils.sum32_5=sum32_5,utils.assert=assert,utils.inherits=inherits;
11 years ago
},{"inherits":159}],159:[function(require,module,exports){
module.exports=require(109)
},{}],160:[function(require,module,exports){
(function(Buffer){function hex2b64(t){var e,r,i="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),i+=b64map.charAt(r>>6)+b64map.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),i+=b64map.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),i+=b64map.charAt(r>>2)+b64map.charAt((3&r)<<4)),b64pad)for(;(3&i.length)>0;)i+=b64pad;return i}function b64tohex(t){var e,r,i,n="",s=0;for(e=0;e<t.length&&t.charAt(e)!=b64pad;++e)i=b64map.indexOf(t.charAt(e)),0>i||(0==s?(n+=int2char(i>>2),r=3&i,s=1):1==s?(n+=int2char(r<<2|i>>4),r=15&i,s=2):2==s?(n+=int2char(r),n+=int2char(i>>2),r=3&i,s=3):(n+=int2char(r<<2|i>>4),n+=int2char(15&i),s=0));return 1==s&&(n+=int2char(r<<2)),n}function b64toBA(t){var e,r=b64tohex(t),i=new Array;for(e=0;2*e<r.length;++e)i[e]=parseInt(r.substring(2*e,2*e+2),16);return i}function BigInteger(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function nbi(){return new BigInteger(null)}function am1(t,e,r,i,n,s){for(;--s>=0;){var o=e*this[t++]+r[i]+n;n=Math.floor(o/67108864),r[i++]=67108863&o}return n}function am2(t,e,r,i,n,s){for(var o=32767&e,a=e>>15;--s>=0;){var h=32767&this[t],u=this[t++]>>15,c=a*h+u*o;h=o*h+((32767&c)<<15)+r[i]+(1073741823&n),n=(h>>>30)+(c>>>15)+a*u+(n>>>30),r[i++]=1073741823&h}return n}function am3(t,e,r,i,n,s){for(var o=16383&e,a=e>>14;--s>=0;){var h=16383&this[t],u=this[t++]>>14,c=a*h+u*o;h=o*h+((16383&c)<<14)+r[i]+n,n=(h>>28)+(c>>14)+a*u,r[i++]=268435455&h}return n}function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){var r=BI_RC[t.charCodeAt(e)];return null==r?-1:r}function bnpCopyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function nbv(t){var e=nbi();return e.fromInt(t),e}function bnpFromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,s=0;--i>=0;){var o=8==r?255&t[i]:intAt(t,i);0>o?"-"==t.charAt(i)&&(n=!0):(n=!1,0==s?this[this.t++]=o:s+r>this.DB?(this[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this[this.t++]=o>>this.DB-s):this[this.t-1]|=o<<s,s+=r,s>=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,n=!1,s="",o=this.t,a=this.DB-o*this.DB%e;if(o-->0)for(a<this.DB&&(r=this[o]>>a)>0&&(n=!0,s=int2char(r));o>=0;)e>a?(r=(this[o]&(1<<a)-1)<<e-a,r|=this[--o]>>(a+=this.DB-e)):(r=this[o]>>(a-=e)&i,0>=a&&(a+=this.DB,--o)),r>0&&(n=!0),n&&(s+=int2char(r));return n?s:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(e=r-t.t,0!=e)return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}function bnpLShiftTo(t,e){var r,i=t%this.DB,n=this.DB-i,s=(1<<n)-1,o=Math.floor(t/this.DB),a=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)e[r+o+1]=this[r]>>n|a,a=(this[r]&s)<<i;for(r=o-1;r>=0;--r)e[r]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()}function bnpRShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return vo
}function _rsasign_signWithMessageHash(t,e){var r=KJUR.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),i=parseBigInt(r,16),n=this.doPrivate(i),s=n.toString(16);return _zeroPaddingOfSignature(s,this.n.bitLength())}function _rsasign_signStringWithSHA1(t){return _rsasign_signString.call(this,t,"sha1")}function _rsasign_signStringWithSHA256(t){return _rsasign_signString.call(this,t,"sha256")}function pss_mgf1_str(t,e,r){for(var i="",n=0;i.length<e;)i+=hextorstr(r(rstrtohex(t+String.fromCharCode.apply(String,[(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n])))),n+=1;return i}function _rsasign_signStringPSS(t,e,r){var i=function(t){return KJUR.crypto.Util.hashHex(t,e)},n=i(rstrtohex(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(n,e,r)}function _rsasign_signWithMessageHashPSS(t,e,r){var i,n=hextorstr(t),s=n.length,o=this.n.bitLength()-1,a=Math.ceil(o/8),h=function(t){return KJUR.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=a-s-2;else if(-2>r)throw"invalid salt length";if(s+r+2>a)throw"data too long";var u="";r>0&&(u=new Array(r),(new SecureRandom).nextBytes(u),u=String.fromCharCode.apply(String,u));var c=hextorstr(h(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+n+u))),g=[];for(i=0;a-r-s-2>i;i+=1)g[i]=0;var f=String.fromCharCode.apply(String,g)+""+u,p=pss_mgf1_str(c,f.length,h),l=[];for(i=0;i<f.length;i+=1)l[i]=f.charCodeAt(i)^p.charCodeAt(i);var d=65280>>8*a-o&255;for(l[0]&=~d,i=0;s>i;i++)l.push(c.charCodeAt(i));return l.push(188),_zeroPaddingOfSignature(this.doPrivate(new BigInteger(l)).toString(16),this.n.bitLength())}function _rsasign_getDecryptSignatureBI(t,e,r){var i=new RSAKey;i.setPublic(e,r);var n=i.doPublic(t);return n}function _rsasign_getHexDigestInfoFromSig(t,e,r){var i=_rsasign_getDecryptSignatureBI(t,e,r),n=i.toString(16).replace(/^1f+00/,"");return n}function _rsasign_getAlgNameAndHashFromHexDisgestInfo(t){for(var e in KJUR.crypto.Util.DIGESTINFOHEAD){var r=KJUR.crypto.Util.DIGESTINFOHEAD[e],i=r.length;if(t.substring(0,i)==r){var n=[e,t.substring(i)];return n}}return[]}function _rsasign_verifySignatureWithArgs(t,e,r,i){var n=_rsasign_getHexDigestInfoFromSig(e,r,i),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(n);if(0==s.length)return!1;var o=s[0],a=s[1],h=function(t){return KJUR.crypto.Util.hashString(t,o)},u=h(t);return a==u}function _rsasign_verifyHexSignatureForMessage(t,e){var r=parseBigInt(t,16),i=_rsasign_verifySignatureWithArgs(e,r,this.n.toString(16),this.e.toString(16));return i}function _rsasign_verifyString(t,e){e=e.replace(_RE_HEXDECONLY,""),e=e.replace(/[ \n]+/g,"");var r=parseBigInt(e,16);if(r.bitLength()>this.n.bitLength())return 0;var i=this.doPublic(r),n=i.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(n);if(0==s.length)return!1;var o=s[0],a=s[1],h=function(t){return KJUR.crypto.Util.hashString(t,o)},u=h(t);return a==u}function _rsasign_verifyWithMessageHash(t,e){e=e.replace(_RE_HEXDECONLY,""),e=e.replace(/[ \n]+/g,"");var r=parseBigInt(e,16);if(r.bitLength()>this.n.bitLength())return 0;var i=this.doPublic(r),n=i.toString(16).replace(/^1f+00/,""),s=_rsasign_getAlgNameAndHashFromHexDisgestInfo(n);if(0==s.length)return!1;var o=(s[0],s[1]);return o==t}function _rsasign_verifyStringPSS(t,e,r,i){var n=function(t){return KJUR.crypto.Util.hashHex(t,r)},s=n(rstrtohex(t));return void 0===i&&(i=-1),this.verifyWithMessageHashPSS(s,e,r,i)}function _rsasign_verifyWithMessageHashPSS(t,e,r,i){var n=new BigInteger(e,16);if(n.bitLength()>this.n.bitLength())return!1;var s,o=function(t){return KJUR.crypto.Util.hashHex(t,r)},a=hextorstr(t),h=a.length,u=this.n.bitLength()-1,c=Math.ceil(u/8);if(-1===i||void 0===i)i=h;else if(-2===i)i=c-h-2;else if(-2>i)throw"invalid salt length";if(h+i+2>c)throw"data too long";var g=this.doPublic(n).toByteArray();for(s=0;s<g.length;s+=1)g[s]&=255;for(;g.length<c;)g.unshift(0);if(188!==g[c-1])throw"encoded message does not end in 0xbc";g=String.fromCharCode.apply(String,g);var f=g.substr(0,c-h-1),p=g.substr(f.length,h),l=65280>>8*c-u&255;if(0!==(f.charCodeAt(0)&l))throw"bits beyond keysize not zer
},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,u,c,g,f,n),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,s,o,a){for(var h=this._nRounds,u=t[e]^r[0],c=t[e+1]^r[1],g=t[e+2]^r[2],f=t[e+3]^r[3],p=4,l=1;h>l;l++)var d=i[u>>>24]^n[c>>>16&255]^s[g>>>8&255]^o[255&f]^r[p++],y=i[c>>>24]^n[g>>>16&255]^s[f>>>8&255]^o[255&u]^r[p++],S=i[g>>>24]^n[f>>>16&255]^s[u>>>8&255]^o[255&c]^r[p++],f=i[f>>>24]^n[u>>>16&255]^s[c>>>8&255]^o[255&g]^r[p++],u=d,c=y,g=S;d=(a[u>>>24]<<24|a[c>>>16&255]<<16|a[g>>>8&255]<<8|a[255&f])^r[p++],y=(a[c>>>24]<<24|a[g>>>16&255]<<16|a[f>>>8&255]<<8|a[255&u])^r[p++],S=(a[g>>>24]<<24|a[f>>>16&255]<<16|a[u>>>8&255]<<8|a[255&c])^r[p++],f=(a[f>>>24]<<24|a[u>>>16&255]<<16|a[c>>>8&255]<<8|a[255&g])^r[p++],t[e]=d,t[e+1]=y,t[e+2]=S,t[e+3]=f},keySize:8});t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function e(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}var r=CryptoJS,i=r.lib,n=i.WordArray,i=i.BlockCipher,s=r.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:671
},"undefined"!=typeof t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):"undefined"!=typeof t.hex?this.setHexValueIncludingUnusedBits(t.hex):"undefined"!=typeof t.bin?this.setByBinaryString(t.bin):"undefined"!=typeof t.array&&this.setByBooleanArray(t.array))},YAHOO.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},YAHOO.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},YAHOO.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",i=new BigInteger(t,10),n=i.toString(2),s=7-n.length%7;7==s&&(s=0);for(var o="",a=0;s>a;a++)o+="0";n=o+n;for(var a=0;a<n.length-1;a+=7){var h=n.substr(a,7);a!=n.length-7&&(h="1"+h),r+=e(parseInt(h,2))}return r};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var i="",n=t.split("."),s=40*parseInt(n[0])+parseInt(n[1]);i+=e(s),n.splice(0,2);for(var o=0;o<n.length;o++)i+=r(n[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(t){if("undefined"==typeof KJUR.asn1.x509.OID.name2oidList[t])throw"DERObjectIdentifier oidName undefined: "+t;var e=KJUR.asn1.x509.OID.name2oidList[t];this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("string"==typeof t&&t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):void 0!==KJUR.asn1.x509.OID.name2oidList[t]?this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[t]):"undefined"!=typeof t.oid?this.setValueOidString(t.oid):"undefined"!=typeof t.hex?this.setValueHex(t.hex):"undefined"!=typeof t.name&&this.setValueName(t.name))},YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object),KJUR.asn1.DERUTF8String=function(t){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},YAHOO.lang.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNumericString=function(t){KJUR.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},YAHOO.lang.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERPrintableString=function(t){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},YAHOO.lang.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERTeletexString=function(t){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},YAHOO.lang.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERIA5String=function(t){KJUR.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},YAHOO.lang.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERUTCTime=function(t){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):"undefined"!=typeof t.hex?this.setStringHex(t.hex):"undefined"!=typeof t.date&&this.setByDate(t.date))},YAHOO.lang.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERGeneralizedTime=function(t){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):"undefined"!=typeof t.hex?this.setS
return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var i=this.getDigestInfoHex(t,e),n=r/4;if(i.length+22>n)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",o="00"+i,a="",h=n-s.length-o.length,u=0;h>u;u+=2)a+="ff";var c=s+a+o;return c},this.hashString=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestString(t)},this.hashHex=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestHex(t)},this.sha1=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"});return e.digestString(t)},this.sha256=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestString(t)},this.sha256Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestHex(t)},this.sha512=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestString(t)},this.sha512Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestHex(t)},this.md5=function(t){var e=new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return e.digestString(t)},this.ripemd160=function(t){var e=new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return e.digestString(t)},this.getCryptoJSMDByName=function(){}},KJUR.crypto.MessageDigest=function(params){var md=null,algName=null,provName=null;this.setAlgAndProvider=function(alg,prov){if(null!=alg&&void 0===prov&&(prov=KJUR.crypto.Util.DEFAULTPROVIDER[alg]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(alg)&&"cryptojs"==prov){try{this.md=eval(KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[alg]).create()}catch(ex){throw"setAlgAndProvider hash alg set fail alg="+alg+"/"+ex}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=CryptoJS.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return t.toString(CryptoJS.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(alg)&&"sjcl"==prov){try{this.md=new sjcl.hash.sha256}catch(ex){throw"setAlgAndProvider hash alg set fail alg="+alg+"/"+ex}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==params&&void 0!==params.alg&&(this.algName=params.alg,void 0===params.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},KJUR.crypto.Mac=function(params){var mac=null,pass=null,algName=null,provName=null,algProv=null;this.setAlgAndProvider=function(alg,prov){if(null==alg&&(alg="hmacsha1"),alg=alg.toLowerCase(),"hmac"!=alg.substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+alg;void 0===prov&&(prov=KJUR.crypto.Util.DEFAULTPROVIDER[alg]),this.algProv=alg+"/"+prov;var hashAlg=alg.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(hashAlg)&&"cryptojs"==prov){try{var mdObj=eval(KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[hashAlg]);this.mac=CryptoJS.algo.HMAC.create(mdObj,this.pass)}catch(ex){throw"setAlgAndProvider hash alg set fail hashAlg="+hashAlg+"/"+ex}this.updateString=function(t)
},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getKeyFromPlainPrivatePKCS8Hex(e);return r},getKeyFromPlainPrivatePKCS8Hex:function(t){var e=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==e.algoid){this.parsePrivateRawRSAKeyHexAtObj(t,e);var r=e.key,i=new RSAKey;return i.setPrivateEx(r.n,r.e,r.d,r.p,r.q,r.dp,r.dq,r.co),i}if("2a8648ce3d0201"==e.algoid){if(this.parsePrivateRawECKeyHexAtObj(t,e),void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var n=KJUR.crypto.OID.oidhex2name[e.algparam],i=new KJUR.crypto.ECDSA({curve:n,prv:e.key});return i}throw"unsupported private key algorithm"},getRSAKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getRSAKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8Hex:function(t){var e=this.parsePublicPKCS8Hex(t);if("2a864886f70d010101"==e.algoid){var r=this.parsePublicRawRSAKeyHex(e.key),i=new RSAKey;return i.setPublic(r.n,r.e),i}if("2a8648ce3d0201"==e.algoid){if(void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var n=KJUR.crypto.OID.oidhex2name[e.algparam],i=new KJUR.crypto.ECDSA({curve:n,pub:e.key});return i}throw"unsupported public key algorithm"},parsePublicRawRSAKeyHex:function(t){var e={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var r=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(r[0],2))throw"malformed RSA key(code:003)";if(e.n=ASN1HEX.getHexOfV_AtObj(t,r[0]),"02"!=t.substr(r[1],2))throw"malformed RSA key(code:004)";return e.e=ASN1HEX.getHexOfV_AtObj(t,r[1]),e},parsePrivateRawRSAKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed RSA private key(code:001)";var i=ASN1HEX.getPosArrayOfChildren_AtObj(t,r);if(9!=i.length)throw"malformed RSA private key(code:002)";e.key={},e.key.n=ASN1HEX.getHexOfV_AtObj(t,i[1]),e.key.e=ASN1HEX.getHexOfV_AtObj(t,i[2]),e.key.d=ASN1HEX.getHexOfV_AtObj(t,i[3]),e.key.p=ASN1HEX.getHexOfV_AtObj(t,i[4]),e.key.q=ASN1HEX.getHexOfV_AtObj(t,i[5]),e.key.dp=ASN1HEX.getHexOfV_AtObj(t,i[6]),e.key.dq=ASN1HEX.getHexOfV_AtObj(t,i[7]),e.key.co=ASN1HEX.getHexOfV_AtObj(t,i[8])},parsePrivateRawECKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed ECC private key(code:001)";var i=ASN1HEX.getPosArrayOfChildren_AtObj(t,r);if(3!=i.length)throw"malformed ECC private key(code:002)";if("04"!=t.substr(i[1],2))throw"malformed ECC private key(code:003)";e.key=ASN1HEX.getHexOfV_AtObj(t,i[1])},parsePublicPKCS8Hex:function(t){var e={};e.algparam=null;var r=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"outer DERSequence shall have 2 elements: "+r.length;var i=r[0];if("30"!=t.substr(i,2))throw"malformed PKCS8 public key(code:001)";var n=ASN1HEX.getPosArrayOfChildren_AtObj(t,i);if(2!=n.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(n[0],2))throw"malformed PKCS8 public key(code:003)";if(e.algoid=ASN1HEX.getHexOfV_AtObj(t,n[0]),"06"==t.substr(n[1],2)&&(e.algparam=ASN1HEX.getHexOfV_AtObj(t,n[1])),"03"!=t.substr(r[1],2))throw"malformed PKCS8 public key(code:004)";return e.key=ASN1HEX.getHexOfV_AtObj(t,r[1]).substr(2),e},getRSAKeyFromPublicPKCS8Hex:function(t){var e=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"outer DERSequence shall have 2 elements: "+e.length;var r=ASN1HEX.getHexOfTLV_AtObj(t,e[0]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmId is not rsaEncryption";if("03"!=t.substr(e[1],2))throw"PKCS8 Public Key is not BITSTRING encapslated.";var i=ASN1HEX.getStartPosOfV_AtObj(t,e[1])+2;if("30"!=t.substr(i,2))throw"PKCS8 Public Key is not SEQUENCE.";var n=ASN1HEX.getPosArrayOfChildren_AtObj(t,i);if(2!=n.length)throw"inner DERSequence shall have 2 elements: "+n.length;if("02"!=t.substr(n[0],2))throw"N is not ASN.1 INTEGER";if("02"!=t.substr(n[1],2))throw"E is not ASN
}function e(t){var e=t.alg,r="";if("RS256"!=e&&"RS512"!=e&&"PS256"!=e&&"PS512"!=e)throw"JWS signature algorithm not supported: "+e;return"256"==e.substr(2)&&(r="sha256"),"512"==e.substr(2)&&(r="sha512"),r}function r(t){return e(jsonParse(t))}function i(t,e,i,n,s,o){var a=new RSAKey;a.setPrivate(n,s,o);var h=r(t),u=a.signString(i,h);return u}function n(t,i,n,s,o){var a=null;a="undefined"==typeof o?r(t):e(o);var h="PS"==o.alg.substr(0,2);return s.hashAndSign?b64tob64u(s.hashAndSign(a,n,"binary","base64",h)):hextob64u(h?s.signStringPSS(n,a):s.signString(n,a))}function s(t,e,i,n){var s=new RSAKey;s.readPrivateKeyFromPEMString(n);var o=r(t),a=s.signString(i,o);return a}this.parseJWS=function(t,e){if(void 0===this.parsedJWS||!e&&void 0===this.parsedJWS.sigvalH){if(null==t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/))throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var r=RegExp.$1,i=RegExp.$2,n=RegExp.$3,s=r+"."+i;if(this.parsedJWS={},this.parsedJWS.headB64U=r,this.parsedJWS.payloadB64U=i,this.parsedJWS.sigvalB64U=n,this.parsedJWS.si=s,!e){var o=b64utohex(n),a=parseBigInt(o,16);this.parsedJWS.sigvalH=o,this.parsedJWS.sigvalBI=a}var h=b64utoutf8(r),u=b64utoutf8(i);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=u,!this.isSafeJSONString(h,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+h}},this.verifyJWSByNE=function(t,e,r){return this.parseJWS(t),_rsasign_verifySignatureWithArgs(this.parsedJWS.si,this.parsedJWS.sigvalBI,e,r)},this.verifyJWSByKey=function(t,r){this.parseJWS(t);var i=e(this.parsedJWS.headP),n="PS"==this.parsedJWS.headP.alg.substr(0,2);return r.hashAndVerify?r.hashAndVerify(i,new Buffer(this.parsedJWS.si,"utf8").toString("base64"),b64utob64(this.parsedJWS.sigvalB64U),"base64",n):n?r.verifyStringPSS(this.parsedJWS.si,this.parsedJWS.sigvalH,i):r.verifyString(this.parsedJWS.si,this.parsedJWS.sigvalH)},this.verifyJWSByPemX509Cert=function(t,e){this.parseJWS(t);var r=new X509;return r.readCertPEM(e),r.subjectPublicKeyRSA.verifyString(this.parsedJWS.si,this.parsedJWS.sigvalH)},this.generateJWSByNED=function(e,r,n,s,o){if(!this.isSafeJSONString(e))throw"JWS Head is not safe JSON string: "+e;var a=t(e,r),h=i(e,r,a,n,s,o),u=hextob64u(h);return this.parsedJWS={},this.parsedJWS.headB64U=a.split(".")[0],this.parsedJWS.payloadB64U=a.split(".")[1],this.parsedJWS.sigvalB64U=u,a+"."+u},this.generateJWSByKey=function(e,r,i){var s={};if(!this.isSafeJSONString(e,s,"headP"))throw"JWS Head is not safe JSON string: "+e;var o=t(e,r),a=n(e,r,o,i,s.headP);return this.parsedJWS={},this.parsedJWS.headB64U=o.split(".")[0],this.parsedJWS.payloadB64U=o.split(".")[1],this.parsedJWS.sigvalB64U=a,o+"."+a},this.generateJWSByP1PrvKey=function(e,r,i){if(!this.isSafeJSONString(e))throw"JWS Head is not safe JSON string: "+e;var n=t(e,r),o=s(e,r,n,i),a=hextob64u(o);return this.parsedJWS={},this.parsedJWS.headB64U=n.split(".")[0],this.parsedJWS.payloadB64U=n.split(".")[1],this.parsedJWS.sigvalB64U=a,n+"."+a}},KJUR.jws.JWS.sign=function(t,e,r,i,n){var s=KJUR.jws.JWS;if(!s.isSafeJSONString(e))throw"JWS Head is not safe JSON string: "+sHead;var o=s.readSafeJSONString(e);""!=t&&null!=t||void 0===o.alg||(t=o.alg),""!=t&&null!=t&&void 0===o.alg&&(o.alg=t,e=JSON.stringify(o));var a=null;if(void 0===s.jwsalg2sigalg[t])throw"unsupported alg name: "+t;a=s.jwsalg2sigalg[t];var h=utf8tob64u(e),u=utf8tob64u(r),c=h+"."+u,g="";if("Hmac"==a.substr(0,4)){if(void 0===i)throw"hexadecimal key shall be specified for HMAC";var f=new KJUR.crypto.Mac({alg:a,pass:hextorstr(i)});f.updateString(c),g=f.doFinal()}else if(-1!=a.indexOf("withECDSA")){var p=new KJUR.crypto.Signature({alg:a});p.init(i,n),p.updateString(c),hASN1Sig=p.sign(),g=KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig)}else if("none"!=a){var p=new KJUR.crypto.Signature({alg:a});p.init(i,n),p.updateString(c),g=p.sign()}var l=hextob64u(g);return c+"."+l},KJUR.jws.JWS.verify=function(t,e){var r=KJUR.jws.JWS,i=t.split("."),n=i[0],s=i[1],o=n+"."+s,a=b64utohex(i[2]),h=r.readSafeJSONString(b64utoutf8(i[0])),u=null;if(void 0===h.alg)throw"algorithm not specified in header";u=h.alg;var c=null;if(vo
11 years ago
},{"buffer":93}],161:[function(require,module,exports){
module.exports=require("./src/preconditions");
},{"./src/preconditions":164}],162:[function(require,module,exports){
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray
},{}],163:[function(require,module,exports){
exports.ShouldBeDefined="Variable should be defined.",exports.ShouldBeUndefined="Variable should be undefined.",exports.ShouldBeArray="Variable should be of type Array.",exports.ShouldNotBeArray="Variable should NOT be of type Array.",exports.ShouldBeObject="Variable should be of type Object.",exports.ShouldNotBeObject="Variable should NOT be of type Object.",exports.ShouldBeEmpty="Array or object should be empty.",exports.ShouldNotBeEmpty="Array or object should NOT be empty.",exports.ShouldBeFunction="Variable should be a Function.",exports.ShouldNotBeFunction="Variable should NOT be a Function.",exports.ShouldBeString="Variable should be a String.",exports.ShouldNotBeString="Variable should NOT be a String.",exports.ShouldBeNumber="Variable should be a Number.",exports.ShouldNotBeNumber="Variable should NOT be a Number.",exports.ShouldBeFinite="Variable should be Finite (i.e. not infinity).",exports.ShouldBeInfinite="Variable should be Infinite.",exports.ShouldBeBoolean="Variable should be a Boolean.",exports.ShouldNotBeBoolean="Variable should NOT be a Boolean.",exports.ShouldBeDate="Variable should be a Date.",exports.ShouldNotBeDate="Variable should NOT be a Date.",exports.ShouldBeRegExp="Variable should be a RegExp.",exports.ShouldNotBeRegExp="Variable should NOT be a RegExp.",exports.ShouldBeFalsey="Variable should be falsey.",exports.ShouldNotBeFalsey="Variable should NOT be falsey.",exports.IllegalArgument="Illegal Argument.",exports.IllegalState="Illegal State.",exports.ShouldHaveValidIndex="Index should be between between 0 (inclusive) and size (exclusive).",exports.ShouldHaveValidPosition="Index should be between index between 0 (inclusive) and size (inclusive).",exports.ShouldHaveValidPositions="Start and End should be between valid sub range between 0 (inclusive) and size (inclusive).",exports.StartBeforeEnd="Start value should be less than the end value.";
},{}],164:[function(require,module,exports){
"use strict";function Preconditions(t){this.out=t}var _=require("underscore"),validatorFunctions=require("./validatorFunctions"),require=require("util");Preconditions.prototype.validate=function(t,o,n){var i=t.split("."),e=this.out||{},r=0;for(var u in i){var s=i[u];r!==i.length-1&&validatorFunctions.shouldBeDefined(e[s],n),e=e[s],r++}o(e)},Preconditions.prototype.shouldBeDefined=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeDefined(t,o)},o),this},Preconditions.prototype.shouldBeUndefined=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeUndefined(t,o)},o),this},Preconditions.prototype.shouldBeNonEmptyArray=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeArray(t,o),validatorFunctions.shouldNotBeEmpty(t,o)},o),this},Preconditions.prototype.shouldBeArray=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeArray(t,o)},o),this},Preconditions.prototype.shouldNotBeArray=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeArray(t,o)},o),this},Preconditions.prototype.shouldBeObject=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeObject(t,o)},o),this},Preconditions.prototype.shouldNotBeObject=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeObject(t,o)},o),this},Preconditions.prototype.shouldBeEmpty=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeEmpty(t,o)},o),this},Preconditions.prototype.shouldNotBeEmpty=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeEmpty(t,o)},o),this},Preconditions.prototype.shouldBeFunction=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeFunction(t,o)},o),this},Preconditions.prototype.shouldNotBeFunction=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeFunction(t,o)},o),this},Preconditions.prototype.shouldBeString=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeString(t,o)},o),this},Preconditions.prototype.shouldNotBeString=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeString(t,o)},o),this},Preconditions.prototype.shouldBeNumber=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeNumber(t,o)},o),this},Preconditions.prototype.shouldNotBeNumber=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeNumber(t,o)},o),this},Preconditions.prototype.shouldBeFinite=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeFinite(t,o)},o),this},Preconditions.prototype.shouldBeInfinite=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeInfinite(t,o)},o),this},Preconditions.prototype.shouldBeBoolean=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeBoolean(t,o)},o),this},Preconditions.prototype.shouldNotBeBoolean=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeBoolean(t,o)},o),this},Preconditions.prototype.shouldBeDate=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeDate(t,o)},o),this},Preconditions.prototype.shouldNotBeDate=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeDate(t,o)},o),this},Preconditions.prototype.shouldBeRegExp=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeRegExp(t,o)},o),this},Preconditions.prototype.shouldNotBeRegExp=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeRegExp(t,o)},o),this},Preconditions.prototype.shouldBeFalsey=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldBeFalsey(t,o)},o),this},Preconditions.prototype.shouldNotBeFalsey=function(t,o){return this.validate(t,function(t){validatorFunctions.shouldNotBeFalsey(t,o)},o),this},Preconditions.prototype.checkArgument=function(t,o){return validatorFunctions.checkArgument(t,o),this},Preconditions.prototype.checkState=function(t,o){return validatorFunctions.checkState(t,o),this},Precondition
},{"./validatorFunctions":165,"underscore":162,"util":126}],165:[function(require,module,exports){
"use strict";var constants=require("./constants"),_=require("underscore"),validatorFunctions={shouldBeDefined:function(t,r){if(_.isUndefined(t)){var n=r||constants.ShouldBeDefined;throw new Error(n)}return this},shouldBeUndefined:function(t,r){if(!_.isUndefined(t)){var n=r||constants.ShouldBeUndefined;throw new Error(n)}return this},shouldBeArray:function(t,r){if(!_.isArray(t)){var n=r||constants.ShouldBeArray;throw new Error(n)}return this},shouldNotBeArray:function(t,r){if(_.isArray(t)){var n=r||constants.ShouldNotBeArray;throw new Error(n)}return this},shouldBeObject:function(t,r){if(!_.isObject(t)){var n=r||constants.ShouldBeObject;throw new Error(n)}return this},shouldNotBeObject:function(t,r){if(_.isObject(t)){var n=r||constants.ShouldNotBeObject;throw new Error(n)}return this},shouldBeEmpty:function(t,r){if(!_.isEmpty(t)){var n=r||constants.ShouldBeEmpty;throw new Error(n)}return this},shouldNotBeEmpty:function(t,r){if(_.isEmpty(t)){var n=r||constants.ShouldNotBeEmpty;throw new Error(n)}return this},shouldBeFunction:function(t,r){if(!_.isFunction(t)){var n=r||constants.ShouldBeFunction;throw new Error(n)}return this},shouldNotBeFunction:function(t,r){if(_.isFunction(t)){var n=r||constants.ShouldNotBeFunction;throw new Error(n)}return this},shouldBeString:function(t,r){if(!_.isString(t)){var n=r||constants.ShouldBeString;throw new Error(n)}return this},shouldNotBeString:function(t,r){if(_.isString(t)){var n=r||constants.ShouldNotBeString;throw new Error(n)}return this},shouldBeNumber:function(t,r){if(!_.isNumber(t)){var n=r||constants.ShouldBeNumber;throw new Error(n)}return this},shouldNotBeNumber:function(t,r){if(console.log("val: "+t),_.isNumber(t)){var n=r||constants.ShouldNotBeNumber;throw new Error(n)}return this},shouldBeFinite:function(t,r){if(!_.isFinite(t)){var n=r||constants.ShouldBeFinite;throw new Error(n)}return this},shouldBeInfinite:function(t,r){if(_.isFinite(t)){var n=r||constants.ShouldBeInfinite;throw new Error(n)}return this},shouldBeBoolean:function(t,r){if(!_.isBoolean(t)){var n=r||constants.ShouldBeBoolean;throw new Error(n)}return this},shouldNotBeBoolean:function(t,r){if(_.isBoolean(t)){var n=r||constants.ShouldNotBeBoolean;throw new Error(n)}return this},shouldBeDate:function(t,r){if(!_.isDate(t)){var n=r||constants.ShouldBeDate;throw new Error(n)}return this},shouldNotBeDate:function(t,r){if(_.isDate(t)){var n=r||constants.ShouldNotBeDate;throw new Error(n)}return this},shouldBeRegExp:function(t,r){if(!_.isRegExp(t)){var n=r||constants.ShouldBeRegExp;throw new Error(n)}return this},shouldNotBeRegExp:function(t,r){if(_.isRegExp(t)){var n=r||constants.ShouldNotBeRegExp;throw new Error(n)}return this},shouldBeFalsey:function(t,r){if(!_.isNaN(t)&&!_.isNull(t)&&!_.isUndefined(t)){var n=r||constants.ShouldBeFalsey;throw new Error(n)}return this},shouldNotBeFalsey:function(t,r){if(_.isNaN(t)||_.isNull(t)||_.isUndefined(t)){var n=r||constants.ShouldNotBeFalsey;throw new Error(n)}return this},checkArgument:function(t,r){if(!t){var n=r||constants.IllegalArgument;throw new Error(n)}return this},checkState:function(t,r){if(!t){var n=r||constants.IllegalState;throw new Error(n)}return this},checkElementIndex:function(t,r,n){if(0>t||t>=r){var o=n||constants.ShouldHaveValidIndex;throw new Error(o)}return this},checkPositionIndex:function(t,r,n){if(0>t||t>r){var o=n||constants.ShouldHaveValidPosition;throw new Error(o)}return this},checkPositionIndexes:function(t,r,n,o){var e;if(t>r)throw e=o||constants.StartBeforeEnd,new Error(e);if(0>t||r>n)throw e=o||constants.ShouldHaveValidPositions,new Error(e);return this}};module.exports=validatorFunctions;
},{"./constants":163,"underscore":162}],166:[function(require,module,exports){
!function(e){"use strict";function t(e){if(!e||!e.VERSION||e.VERSION.split(".")[0]<3)throw Error("ProtoBuf.js requires ByteBuffer.js >=3");var t={};return t.VERSION="3.0.0",t.WIRE_TYPES={},t.WIRE_TYPES.VARINT=0,t.WIRE_TYPES.BITS64=1,t.WIRE_TYPES.LDELIM=2,t.WIRE_TYPES.STARTGROUP=3,t.WIRE_TYPES.ENDGROUP=4,t.WIRE_TYPES.BITS32=5,t.PACKABLE_WIRE_TYPES=[t.WIRE_TYPES.VARINT,t.WIRE_TYPES.BITS64,t.WIRE_TYPES.BITS32],t.TYPES={int32:{name:"int32",wireType:t.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:t.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:t.WIRE_TYPES.VARINT},int64:{name:"int64",wireType:t.WIRE_TYPES.VARINT},uint64:{name:"uint64",wireType:t.WIRE_TYPES.VARINT},sint64:{name:"sint64",wireType:t.WIRE_TYPES.VARINT},bool:{name:"bool",wireType:t.WIRE_TYPES.VARINT},"double":{name:"double",wireType:t.WIRE_TYPES.BITS64},string:{name:"string",wireType:t.WIRE_TYPES.LDELIM},bytes:{name:"bytes",wireType:t.WIRE_TYPES.LDELIM},fixed32:{name:"fixed32",wireType:t.WIRE_TYPES.BITS32},sfixed32:{name:"sfixed32",wireType:t.WIRE_TYPES.BITS32},fixed64:{name:"fixed64",wireType:t.WIRE_TYPES.BITS64},sfixed64:{name:"sfixed64",wireType:t.WIRE_TYPES.BITS64},"float":{name:"float",wireType:t.WIRE_TYPES.BITS32},"enum":{name:"enum",wireType:t.WIRE_TYPES.VARINT},message:{name:"message",wireType:t.WIRE_TYPES.LDELIM},group:{name:"group",wireType:t.WIRE_TYPES.STARTGROUP}},t.ID_MIN=1,t.ID_MAX=536870911,t.ByteBuffer=e,t.Long=e.Long||null,t.convertFieldsToCamelCase=!1,t.Util=function(){Object.create||(Object.create=function(e){function t(){}if(arguments.length>1)throw new Error("Object.create implementation only accepts the first parameter.");return t.prototype=e,new t});var e={};e.IS_NODE=!1;try{e.IS_NODE="function"==typeof require&&"function"==typeof require("fs").readFileSync&&"function"==typeof require("path").resolve}catch(t){}return e.XHR=function(){for(var e=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],t=null,n=0;n<e.length;n++){try{t=e[n]()}catch(i){continue}break}if(!t)throw new Error("XMLHttpRequest is not supported");return t},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)require("fs").readFile(t,function(e,t){n(e?null:""+t)});else try{return require("fs").readFileSync(t)}catch(i){return null}else{var r=e.XHR();if(r.open("GET",t,n?!0:!1),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&n(200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null)},4==r.readyState)return;r.send(null)}},e.isArray=function(e){return e?e instanceof Array?!0:Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e):!1},e}(),t.Lang={OPEN:"{",CLOSE:"}",OPTOPEN:"[",OPTCLOSE:"]",OPTEND:",",EQUAL:"=",END:";",STRINGOPEN:'"',STRINGCLOSE:'"',STRINGOPEN_SQ:"'",STRINGCLOSE_SQ:"'",COPTOPEN:"(",COPTCLOSE:")",DELIM:/[\s\{\}=;\[\],'"\(\)]/g,RULE:/^(?:required|optional|repeated)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+|([0-9]*\.[0-9]+([Ee][+-]?[0-9]+)?))$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0x[0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^[0-9]*\.[0-9]+([Ee][+-]?[0-9]+)?$/,ID:/^(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0x[0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/['"]([^'"\\]*(\\.[^"\\]*)*)['"]/g,BOOL:/^(?:true|false)$/i},t.DotProto=function(e,t){var n={},i=function(e){this.source=""+e,this.index=0,this.line=1,this.stack=[],this.readingString=!1,this.stringEndsWith=t.STRINGCLOSE};i.prototype._readString=fu
break;case t.TYPES.sint64:i.writeVarint64ZigZag(n);break;case t.TYPES.fixed64:i.writeUint64(n);break;case t.TYPES.sfixed64:i.writeInt64(n);break;case t.TYPES.bool:i.writeVarint32("string"==typeof n?"false"===n.toLowerCase()?0:!!n:n?1:0);break;case t.TYPES["enum"]:i.writeVarint32(n);break;case t.TYPES["float"]:i.writeFloat32(n);break;case t.TYPES["double"]:i.writeFloat64(n);break;case t.TYPES.string:i.writeVString(n);break;case t.TYPES.bytes:n.offset>n.length&&(i=i.clone().flip());var r=n.offset;i.writeVarint32(n.remaining()),i.append(n),n.offset=r;break;case t.TYPES.message:var s=(new e).LE();this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(this.id<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw new Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i}},l.prototype.decode=function(e,n,i){var r,s;if(e!=this.type.wireType&&(i||e!=t.WIRE_TYPES.LDELIM||!this.repeated))throw new Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&!i){s=n.readVarint32(),s=n.offset+s;for(var o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}switch(this.type){case t.TYPES.int32:return 0|n.readVarint32();case t.TYPES.uint32:return n.readVarint32()>>>0;case t.TYPES.sint32:return 0|n.readVarint32ZigZag();case t.TYPES.fixed32:return n.readUint32()>>>0;case t.TYPES.sfixed32:return 0|n.readInt32();case t.TYPES.int64:return n.readVarint64();case t.TYPES.uint64:return n.readVarint64().toUnsigned();case t.TYPES.sint64:return n.readVarint64ZigZag();case t.TYPES.fixed64:return n.readUint64();case t.TYPES.sfixed64:return n.readInt64();case t.TYPES.bool:return!!n.readVarint32();case t.TYPES["enum"]:return n.readVarint32();case t.TYPES["float"]:return n.readFloat();case t.TYPES["double"]:return n.readDouble();case t.TYPES.string:return n.readVString();case t.TYPES.bytes:if(s=n.readVarint32(),n.remaining()<s)throw new Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());return r=n.clone(),r.limit=r.offset+s,n.offset+=s,r;case t.TYPES.message:return s=n.readVarint32(),this.resolvedType.decode(n,s);case t.TYPES.group:return this.resolvedType.decode(n,-1,this.id)}throw new Error("[INTERNAL] Illegal wire type for "+this.toString(!0)+": "+e)},r.Message.Field=l;var f=function(e,t,n){o.call(this,e,t,n),this.className="Enum",this.object=null};f.prototype=Object.create(o.prototype),f.prototype.build=function(){for(var e={},t=this.getChildren(f.Value),n=0;n<t.length;n++)e[t[n].name]=t[n].id;return Object.defineProperty&&Object.defineProperty(e,"$options",{value:this.buildOpt(),enumerable:!1,configurable:!1,writable:!1}),this.object=e},r.Enum=f;var p=function(e,t,n){s.call(this,e,t),this.className="Enum.Value",this.id=n};p.prototype=Object.create(s.prototype),r.Enum.Value=p;var h=function(e,t,n){o.call(this,e,t,n),this.className="Service",this.clazz=null};h.prototype=Object.create(o.prototype),h.prototype.build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var n=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,new Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}};n.prototype=Object.create(e.Builder.Service.prototype),Object.defineProperty&&(Object.defineProperty(n,"$options",{value:t.buildOpt(),enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(n.prototype,"$options",{value:n.$options,enumerable:!1,configurable:!1,writable:!1}));for(var i=t.getChildren(e.Reflect.Service.RPCMethod),r=0;r<i.length;r++)!function(e){n.prototype[e.name]=function(n,i){try{n&&n instanceof e.resolvedRequestType.clazz||setTimeout(i.bind(this,new Error("Illegal request type provided to service method "+t.name+"#"+e.name)),0),this.rpcImpl(e.fqn(),n,function(n,r){if(n)return void i(n);try{r=e.resolvedResponseType.clazz.decode(r)}catch(s){}return r&&r instan
11 years ago
},{"bytebuffer":167,"fs":89,"path":111}],167:[function(require,module,exports){
!function(e){function t(e){function t(e,n,i){if("undefined"==typeof e&&(e=t.DEFAULT_CAPACITY),"undefined"==typeof n&&(n=t.DEFAULT_ENDIAN),"undefined"==typeof i&&(i=t.DEFAULT_NOASSERT),!i){if(e|=0,0>e)throw new RangeError("Illegal capacity: 0 <= "+e);if("boolean"!=typeof n)throw new TypeError("Illegal littleEndian: Not a boolean");if("boolean"!=typeof i)throw new TypeError("Illegal noAssert: Not a boolean")}this.buffer=0===e?r:new ArrayBuffer(e),this.view=0===e?null:new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian="undefined"!=typeof n?!!n:!1,this.noAssert=!!i}t.VERSION="3.1.0",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var r=new ArrayBuffer(0);t.allocate=function(e,r,n){return new t(e,r,n)},t.concat=function(e,r,n,i){("boolean"==typeof r||"string"!=typeof r)&&(i=n,n=r,r=void 0);for(var f,o=0,s=0,h=e.length;h>s;++s)t.isByteBuffer(e[s])||(e[s]=t.wrap(e[s],r)),f=e[s].limit-e[s].offset,f>0&&(o+=f);if(0===o)return new t(0,n,i);for(r=new t(o,n,i),i=new Uint8Array(r.buffer),s=0;h>s;)n=e[s++],f=n.limit-n.offset,0>=f||(i.set(new Uint8Array(n.buffer).subarray(n.offset,n.limit),r.offset),r.offset+=f);return r.limit=r.offset,r.offset=0,r},t.isByteBuffer=function(e){return e&&e instanceof t},t.type=function(){return ArrayBuffer},t.wrap=function(e,r,n,f){if("string"!=typeof r&&(f=n,n=r,r=void 0),"string"==typeof e)switch("undefined"==typeof r&&(r="utf8"),r){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw new TypeError("Unsupported encoding: "+r)}if(null===e||"object"!=typeof e)throw new TypeError("Illegal buffer: null or non-object");if(t.isByteBuffer(e))return r=t.prototype.clone.call(e),r.markedOffset=-1,r;if(e instanceof Uint8Array)r=new t(0,n,f),0<e.length&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.length,r.view=0<e.length?new DataView(e.buffer):null);else if(e instanceof ArrayBuffer)r=new t(0,n,f),0<e.byteLength&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=0<e.byteLength?new DataView(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Illegal buffer");for(r=new t(e.length,n,f),r.limit=e.length,i=0;i<e.length;++i)r.view.setUint8(i,e[i])}return r},t.prototype.writeInt8=function(e,t){var r="undefined"==typeof t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||0!==t%1)throw new TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,0>t||t+0>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),this.view.setInt8(t-1,e),r&&(this.offset+=1),this},t.prototype.writeByte=t.prototype.writeInt8,t.prototype.readInt8=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,0>e||e+1>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return e=this.view.getInt8(e),t&&(this.offset+=1),e},t.prototype.readByte=t.prototype.readInt8,t.prototype.writeUint8=function(e,t){var r="undefined"==typeof t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||0!==t%1)throw new TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,0>t||t+0>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),this.view.setUint8(t-1,e),r&&(this.offset+=1),this},t.prototype.readUint8=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeE
},t.prototype.toBuffer=function(e){var t=this.offset,n=this.limit;if(t>n)var i=t,t=n,n=i;if(!this.noAssert){if("number"!=typeof t||0!==t%1)throw new TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof n||0!==n%1)throw new TypeError("Illegal limit: Not an integer");if(n>>>=0,0>t||t>n||n>this.buffer.byteLength)throw new RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}return e||0!==t||n!==this.buffer.byteLength?t===n?r:(e=new ArrayBuffer(n-t),new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(t,n),0),e):this.buffer},t.prototype.toArrayBuffer=t.prototype.toBuffer,t.prototype.toString=function(e){if("undefined"==typeof e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch(e){case"utf8":return this.toUTF8();case"base64":return this.toBase64();case"hex":return this.toHex();case"binary":return this.toBinary();case"debug":return this.toDebug();case"columns":return this.o();default:throw Error("Unsupported encoding: "+e)}};var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=n+"";t.prototype.toBase64=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||0!==t%1)throw new TypeError("Illegal end: Not an integer");if(t>>>=0,0>e||e>t||t>this.buffer.byteLength)throw new RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return"";for(var r,i,f,o,s,h,a="";t>e;)r=this.view.getUint8(e++),i=(o=t>e)?this.view.getUint8(e++):0,f=(s=t>e)?this.view.getUint8(e++):0,h=r>>2,r=(3&r)<<4|i>>4,i=(15&i)<<2|f>>6,f&=63,s||(f=64,o||(i=64)),a+=n.charAt(h)+n.charAt(r)+n.charAt(i)+n.charAt(f);return a},t.fromBase64=function(e,r,i){if(!i){if("string"!=typeof e)throw new TypeError("Illegal str: Not a string");if(0!==e.length%4)throw new TypeError("Illegal str: Length not a multiple of 4")}var f,o=e.length,s=0;for(f=e.length-1;f>=0&&"="===e.charAt(f);--f)s++;if(s>2)throw new TypeError("Illegal str: Suffix is too large");if(0===o)return new t(0,r,i);var h,a,l,u=new t(o/4*3-s,r,i);for(r=f=0;o>f;){if(s=n.indexOf(e.charAt(f++)),h=o>f?n.indexOf(e.charAt(f++)):0,a=o>f?n.indexOf(e.charAt(f++)):0,l=o>f?n.indexOf(e.charAt(f++)):0,!i&&(0>s||0>h||0>a||0>l))throw new TypeError("Illegal str: Contains non-base64 characters");u.view.setUint8(r++,s<<2|h>>4),64!==a&&(u.view.setUint8(r++,h<<4&240|a>>2,r),64!==l&&u.view.setUint8(r++,a<<6&192|l))}return u.limit=r,u},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},t.prototype.toBinary=function(e,t){if(e="undefined"==typeof e?this.offset:e,t="undefined"==typeof t?this.limit:t,!this.noAssert){if("number"!=typeof e||0!==e%1)throw new TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||0!==t%1)throw new TypeError("Illegal end: Not an integer");if(t>>>=0,0>e||e>t||t>this.buffer.byteLength)throw new RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return"";for(var r=[];t>e;)r.push(this.view.getUint8(e++));return String.fromCharCode.apply(String,r)},t.fromBinary=function(e,r,n){if(!n&&"string"!=typeof e)throw new TypeError("Illegal str: Not a string");for(var i=0,f=e.length,o=new t(f,r,n);f>i;){if(r=e.charCodeAt(i),!n&&r>255)throw new TypeError("Illegal charCode at "+i+": 0 <= "+r+" <= 255");o.view.setUint8(i++,r)}return o.limit=f,o},t.prototype.toDebug=function(e){for(var t,r=-1,n=this.buffer.byteLength,i="",f="",o="";n>r;){if(-1!==r&&(t=this.view.getUint8(r),i=16>t?i+("0"+t.toString(16).toUpperCase()):i+t.toString(16).toUpperCase(),e&&(f+=t>32&&127>t?String.fromCharCode(t):".")),++r,e&&r>0&&0===r%16&&r!==n){for(;51>i.length;)i+=" ";o+=i+f+"\n",i=f=""}i=r===this.offset&&r===this.limit?i+(r===this.markedOffset?"!":"|"):r===this.offset?i+(r===this.markedOffset?"[":"<"):r===this.limit?i+(r===this.markedOffset?"]":">"):i+(r===this.markedOffset?"'":e||0!==r&&r!==n?" "
11 years ago
},{"long":169}],168:[function(require,module,exports){
!function(t){"use strict";var i=function(t,i,r){t&&"object"==typeof t&&(i=t.high,r=t.unsigned,t=t.low),this.low=0|t,this.high=0|i,this.unsigned=!!r},r={},e={};i.fromInt=function(t,n){var o,s;return n?(t>>>=0,t>=0&&256>t&&(s=e[t])?s:(o=new i(t,0>(0|t)?-1:0,!0),t>=0&&256>t&&(e[t]=o),o)):(t=0|t,t>=-128&&128>t&&(s=r[t])?s:(o=new i(t,0>t?-1:0,!1),t>=-128&&128>t&&(r[t]=o),o))},i.fromNumber=function(t,r){return r=!!r,isNaN(t)||!isFinite(t)?i.ZERO:!r&&-h>=t?i.MIN_SIGNED_VALUE:r&&0>=t?i.MIN_UNSIGNED_VALUE:!r&&t+1>=h?i.MAX_SIGNED_VALUE:r&&t>=s?i.MAX_UNSIGNED_VALUE:0>t?i.fromNumber(-t,!1).negate():new i(t%o|0,t/o|0,r)},i.fromBits=function(t,r,e){return new i(t,r,e)},i.from28Bits=function(t,r,e,n){return i.fromBits(t|r<<28,r>>>4|e<<24,n)},i.fromString=function(t,r,e){if(0==t.length)throw new Error("number format error: empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return i.ZERO;if("number"==typeof r&&(e=r,r=!1),e=e||10,2>e||e>36)throw new Error("radix out of range: "+e);if("-"==t.charAt(0))return i.fromString(t.substring(1),r,e).negate();if(t.indexOf("-")>=0)throw new Error('number format error: interior "-" character: '+t);for(var n=i.fromNumber(Math.pow(e,8)),o=i.ZERO,s=0;s<t.length;s+=8){var h=Math.min(8,t.length-s),u=parseInt(t.substring(s,s+h),e);if(8>h){var f=i.fromNumber(Math.pow(e,h));o=o.multiply(f).add(i.fromNumber(u))}else o=o.multiply(n),o=o.add(i.fromNumber(u))}return o.unsigned=r,o};var n=65536,o=n*n,s=o*o,h=s/2,u=i.fromInt(1<<24);i.ZERO=i.fromInt(0),i.UZERO=i.fromInt(0,!0),i.ONE=i.fromInt(1),i.UONE=i.fromInt(1,!0),i.NEG_ONE=i.fromInt(-1),i.MAX_SIGNED_VALUE=i.fromBits(-1,2147483647,!1),i.MAX_UNSIGNED_VALUE=i.fromBits(-1,-1,!0),i.MAX_VALUE=i.MAX_SIGNED_VALUE,i.MIN_SIGNED_VALUE=i.fromBits(0,-2147483648,!1),i.MIN_UNSIGNED_VALUE=i.fromBits(0,0,!0),i.MIN_VALUE=i.MIN_SIGNED_VALUE,i.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},i.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},i.prototype.toString=function(t){if(t=t||10,2>t||t>36)throw new Error("radix out of range: "+t);if(this.isZero())return"0";var r;if(this.isNegative()){if(this.equals(i.MIN_SIGNED_VALUE)){var e=i.fromNumber(t),n=this.div(e);return r=n.multiply(e).subtract(this),n.toString(t)+r.toInt().toString(t)}return"-"+this.negate().toString(t)}var o=i.fromNumber(Math.pow(t,6));r=this;for(var s="";;){var h=r.div(o),u=r.subtract(h.multiply(o)).toInt(),f=u.toString(t);if(r=h,r.isZero())return f+s;for(;f.length<6;)f="0"+f;s=""+f+s}},i.prototype.getHighBits=function(){return this.high},i.prototype.getHighBitsUnsigned=function(){return this.high>>>0},i.prototype.getLowBits=function(){return this.low},i.prototype.getLowBitsUnsigned=function(){return this.low>>>0},i.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(i.MIN_SIGNED_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,r=31;r>0&&0==(t&1<<r);r--);return 0!=this.high?r+33:r+1},i.prototype.isZero=function(){return 0==this.high&&0==this.low},i.prototype.isNegative=function(){return!this.unsigned&&this.high<0},i.prototype.isOdd=function(){return 1==(1&this.low)},i.prototype.isEven=function(){return 0==(1&this.low)},i.prototype.equals=function(t){return this.unsigned!=t.unsigned&&this.high>>>31!=t.high>>>31?!1:this.high==t.high&&this.low==t.low},i.prototype.notEquals=function(t){return!this.equals(t)},i.prototype.lessThan=function(t){return this.compare(t)<0},i.prototype.lessThanOrEqual=function(t){return this.compare(t)<=0},i.prototype.greaterThan=function(t){return this.compare(t)>0},i.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},i.prototype.compare=function(t){if(this.equals(t))return 0;var i=this.isNegative(),r=t.isNegative();return i&&!r?-1:!i&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high==this.high&&t.low>>>0>this.low>>>0?-1:1:this.subtract(t).isNegative()?-1:1},i.prototype.negate=function(){return!this.unsigned&&this.equals(i.MIN_SIGNED_VALUE)?i.MIN_SIGNED_VALUE:this.not().add(i.ONE)},i.prototype.add=function(t
11 years ago
},{}],169:[function(require,module,exports){
module.exports=require("./dist/Long.js");
11 years ago
},{"./dist/Long.js":168}],170:[function(require,module,exports){
(function(e){"use strict";function t(e,t){var o=this;u.call(o),o.socket=new i.Socket,o.socksHost=e,o.socksPort=t,o.socket.on("error",function(e){o.emit("error",e)}),o.on("error",function(){o.socket.destroyed||o.socket.destroy()})}function o(e,t){var o,n,r=e.split(".");for(o=0;o<r.length;o++)n=parseInt(r[o],10),t.push(n)}function n(e,t){var o,n,r,s,c,i,u;if(i=new d.Address(e).canonicalForm(),!i)return!1;for(u=i.split(":"),o=0;o<u.length;o++)s=u[o].substr(0,2),c=u[o].substr(2,2),n=parseInt(s,16),r=parseInt(c,16),t.push(n),t.push(r);return!0}function r(e,t){var o,n;for(t.push(e.length),o=0;o<e.length;o++)n=e.charCodeAt(o),t.push(n)}function s(e,t){p(t,t.length,e)}function c(e){switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return"Unknown status code "+e}}var i=require("net"),u=require("events").EventEmitter,a=require("util").inherits,p=require("network-byte-order").htons,d=require("ipv6").v6;module.exports=exports=t,exports.createConnection=function(e){var o,n,r;return n=e.socksHost||"localhost",r=e.socksPort||1080,o=new t(n,r),o.connect(e.port,e.host)},a(t,u),t.prototype.setTimeout=function(e,t){return this.socket.setTimeout(e,t)},t.prototype.setNoDelay=function(){return this.socket.setNoDelay()},t.prototype.setKeepAlive=function(e,t){return this.socket.setKeepAlive(e,t)},t.prototype.address=function(){return this.socket.address()},t.prototype.pause=function(){return this.socket.pause()},t.prototype.resume=function(){return this.socket.resume()},t.prototype.end=function(e,t){return this.socket.end(e,t)},t.prototype.destroy=function(e){return this.socket.destroy(e)},t.prototype.destroySoon=function(){var e=this.socket.destroySoon();return this.writable=!1,e},t.prototype.setEncoding=function(e){return this.socket.setEncoding(e)},t.prototype.write=function(e,t,o){return this.socket.write(e,t,o)},t.prototype.connect=function(e,t){var o=this;return o.socket.connect(o.socksPort,o.socksHost,function(){o.establishSocksConnection(t,e)}),o},t.prototype.handleSocksConnectToHost=function(){var e=this;e.socket.on("close",function(t){e.emit("close",t)}),e.socket.on("end",function(){e.emit("end")}),e.socket.on("data",function(t){e.emit("data",t)}),e.socket._httpMessage=e._httpMessage,e.socket.parser=e.parser,e.socket.ondata=e.ondata,e.writable=!0,e.readable=!0,e.emit("connect")},t.prototype.establishSocksConnection=function(e,t){var o=this;o.authenticateWithSocks(function(){o.connectSocksToHost(e,t,function(){o.handleSocksConnectToHost()})})},t.prototype.authenticateWithSocks=function(t){var o,n=this;n.socket.ondata=function(e,o,r){var s;return r-o!==2?s=new Error("SOCKS authentication failed. Unexpected number of bytes received."):5!==e[o]?s=new Error("SOCKS authentication failed. Unexpected SOCKS version number: "+e[o]+"."):0!==e[o+1]&&(s=new Error("SOCKS authentication failed. Unexpected SOCKS authentication method: "+e[o+1]+".")),s?void n.emit("error",s):void(t&&t())},o=new e(3),o[0]=5,o[1]=1,o[2]=0,n.socket.write(o)},t.prototype.connectSocksToHost=function(t,u,a){var p,d,h=this;switch(this.socket.ondata=function(e,t){var o,n,r,s;if(5!==e[t]?s=new Error("SOCKS connection failed. Unexpected SOCKS version number: "+e[t]+"."):0!==e[t+1]?s=new Error("SOCKS connection failed. "+c(e[t+1])+"."):0!==e[t+2]&&(s=new Error("SOCKS connection failed. The reserved byte must be 0x00.")),s)return void h.emit("error",s);switch(n="",r=0,e[t+3]){case 1:n=e[t+4]+"."+e[t+5]+"."+e[t+6]+"."+e[t+7],r=4;break;case 3:for(r=e[t+4]+1,o=t+5;t+r>o;o++)n+=String.fromCharCode(e[o]);break;case 4:r=16;break;default:return void h.emit("error",new Error("SOCKS connection failed. Unknown addres type: "+e[t+3]+"."))}a&&a()},p=[],p.push(5),p.push(1),p.push(0),i.isIP(t)){case 0:p.push(3),r(t,p);break;case 4:p.push(1),o(t,p);break;case 6:if(p.push(4),n(t,p)===!1)return void h.emit("error",new Error("IPv6 ho
11 years ago
},{"buffer":93,"events":"T9Wsc/","ipv6":171,"net":89,"network-byte-order":175,"util":126}],171:[function(require,module,exports){
exports=module.exports=require("./ipv6.js");
11 years ago
},{"./ipv6.js":172}],172:[function(require,module,exports){
function map(s,r){var e,t=[];for(e=0;e<s.length;e++)t.push(r(s[e],e));return t}function repeatString(s,r){var e,t="";for(e=0;r>e;e++)t+=s;return t}function addCommas(s){for(var r=/(\d+)(\d{3})/;r.test(s);)s=s.replace(r,"$1,$2");return s}function spanLeadingZeroesSimple(s){return s.replace(/^(0+)/,'<span class="zero">$1</span>')}function spanLeadingZeroes4(s){return s=s.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),s=s.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function simpleRegularExpression(s){var r,e=[];for(r=0;r<s.length;r++){var t=s[r];e.push(t.length<4?sprintf("0{0,%d}%s",4-t.length,t):t)}return e.join(":")}function zeroPad(s,r){return String(repeatString(0,r)+s).slice(-1*r)}function isInSubnet(s){return this.subnetMask<s.subnetMask?!1:this.mask(s.subnetMask)===s.mask()?!0:!1}if("undefined"!=typeof exports)var sprintf=require("sprintf").sprintf,BigInteger=require("./lib/node/bigint").BigInteger;var v4=this.v4={},v6=this.v6={};v4.GROUPS=4,v6.GROUPS=8,v4.BITS=32,v6.BITS=128,v6.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",15:"Global",16:"Reserved"},v4.RE_ADDRESS=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,v4.RE_SUBNET_STRING=/\/\d{1,2}$/,v6.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,v6.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,v6.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,v6.RE_ZONE_STRING=/%.*$/,v6.RE_URL=new RegExp(/([0-9a-f:]+)/),v6.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/),v4.Address=function(s){this.valid=!1,this.address=s,this.groups=v4.GROUPS,this.v4=!0,this.subnet="/32",this.subnetMask=32;var r=v4.RE_SUBNET_STRING.exec(s);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>v4.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");s=s.replace(v4.RE_SUBNET_STRING,"")}this.addressMinusSuffix=s,this.parsedAddress=this.parse(s)},v4.Address.prototype.parse=function(s){var r=s.split(".");return s.match(v4.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",r},v4.Address.prototype.isValid=function(){return this.valid},v4.Address.prototype.correctForm=function(){return this.parsedAddress.map(function(s){return parseInt(s,10)}).join(".")},v4.Address.prototype.isCorrect=function(){return this.addressMinusSuffix===this.correctForm()&&(32===this.subnetMask||this.parsedSubnet===String(this.subnet.replace("/")))},v4.Address.fromHex=function(s){var r,e=zeroPad(s.replace(/:/g,""),8),t=[];for(r=0;8>r;r+=2){var i=e.slice(r,r+2);t.push(parseInt(i,16))}return new v4.Address(t.join("."))},v4.Address.fromInteger=function(s){return v4.Address.fromHex(s.toString(16))},v4.Address.prototype.toHex=function(){return this.parsedAddress.map(function(s){return sprintf("%02x",parseInt(s,10))}).join(":")},v4.Address.prototype.toArray=function(){return this.parsedAddress.map(function(s){return parseInt(s,10)})},v4.Address.prototype.toV6Group=function(){var s,r=[];for(s=0;s<v4.GROUPS;s+=2){var e=sprintf("%02x%02x",parseInt(this.parsedAddress[s],10),parseInt(this.parsedAddress[s+1],10));r.push(sprintf("%x",parseInt(e,16)))}return r.join(":")},v4.Address.prototype.bigInteger=function(){return this.valid?new BigInteger(map(this.parsedAddress,function(s){return sprintf("%02x",parseInt(s,10))}).join(""),16):void 0},v4.Address.prototype.startAddress=function(){var s=new BigInteger(this.mask()+repeatString(0,v4.BITS-this.subnetMask),2);return v4.Address.fromBigInteger(s)},v4.Address.prototype.endAddress=function(){var s=new BigInteger(this.mask()+repeatString(1,v4.BITS-this.subnetMask),2);return v4.Address.fromBigInteger(s)},v4.Address.fromBigInteger=function(s){return v4.Address.fromInteger(parseInt(s.toString(),10))},v4.Address.prototype.mask=function(s){return void 0===s&&(s=this.subnetMask),this.getBitsBase2(0,s)},v4.Address.prototype.getBitsBase2=function(s,r){return this.binaryZeroPad().slice(s,r)},v4.Address.prototype.isInSubnet=isInSubn
11 years ago
},{"./lib/node/bigint":173,"sprintf":174}],173:[function(require,module,exports){
function nbi(){return new BigInteger(null)}function am4(t,r,i,n,o,e){for(var s=this.array,a=i.array,h=8191&r,p=r>>13;--e>=0;){var u=8191&s[t],f=s[t++]>>13,b=p*u+f*h;u=h*u+((8191&b)<<13)+a[n]+o,o=(u>>26)+(b>>13)+p*f,a[n++]=67108863&u}return o}function int2char(t){return BI_RM.charAt(t)}function intAt(t,r){var i=BI_RC[t.charCodeAt(r)];return null==i?-1:i}function bnpCopyTo(t){for(var r=this.array,i=t.array,n=this.t-1;n>=0;--n)i[n]=r[n];t.t=this.t,t.s=this.s}function bnpFromInt(t){var r=this.array;this.t=1,this.s=0>t?-1:0,t>0?r[0]=t:-1>t?r[0]=t+DV:this.t=0}function nbv(t){var r=nbi();return r.fromInt(t),r}function bnpFromString(t,r){var i,n=this.array;if(16==r)i=4;else if(8==r)i=3;else if(256==r)i=8;else if(2==r)i=1;else if(32==r)i=5;else{if(4!=r)return void this.fromRadix(t,r);i=2}this.t=0,this.s=0;for(var o=t.length,e=!1,s=0;--o>=0;){var a=8==i?255&t[o]:intAt(t,o);0>a?"-"==t.charAt(o)&&(e=!0):(e=!1,0==s?n[this.t++]=a:s+i>BI_DB?(n[this.t-1]|=(a&(1<<BI_DB-s)-1)<<s,n[this.t++]=a>>BI_DB-s):n[this.t-1]|=a<<s,s+=i,s>=BI_DB&&(s-=BI_DB))}8==i&&0!=(128&t[0])&&(this.s=-1,s>0&&(n[this.t-1]|=(1<<BI_DB-s)-1<<s)),this.clamp(),e&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.array,r=this.s&BI_DM;this.t>0&&t[this.t-1]==r;)--this.t}function bnToString(t){var r=this.array;if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var n,o=(1<<i)-1,e=!1,s="",a=this.t,h=BI_DB-a*BI_DB%i;if(a-->0)for(BI_DB>h&&(n=r[a]>>h)>0&&(e=!0,s=int2char(n));a>=0;)i>h?(n=(r[a]&(1<<h)-1)<<i-h,n|=r[--a]>>(h+=BI_DB-i)):(n=r[a]>>(h-=i)&o,0>=h&&(h+=BI_DB,--a)),n>0&&(e=!0),e&&(s+=int2char(n));return e?s:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var r=this.array,i=t.array,n=this.s-t.s;if(0!=n)return n;var o=this.t;if(n=o-t.t,0!=n)return n;for(;--o>=0;)if(0!=(n=r[o]-i[o]))return n;return 0}function nbits(t){var r,i=1;return 0!=(r=t>>>16)&&(t=r,i+=16),0!=(r=t>>8)&&(t=r,i+=8),0!=(r=t>>4)&&(t=r,i+=4),0!=(r=t>>2)&&(t=r,i+=2),0!=(r=t>>1)&&(t=r,i+=1),i}function bnBitLength(){var t=this.array;return this.t<=0?0:BI_DB*(this.t-1)+nbits(t[this.t-1]^this.s&BI_DM)}function bnpDLShiftTo(t,r){var i,n=this.array,o=r.array;for(i=this.t-1;i>=0;--i)o[i+t]=n[i];for(i=t-1;i>=0;--i)o[i]=0;r.t=this.t+t,r.s=this.s}function bnpDRShiftTo(t,r){for(var i=this.array,n=r.array,o=t;o<this.t;++o)n[o-t]=i[o];r.t=Math.max(this.t-t,0),r.s=this.s}function bnpLShiftTo(t,r){var i,n=this.array,o=r.array,e=t%BI_DB,s=BI_DB-e,a=(1<<s)-1,h=Math.floor(t/BI_DB),p=this.s<<e&BI_DM;for(i=this.t-1;i>=0;--i)o[i+h+1]=n[i]>>s|p,p=(n[i]&a)<<e;for(i=h-1;i>=0;--i)o[i]=0;o[h]=p,r.t=this.t+h+1,r.s=this.s,r.clamp()}function bnpRShiftTo(t,r){var i=this.array,n=r.array;r.s=this.s;var o=Math.floor(t/BI_DB);if(o>=this.t)return void(r.t=0);var e=t%BI_DB,s=BI_DB-e,a=(1<<e)-1;n[0]=i[o]>>e;for(var h=o+1;h<this.t;++h)n[h-o-1]|=(i[h]&a)<<s,n[h-o]=i[h]>>e;e>0&&(n[this.t-o-1]|=(this.s&a)<<s),r.t=this.t-o,r.clamp()}function bnpSubTo(t,r){for(var i=this.array,n=r.array,o=t.array,e=0,s=0,a=Math.min(t.t,this.t);a>e;)s+=i[e]-o[e],n[e++]=s&BI_DM,s>>=BI_DB;if(t.t<this.t){for(s-=t.s;e<this.t;)s+=i[e],n[e++]=s&BI_DM,s>>=BI_DB;s+=this.s}else{for(s+=this.s;e<t.t;)s-=o[e],n[e++]=s&BI_DM,s>>=BI_DB;s-=t.s}r.s=0>s?-1:0,-1>s?n[e++]=BI_DV+s:s>0&&(n[e++]=s),r.t=e,r.clamp()}function bnpMultiplyTo(t,r){var i=(this.array,r.array),n=this.abs(),o=t.abs(),e=o.array,s=n.t;for(r.t=s+o.t;--s>=0;)i[s]=0;for(s=0;s<o.t;++s)i[s+n.t]=n.am(0,e[s],r,s,0,n.t);r.s=0,r.clamp(),this.s!=t.s&&BigInteger.ZERO.subTo(r,r)}function bnpSquareTo(t){for(var r=this.abs(),i=r.array,n=t.array,o=t.t=2*r.t;--o>=0;)n[o]=0;for(o=0;o<r.t-1;++o){var e=r.am(o,i[o],t,2*o,0,1);(n[o+r.t]+=r.am(o+1,2*i[o],t,2*o+1,e,r.t-o-1))>=BI_DV&&(n[o+r.t]-=BI_DV,n[o+r.t+1]=1)}t.t>0&&(n[t.t-1]+=r.am(o,i[o],t,2*o,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,r,i){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=r&&r.fromInt(0),void(null!=i&&this.copyTo(i));null=
11 years ago
},{}],174:[function(require,module,exports){
var util=require("util"),sprintf=function(){function r(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()}function e(r,e){for(var t=[];e>0;t[--e]=r);return t.join("")}var t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};return t.object_stringify=function(r,e,n,i){var s="";if(null!=r)switch(typeof r){case"function":return"[Function"+(r.name?": "+r.name:"")+"]";case"object":if(r instanceof Error)return"["+r.toString()+"]";if(e>=n)return"[Object]";if(i&&(i=i.slice(0),i.push(r)),null!=r.length){s+="[";var a=[];for(var o in r)a.push(i&&i.indexOf(r[o])>=0?"[Circular]":t.object_stringify(r[o],e+1,n,i));s+=a.join(", ")+"]"}else{if("getMonth"in r)return"Date("+r+")";s+="{";var a=[];for(var f in r)r.hasOwnProperty(f)&&a.push(i&&i.indexOf(r[f])>=0?f+": [Circular]":f+": "+t.object_stringify(r[f],e+1,n,i));s+=a.join(", ")+"}"}return s;case"string":return'"'+r+'"'}return""+r},t.format=function(n,i){var s,a,o,f,u,c,p,l=1,h=n.length,g="",b=[];for(a=0;h>a;a++)if(g=r(n[a]),"string"===g)b.push(n[a]);else if("array"===g){if(f=n[a],f[2])for(s=i[l],o=0;o<f[2].length;o++){if(!s.hasOwnProperty(f[2][o]))throw new Error(sprintf('[sprintf] property "%s" does not exist',f[2][o]));s=s[f[2][o]]}else s=f[1]?i[f[1]]:i[l++];if(/[^sO]/.test(f[8])&&"number"!=r(s))throw new Error(sprintf('[sprintf] expecting number but found %s "'+s+'"',r(s)));switch(f[8]){case"b":s=s.toString(2);break;case"c":s=String.fromCharCode(s);break;case"d":s=parseInt(s,10);break;case"e":s=f[7]?s.toExponential(f[7]):s.toExponential();break;case"f":s=f[7]?parseFloat(s).toFixed(f[7]):parseFloat(s);break;case"O":s=t.object_stringify(s,0,parseInt(f[7])||5);break;case"o":s=s.toString(8);break;case"s":s=(s=String(s))&&f[7]?s.substring(0,f[7]):s;break;case"u":s=Math.abs(s);break;case"x":s=s.toString(16);break;case"X":s=s.toString(16).toUpperCase()}s=/[def]/.test(f[8])&&f[3]&&s>=0?"+"+s:s,c=f[4]?"0"==f[4]?"0":f[4].charAt(1):" ",p=f[6]-String(s).length,u=f[6]?e(c,p):"",b.push(f[5]?s+u:u+s)}return b.join("")},t.cache={},t.parse=function(r){for(var e=r,t=[],n=[],i=0;e;){if(null!==(t=/^[^\x25]+/.exec(e)))n.push(t[0]);else if(null!==(t=/^\x25{2}/.exec(e)))n.push("%");else{if(null===(t=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosOuxX])/.exec(e)))throw new Error("[sprintf] "+e);if(t[2]){i|=1;var s=[],a=t[2],o=[];if(null===(o=/^([a-z_][a-z_\d]*)/i.exec(a)))throw new Error("[sprintf] "+a);for(s.push(o[1]);""!==(a=a.substring(o[0].length));)if(null!==(o=/^\.([a-z_][a-z_\d]*)/i.exec(a)))s.push(o[1]);else{if(null===(o=/^\[(\d+)\]/.exec(a)))throw new Error("[sprintf] "+a);s.push(o[1])}t[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(t)}e=e.substring(t[0].length)}return n},t}(),vsprintf=function(r,e){var t=e.slice();return t.unshift(r),sprintf.apply(null,t)};module.exports=sprintf,sprintf.sprintf=sprintf,sprintf.vsprintf=vsprintf;
11 years ago
},{"util":126}],175:[function(require,module,exports){
"use strict";exports.htons=function(t,o,r){t[o]=255&r>>8,t[o+1]=255&r},exports.ntohs=function(t,o){return(255&t[o])<<8|255&t[o+1]},exports.ntohsStr=function(t,o){return(255&t.charCodeAt(o))<<8|255&t.charCodeAt(o+1)},exports.htonl=function(t,o,r){t[o]=255&r>>24,t[o+1]=255&r>>16,t[o+2]=255&r>>8,t[o+3]=255&r},exports.ntohl=function(t,o){return(255&t[o])<<24|(255&t[o+1])<<16|(255&t[o+2])<<8|255&t[o+3]},exports.ntohlStr=function(t,o){return(255&t.charCodeAt(o))<<24|(255&t.charCodeAt(o+1))<<16|(255&t.charCodeAt(o+2))<<8|255&t.charCodeAt(o+3)};
11 years ago
},{}],176:[function(require,module,exports){
(function(n){function e(){function e(){if(0!==a.length){var n=a.shift();t=r=0,o=[];try{u=!0;var l=n.apply(e,arguments)}catch(i){e(i)}void 0!==l&&e(void 0,l),u=!1}else if(arguments[0])throw arguments[0]}var r,t,o,u,a=Array.prototype.slice.call(arguments);e.parallel=function(){function a(){0===r&&e.apply(null,o)}var l=1+t++;return r++,n.nextTick(a),function(){r--,arguments[0]&&(o[0]=arguments[0]),o[l]=arguments[1],u||a()}},e.group=function(){function r(){0===a&&t(i,l)}var t=e.parallel(),o=0,a=0,l=[],i=void 0;return n.nextTick(r),function(){var n=o++;return a++,function(){a--,arguments[0]&&(i=arguments[0]),l[n]=arguments[1],u||r()}}},e()}e.fn=function(){var n=Array.prototype.slice.call(arguments);return function(){var r=Array.prototype.slice.call(arguments),t=[function(){this.apply(null,r)}].concat(n);"function"==typeof r[r.length-1]&&t.push(r.pop()),e.apply(null,t)}},"undefined"!=typeof module&&"exports"in module&&(module.exports=e)}).call(this,require("/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
11 years ago
},{"/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110}],"./patches/Buffers.monkey":[function(require,module,exports){
module.exports=require('kytKTK');
},{}],"kytKTK":[function(require,module,exports){
(function(f){exports.patch=function(t){t.prototype.skip=function(t){if(0!=t){if(t==this.length)return this.buffers=[],void(this.length=0);var s=this.pos(t);this.buffers=this.buffers.slice(s.buf),this.buffers[0]=new f(this.buffers[0].slice(s.offset)),this.length-=t}}}}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93}],"./patches/Number.monkey":[function(require,module,exports){
module.exports=require('AwmEwz');
},{}],"AwmEwz":[function(require,module,exports){
exports.patch=function(t){t.prototype.round=function(t){if(!t)return Math.round(this);var r=Math.pow(10,t);return Math.round(this*r)/r}};
},{}],"./util/BinaryParser":[function(require,module,exports){
module.exports=require('b3ZSD7');
},{}],"b3ZSD7":[function(require,module,exports){
(function(t){function r(t){this.subject=t,this.pos=0}function o(t){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(256,o)*t[o];return r}function e(t){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(256,t.length-o-1)*t[o];return r}function n(t){var r=e(t);return 128==(128&t[0])&&(r-=Math.pow(256,t.length)),r}function s(t){var r=o(t);return 128==(128&t[t.length-1])&&(r-=Math.pow(256,t.length)),r}function i(t,r){return function(){var o=this.buffer(t);return r(o)}}r.prototype.buffer=function(t){var r=this.subject.slice(this.pos,this.pos+t);return this.pos+=t,r},r.prototype.search=function(r){var o;if("string"==typeof r||t.isBuffer(r))return o=this.subject.slice(this.pos).indexOf(r),-1!==o&&(this.pos+=o+r.length),o;if("number"==typeof r){r=255&r;for(var e=this.pos,n=this.subject.length;n>e;e++)if(this.subject[e]==r)return o=e-this.pos,this.pos=e+1,o;return-1}},r.prototype.scan=function(t){var r=this.pos,o=this.search(t);if(-1!==o)return this.subject.slice(r,r+o);throw new Error("No match")},r.prototype.eof=function(){return this.pos>=this.subject.length},[1,2,4,8].forEach(function(t){var p=8*t;r.prototype["word"+p+"le"]=r.prototype["word"+p+"lu"]=i(t,o),r.prototype["word"+p+"ls"]=i(t,s),r.prototype["word"+p+"be"]=r.prototype["word"+p+"bu"]=i(t,e),r.prototype["word"+p+"bs"]=i(t,n),r.prototype.word8=r.prototype.word8u=r.prototype.word8be,r.prototype.word8s=r.prototype.word8bs}),r.prototype.varInt=function(){var t=this.word8();switch(t){case 253:return this.word16le();case 254:return this.word32le();case 255:return this.word64le();default:return t}},r.prototype.varStr=function(){var t=this.varInt();return this.buffer(t)},module.exports=r}).call(this,require("buffer").Buffer);
11 years ago
},{"buffer":93}],183:[function(require,module,exports){
var fs=require("fs"),crypto=require("crypto");exports.readFileSync=function(r,e,i){var t=fs.readFileSync(i,"binary");if(t.length<32)throw new Error("Crypted file "+i+" truncated");var a=t.slice(0,-32),n=t.slice(-32),c=crypto.createHmac("sha256",e);c.update(a);var y=c.digest("binary");if(y.toString()!=n.toString())throw new Error("Crypted file "+i+" failed HMAC checksum verification");var o=crypto.createDecipher(r,e),p=o.update(a,"binary","binary");return p+=o.final("binary")},exports.readJFileSync=function(r,e,i){var t=this.readFileSync(r,e,i);return JSON.parse(t)},exports.writeFileSync=function(r,e,i,t){var a=crypto.createCipher(r,e),n=a.update(t,"binary","binary");n+=a.final("binary");var c=crypto.createHmac("sha256",e);c.update(n);var y=c.digest("binary");return fs.writeFileSync(i,n+y,"binary"),!0},exports.writeJFileSync=function(r,e,i,t){var a=JSON.stringify(t);return this.writeFileSync(r,e,i,a)};
11 years ago
},{"crypto":97,"fs":89}],"./util/EncodedData":[function(require,module,exports){
module.exports=require('eLfUFE');
},{}],"eLfUFE":[function(require,module,exports){
(function(n){function t(n,t){this.data=n,t||"string"!=typeof n?("undefined"==typeof this.encodings[t]&&(t="binary"),this.converters=this.encodings[t].converters,this._encoding=this.encodings[t]._encoding):(t="base58",this.converters=this.encodings[t].converters,this._encoding=this.encodings[t]._encoding)}var i=require("../lib/Base58").base58Check;t.prototype.encoding=function(n){return n&&n!=this._encoding&&(this.data=this.as(n),this.converters=this.encodings[n].converters,this._encoding=this.encodings[n]._encoding),this._encoding},t.prototype.withEncoding=function(n){return new t(this.as(n),n)},t.prototype.as=function(n){if(!e[n])throw new Error("invalid encoding: "+n);return this.converters[n].call(this)},t.prototype._validate=function(){this.withEncoding("binary")},t.prototype.isValid=function(){try{return this.validate(),!0}catch(n){return!1}},t.prototype.validate=function(){this._validate()},t.prototype.toString=function(){return this.as("base58")},t.prototype.doAsBinary=function(n){var t=this.encoding();this.encoding("binary"),n.apply(this),this.encoding(t)};var e={binary:{converters:{binary:function(){var t=new n(this.data.length);return this.data.copy(t),t},base58:function(){return i.encode(this.data)},hex:function(){return this.data.toString("hex")}},_validate:function(){}},base58:{converters:{binary:function(){return i.decode(this.data)},hex:function(){return this.withEncoding("binary").as("hex")}}},hex:{converters:{binary:function(){return new n(this.data,"hex")},base58:function(){return this.withEncoding("binary").as("base58")}}}},r=function(){return this.data};for(var o in e)e.hasOwnProperty(o)&&(e[o].converters[o]||(e[o].converters[o]=r),e[o]._encoding=o);t.applyEncodingsTo=function(n){var t={};for(var i in e){var r=e[i],o=Object.create(n.prototype);for(var s in r)o[s]=r[s];t[i]=o}n.prototype.encodings=t},t.applyEncodingsTo(t),module.exports=t}).call(this,require("buffer").Buffer);
11 years ago
},{"../lib/Base58":"6VqyzY","buffer":93}],"QLzNQg":[function(require,module,exports){
(function(i){function t(e,n){t.super_.call(this,e,n),"number"==typeof e&&(this.data=new i(n.length+1),this.encoding("binary"),this.version(e),this.payload(n))}var e=(require("../lib/Base58").base58Check,require("util")),n=require("./EncodedData");e.inherits(t,n),n.applyEncodingsTo(t),t.prototype.version=function(i){return i||0===i?(this.doAsBinary(function(){this.data.writeUInt8(i,0)}),i):this.as("binary").readUInt8(0)},t.prototype.payload=function(i){return i?(this.doAsBinary(function(){i.copy(this.data,1)}),i):this.as("binary").slice(1)},module.exports=t}).call(this,require("buffer").Buffer);
11 years ago
},{"../lib/Base58":"6VqyzY","./EncodedData":"eLfUFE","buffer":93,"util":126}],"./util/VersionedData":[function(require,module,exports){
module.exports=require('QLzNQg');
11 years ago
},{}],188:[function(require,module,exports){
function MissingSourceError(r,i){Error.call(this),this.message=r,this.missingTxHash=i,this.name="MissingSourceError"}function VerificationError(r,i){Error.call(this),this.message=r,this.missingTxHash=i,this.name="VerificationError"}MissingSourceError.prototype=Object.create(Error.prototype),exports.MissingSourceError=MissingSourceError,VerificationError.prototype=Object.create(Error.prototype),exports.VerificationError=VerificationError;
11 years ago
},{}],189:[function(require,module,exports){
module.exports=require("./util");
},{"./util":"ACyo5H"}],"./util/log":[function(require,module,exports){
module.exports=require('AdF7pF');
},{}],"AdF7pF":[function(require,module,exports){
"use strict";var noop=function(){},cl=function(){console.log(arguments)},loggers={none:{info:noop,warn:noop,err:noop,debug:noop},normal:{info:cl,warn:cl,err:cl,debug:noop},debug:{info:cl,warn:cl,err:cl,debug:cl}},config=require("../config");module.exports=config.log?config.log:loggers[config.logger||"normal"];
11 years ago
},{"../config":"4itQ50"}],192:[function(require,module,exports){
exports.curtime=function(){return Math.round(Date.now()/1e3)};
},{}],"ACyo5H":[function(require,module,exports){
(function(e,r){function t(e){for(e=e.substr(0,8);e.length<8;)e+="0";return e}function n(e){return i(e[1]).mul("100000000").add(t(e[2]))}function o(e){return i(t(e[1]))}function f(e){return i(e[1]).mul("100000000")}var u=require("crypto"),i=require("bignum"),s=require("binary"),a=require("bufferput"),c=require("buffertools"),h=require("../lib/sjcl");if(e.browser)var l=require("hash.js");{var p=exports.sha256=function(e){return new r(u.createHash("sha256").update(e).digest("binary"),"binary")},v=(exports.sha512=function(t){if(e.browser){var n=t.toString("hex"),o=h.codec.hex.toBits(n),f=h.hash.sha512.hash(o),i=h.codec.hex.fromBits(f),s=new r(i,"hex");return s}return new r(u.createHash("sha512").update(t).digest("binary"),"binary")},exports.sha512hmac=function(t,n){if(e.browser){var o=h.codec.hex.toBits(n.toString("hex")),f=h.codec.hex.toBits(t.toString("hex")),i=new h.misc.hmac(o,h.hash.sha512),s=i.encrypt(f),a=h.codec.hex.fromBits(s),c=new r(a,"hex");return c}var i=u.createHmac("sha512",n),l=i.update(t).digest();return l},exports.ripe160=function(t){if(!r.isBuffer(t))throw new Error("arg should be a buffer");return e.browser?new r(l.ripemd160().update(t).digest()):new r(u.createHash("rmd160").update(t).digest("binary"),"binary")}),g=(exports.sha1=function(e){return new r(u.createHash("sha1").update(e).digest("binary"),"binary")},exports.twoSha256=function(e){return p(p(e))},exports.sha256ripe160=function(e){return v(p(e))},exports.formatHash=function(e){var t=new r(10);return e.copy(t,0,22,32),c.reverse(t).toString("hex")},exports.formatHashFull=function(e){var t=new r(e.length);e.copy(t);var n=c.toHex(c.reverse(t));return n}),d=(exports.formatHashAlt=function(e){var r=g(e);return r=r.replace(/^0*/,""),r.substr(0,10)},exports.formatBuffer=function(e,t){null===t&&(t=10),(t>e.length||0===t)&&(t=e.length);var n=new r(t);e.copy(n,0,0,t);var o=c.toHex(n);return n.length<e.length&&(o+="..."),o},exports.valueToBigInt=function(e){return r.isBuffer(e)?i.fromBuffer(e,{endian:"little",size:8}):e});exports.bigIntToValue=function(e){return r.isBuffer(e)?e:e.toBuffer({endian:"little",size:8})}}exports.bytesNeededToStore=bytesNeededToStore=function(e){return 0===e?0:Math.ceil((e.toString(2).replace("-","").length+1)/8)},exports.negativeBuffer=negativeBuffer=function(e){for(var t=new r(e.length),n=0;n<e.length;n++)t[n]=~e[n],t[n]<0&&(t[n]+=256);for(var n=e.length-1;n>=0&&(t[n]+=1,t[n]>=256&&(t[n]-=256),0===t[n]);n--);return t},exports.intToBuffer2C=function(e){var r=bytesNeededToStore(e),t=new a,n=e.toString(16),o="-"===n[0];n=n.replace("-","");for(var f=0;r>f;f++){var u=n.substring(n.length-2*(f+1),n.length-2*f);1===u.length&&(u="0"+u);var i=parseInt(u,16);t.word8(i)}var s=t.buffer();return o&&(s=c.reverse(s),s=negativeBuffer(s),s=c.reverse(s)),s};var w=function(e){var t;return 128&e[0]?(t=new r(e.length+1),e.copy(t,1),t[0]=0):t=e,t};exports.intToBufferSM=function(e){"number"==typeof e&&(e=i(e));var t,n,o=e.cmp(0);return o>0?(t=e.toBuffer(),n=w(t),n=c.reverse(n)):0==o?n=new r([]):(t=e.neg().toBuffer(),n=w(t),n[0]|=128,n=c.reverse(n)),n},exports.bufferSMToInt=function(e){if(!e.length)return i(0);if(e.length>4)throw new Error("Bigint cast overflow (> 4 bytes)");var t=new r(e.length);e.copy(t),t=c.reverse(t);var n=128&t[0];return n?(t[0]&=127,i.fromBuffer(t).neg()):i.fromBuffer(t)};var x=(exports.formatValue=function(e){for(var r=d(e).toString(),t=r.length>8?r.substr(0,r.length-8):"0",n=r.length>8?r.substr(r.length-8):r;n.length<8;)n="0"+n;for(n=n.replace(/0*$/,"");n.length<2;)n+="0";return t+"."+n},/^\s*(\d+)\.(\d+)/),b=/^\s*\.(\d+)/,m=/^\s*(\d+)/;exports.parseValue=function(e){"string"!=typeof e&&(e=e.toString());var r=e.match(x);return r?n(r):(r=e.match(b))?o(r):(r=e.match(m),r?f(r):void 0)};{var B=(exports.createSynchrotron=function(e){var r={};return function(t){var n=Array.prototype.slice.call(arguments),o=function(){n[0]=function(){r[t]&&(r[t].length?r[t].shift()():delete r[t])},e.apply(null,n)};r[t]?r[t].push(o):(r[t]=[],o())}},exports.decodeDiffBits=function(e,t){e=+e;for(var n=i(16777215&e),o=8*((e>>>24)-3);o-->0;)n=n.mul(2);if(t
11 years ago
},{"../lib/sjcl":"oLMOpG","/home/maraoz/git/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":110,"bignum":59,"binary":81,"buffer":93,"bufferput":"aXRuS6","buffertools":"fugeBw","crypto":97,"hash.js":153}],"./util/util":[function(require,module,exports){
module.exports=require('ACyo5H');
},{}]},{},[])