31 lines
1,004 KiB
JavaScript
31 lines
1,004 KiB
JavaScript
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.kbpgp=e()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(){var C,DSA,ECDH,ECDSA,ElGamal,RSA;C=require("./const").openpgp.public_key_algorithms,RSA=require("./rsa").RSA,DSA=require("./dsa").DSA,ElGamal=require("./elgamal").ElGamal,ECDSA=require("./ecc/ecdsa").ECDSA,ECDH=require("./ecc/ecdh").ECDH,exports.get_class=function(n){switch(n){case C.RSA:case C.RSA_ENCRYPT_ONLY:case C.RSA_SIGN_ONLY:return RSA;case C.ELGAMAL:return ElGamal;case C.DSA:return DSA;case C.ECDSA:return ECDSA;case C.ECDH:return ECDH;default:throw new Error("unknown public key system: "+n)}}}).call(this)},{"./const":5,"./dsa":6,"./ecc/ecdh":9,"./ecc/ecdsa":10,"./elgamal":12,"./rsa":67}],2:[function(require,module,exports){(function(Buffer){(function(){var BaseKey,BaseKeyPair,C,K,SHA256,SHA512,SRF,bn,bufeq_secure,iced,konst,__iced_k,__iced_k_noop,_ref;iced=require("iced-runtime").iced,__iced_k=__iced_k_noop=function(){},konst=require("./const"),C=konst.openpgp,K=konst.kb,_ref=require("./hash"),SHA256=_ref.SHA256,SHA512=_ref.SHA512,bn=require("./bn"),bufeq_secure=require("pgp-utils").util.bufeq_secure,SRF=require("./rand").SRF,exports.BaseKey=BaseKey=function(){function BaseKey(){}return BaseKey.alloc=function(klass,raw,d){var err,o,orig_len,_i,_len,_ref1,_ref2;for(null==d&&(d={}),orig_len=raw.length,err=null,_ref1=klass.ORDER,_i=0,_len=_ref1.length;_len>_i;_i++)o=_ref1[_i],null==err&&(_ref2=bn.mpi_from_buffer(raw),err=_ref2[0],d[o]=_ref2[1],raw=_ref2[2]);return err?[err,null]:[null,new klass(d),orig_len-raw.length]},BaseKey.prototype.serialize=function(){var e;return Buffer.concat(function(){var _i,_len,_ref1,_results;for(_ref1=this.ORDER,_results=[],_i=0,_len=_ref1.length;_len>_i;_i++)e=_ref1[_i],_results.push(this[e].to_mpi_buffer());return _results}.call(this))},BaseKey.prototype.validity_check=function(cb){return cb(null)},BaseKey}(),exports.BaseKeyPair=BaseKeyPair=function(){function BaseKeyPair(_arg){this.priv=_arg.priv,this.pub=_arg.pub,this.pub.parent=this,null!=this.priv&&(this.priv.parent=this)}return BaseKeyPair.prototype.serialize=function(){return this.pub.serialize()},BaseKeyPair.prototype.hash=function(){return SHA256(this.serialize())},BaseKeyPair.prototype.ekid=function(){return Buffer.concat([new Buffer([K.kid.version,this.get_type()]),this.hash(),new Buffer([K.kid.trailer])])},BaseKeyPair.prototype.can_sign=function(){return null!=this.priv},BaseKeyPair.prototype.can_decrypt=function(){return null!=this.priv},BaseKeyPair.prototype.has_private=function(){return null!=this.priv},BaseKeyPair.prototype.fulfills_flags=function(){return!1},BaseKeyPair.prototype.is_toxic=function(){return!1},BaseKeyPair.prototype.nbits=function(){var _ref1;return null!=(_ref1=this.pub)?_ref1.nbits():void 0},BaseKeyPair.prototype.good_for_flags=function(){return C.key_flags.encrypt_comm|C.key_flags.encrypt_storage|C.key_flags.certify_keys|C.key_flags.sign_data},BaseKeyPair.prototype.eq=function(k2){return this.type===k2.type&&bufeq_secure(this.serialize(),k2.serialize())},BaseKeyPair.prototype.can_perform=function(ops_mask){return ops_mask&konst.ops.sign&&!this.can_sign()?!1:ops_mask&konst.ops.decrypt&&!this.can_decrypt()?!1:!0},BaseKeyPair.parse=function(klass,pub_raw){var err,key,len,_ref1;return _ref1=klass.Pub.alloc(pub_raw),err=_ref1[0],key=_ref1[1],len=_ref1[2],null!=key&&(key=new klass({pub:key})),[err,key,len]},BaseKeyPair.parse_kb=function(k
|
|||
|
}}(),lineno:100})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){return V=G.multiply(v),S=_this.R.multiply(v),params=_this.format_params({fingerprint:fingerprint}),key=_this.kdf({X:S,params:params}),C=wrap({key:key,plaintext:m,cipher:_this.cipher}),cb({V:V,C:C})}}(this))},Pub}(BaseEccKey),Priv=function(_super){function Priv(_arg){this.x=_arg.x,this.pub=_arg.pub}return __extends(Priv,_super),Priv.ORDER=["x"],Priv.prototype.ORDER=Priv.ORDER,Priv.prototype.serialize=function(){return this.x.to_mpi_buffer()},Priv.alloc=function(raw,pub){return BaseKey.alloc(Priv,raw,{pub:pub})},Priv.prototype.decrypt=function(c,_arg,cb){var S,V,curve,err,esc,fingerprint,key,params,ret,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),fingerprint=_arg.fingerprint,esc=make_esc(cb,"Priv::decrypt"),curve=this.pub.curve,function(){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/ecc/ecdh.iced",funcname:"Priv.decrypt"}),c.load_V(curve,esc(__iced_deferrals.defer({assign_fn:function(){return function(){return V=arguments[0]}}(),lineno:141}))),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){var _ref4;return S=V.multiply(_this.x),params=_this.pub.format_params({fingerprint:fingerprint}),key=_this.pub.kdf({X:S,params:params}),_ref4=unwrap({key:key,ciphertext:c.C,cipher:_this.pub.cipher}),err=_ref4[0],ret=_ref4[1],cb(err,ret)}}(this))},Priv}(BaseKey),Pair=function(_super){function Pair(){return Pair.__super__.constructor.apply(this,arguments)}return __extends(Pair,_super),Pair.Pub=Pub,Pair.prototype.Pub=Pub,Pair.Priv=Priv,Pair.prototype.Priv=Priv,Pair.type=Const.public_key_algorithms.ECDH,Pair.prototype.type=Pair.type,Pair.klass_name="ECDH",Pair.prototype.get_type=function(){return this.type},Pair.prototype.fulfills_flags=function(flags){var good_for;return good_for=Const.key_flags.encrypt_comm|Const.key_flags.encrypt_storage,(flags&good_for)===flags},Pair.prototype.can_sign=function(){return!1},Pair.parse=function(pub_raw){var ret;return ret=BaseKeyPair.parse(Pair,pub_raw)},Pair.prototype.max_value=function(){return this.pub.p},Pair.prototype.pad_and_encrypt=function(data,_arg,cb){var C,V,err,fingerprint,m,ret,___iced_passed_deferral,__iced_deferrals,__iced_k,_ref4;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),fingerprint=_arg.fingerprint,err=ret=null,_ref4=ecc_pkcs5_pad_data(data),err=_ref4[0],m=_ref4[1],function(_this){return function(__iced_k){return null!=err?__iced_k():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/ecc/ecdh.iced",funcname:"Pair.pad_and_encrypt"}),_this.pub.encrypt(m,{fingerprint:fingerprint},__iced_deferrals.defer({assign_fn:function(){return function(){return C=arguments[0].C,V=arguments[0].V}}(),lineno:196})),__iced_deferrals._fulfill()}(function(){return __iced_k(ret=_this.export_output({C:C,V:V,curve:_this.pub.curve}))})}}(this)(function(){return function(){return cb(err,ret)}}(this))},Pair.prototype.decrypt_and_unpad=function(ciphertext,_arg,cb){var err,fingerprint,m,ret,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),fingerprint=_arg.fingerprint,err=ret=null,function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/ecc/ecdh.iced",funcname:"Pair.decrypt_and_unpad"}),_this.priv.decrypt(ciphertext,{fingerprint:fingerprint},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],m=arguments[1]}}(),lineno:204})),__iced_deferrals._fulfill()}}(this)(function(){return function(){return cb(err,m,!0)}}(this))},Pair.parse_output=function(buf){return Output.parse(buf)},Pair.prototype.export_output=function(args){return new Output(args)},Pair.generate=function(_arg,cb){var asp,err,nbits,p
|
|||
|
},EncKeyManager.prototype.can_sign=function(){return!1},EncKeyManager.prototype.can_verify=function(){return!1},EncKeyManager.prototype.get_mask=function(){return C.key_flags.encrypt_comm|C.key_flags.encrypt_storage},EncKeyManager.import_public=function(_arg,cb){var err,hex,key,raw,ret,_ref1;return hex=_arg.hex,raw=_arg.raw,err=ret=null,null!=hex&&(raw=new Buffer(hex,"hex")),_ref1=DH.parse_kb(raw),err=_ref1[0],key=_ref1[1],null==err&&(ret=new EncKeyManager({key:key})),cb(err,ret)},EncKeyManager}(KeyManager),exports.unbox=unbox=function(_arg,cb){var armored,binary,encrypt_for,esc,packet,rawobj,res,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),armored=_arg.armored,binary=_arg.binary,rawobj=_arg.rawobj,encrypt_for=_arg.encrypt_for,esc=make_esc(cb,"unbox"),function(){return function(__iced_k){return null!=armored||null!=rawobj||null!=binary?__iced_k():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),athrow(new Error("need either 'armored' or 'binary' or 'rawobj'"),esc(__iced_deferrals.defer({lineno:134}))),__iced_deferrals._fulfill()}(__iced_k)}}(this)(function(){return function(){null!=armored&&(binary=new Buffer(armored,"base64")),function(__iced_k){return null==binary?__iced_k():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),akatch(function(){return encode.unseal(binary)},esc(__iced_deferrals.defer({assign_fn:function(){return function(){return rawobj=arguments[0]}}(),lineno:139}))),__iced_deferrals._fulfill()}(__iced_k)}(function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),asyncify(alloc(rawobj),esc(__iced_deferrals.defer({assign_fn:function(){return function(){return packet=arguments[0]}}(),lineno:141}))),__iced_deferrals._fulfill()}(function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),packet.unbox({encrypt_for:encrypt_for},esc(__iced_deferrals.defer({assign_fn:function(){return function(){return res=arguments[0]}}(),lineno:142}))),__iced_deferrals._fulfill()}(function(){return null!=res.keypair&&(res.km=new KeyManager({key:res.keypair})),null!=res.sender_keypair&&(res.sender_km=new KeyManager({key:res.sender_keypair})),null!=res.receiver_keypair&&(res.receiver_km=new KeyManager({key:res.receiver_keypair})),cb(null,res,binary)})})})}}(this))},box=function(_arg,cb){var anonymous,armored,encrypt_for,esc,msg,packed,packet,sealed,sign_with,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),msg=_arg.msg,sign_with=_arg.sign_with,encrypt_for=_arg.encrypt_for,anonymous=_arg.anonymous,esc=make_esc(cb,"box"),function(){return function(__iced_k){null!=encrypt_for?!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),Encryption.box({sign_with:sign_with,encrypt_for:encrypt_for,plaintext:msg,anonymous:anonymous},esc(__iced_deferrals.defer({assign_fn:function(){return function(){return packet=arguments[0]}}(),lineno:158}))),__iced_deferrals._fulfill()}(__iced_k):!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/keybase/hilev.iced"}),Signature.box({km:sign_with,payload:msg},esc(__iced_deferrals.defer({assign_fn:function(){return function(){return packet=arguments[0]}}(),lineno:160}))),__iced_deferrals._fulfill()}(__iced_k)}}(this)(function(){return function(){return packed=packet.frame_packet(),sealed=encode.seal({obj:packed,dohash:!1}),armored=sealed.toString("base64"),cb(null,armored,sealed)}}(this))},SignatureEngine=fu
|
|||
|
},SignatureEngineInterface.prototype.box=function(msg,cb){return cb(EUI)},SignatureEngineInterface.prototype.unbox=function(msb,cb){return cb(EUI)},SignatureEngineInterface}()}).call(this)},{"./keyfetch":24}],28:[function(require,module,exports){(function(){var Lock,NamedLock,Table,iced,__iced_k,__iced_k_noop,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};iced=require("iced-runtime").iced,__iced_k=__iced_k_noop=function(){},Lock=function(){function Lock(){this._open=!0,this._waiters=[]}return Lock.prototype.acquire=function(cb){return this._open?(this._open=!1,cb()):this._waiters.push(cb)},Lock.prototype.release=function(){var w;return this._waiters.length?(w=this._waiters.shift())():this._open=!0},Lock.prototype.open=function(){return this._open},Lock}(),NamedLock=function(_super){function NamedLock(tab,name){this.tab=tab,this.name=name,NamedLock.__super__.constructor.call(this),this.refs=0}return __extends(NamedLock,_super),NamedLock.prototype.incref=function(){return++this.refs},NamedLock.prototype.decref=function(){return--this.refs},NamedLock.prototype.release=function(){return NamedLock.__super__.release.call(this),0===this.decref()?delete this.tab[this.name]:void 0},NamedLock}(Lock),Table=function(){function Table(){this.locks={}}return Table.prototype.create=function(name){var l;return l=new NamedLock(this,name),this.locks[name]=l},Table.prototype.acquire=function(name,cb,wait){var l,was_open,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),l=this.locks[name]||this.create(name),was_open=l._open,l.incref(),function(){return function(__iced_k){return wait||l._open?void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/lock.iced",funcname:"Table.acquire"}),l.acquire(__iced_deferrals.defer({lineno:68})),__iced_deferrals._fulfill()}(__iced_k):__iced_k(l=null)}}(this)(function(){return function(){return cb(l,was_open)}}(this))},Table.prototype.lookup=function(name){return this.locks[name]},Table}(),exports.Lock=Lock,exports.Table=Table}).call(this)},{"iced-runtime":118}],29:[function(require,module,exports){(function(Buffer){(function(){var k,m,mods,util,v,_i,_len;for(mods=[require("./openpgp/keymanager"),require("./basex"),require("./openpgp/burner"),require("./openpgp/hilev"),require("./keyfetch"),require("./keyring")],_i=0,_len=mods.length;_len>_i;_i++){m=mods[_i];for(k in m)v=m[k],exports[k]=v}exports.util=util=require("./util"),exports.ASP=util.ASP,exports.rand=require("./rand"),exports["const"]=require("./const"),exports.processor=require("./openpgp/processor"),exports.armor=require("./openpgp/armor"),exports.keyring=require("./keyring"),exports.parser=require("./openpgp/parser"),exports.Buffer=Buffer,exports.triplesec=require("triplesec"),exports.hash=require("./hash"),exports.ecc=require("./ecc/main"),exports.nacl=require("./nacl/main"),exports.kb=require("./keybase/hilev"),exports.ukm=require("./ukm")}).call(this)}).call(this,require("buffer").Buffer)},{"./basex":3,"./const":5,"./ecc/main":11,"./hash":14,"./keybase/hilev":17,"./keyfetch":24,"./keyring":25,"./nacl/main":32,"./openpgp/armor":33,"./openpgp/burner":36,"./openpgp/hilev":41,"./openpgp/keymanager":42,"./openpgp/parser":56,"./openpgp/processor":57,"./rand":65,"./ukm":69,"./util":70,buffer:80,triplesec:181}],30:[function(require,module,exports){(function(Buffer){(function(){var BaseKey,BaseKeyPair,K,NaclEddsa,Pair,Priv,Pub,SRF,TYPE,b2u,box,bufeq_fast,genseed,iced,konst,u2b,__iced_k,__iced_k_noop,_ref,_ref1,_ref2,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__
|
|||
|
}}(_this),lineno:105})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){return _this._cipher=new _this._cipher_info.klass(WordArray.from_buffer(_this._session_key)),cb(null)}}(this))},Burner.prototype.scrub=function(){return null!=this._cipher&&this._cipher.scrub(),null!=this._session_key?scrub_buffer(this._session_key):void 0},Burner.prototype._encrypt_session_key_once=function(encryption_key,cb){var ekey,esc,fingerprint,key_id,payload,pkesk,pkt,pub_k,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),esc=make_esc(cb,"_encrypt_session_key_once"),payload=export_key_pgp(this._cipher_algo,this._session_key),pub_k=encryption_key.key,fingerprint=encryption_key.get_fingerprint(),function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),_this.asp.progress({what:"session key encrypt",i:0,total:1},esc(__iced_deferrals.defer({lineno:122}))),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),pub_k.pad_and_encrypt(payload,{fingerprint:fingerprint},esc(__iced_deferrals.defer({assign_fn:function(){return function(){return ekey=arguments[0]}}(),lineno:123}))),__iced_deferrals._fulfill()}(function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),_this.asp.progress({what:"session key encrypt",i:1,total:1},esc(__iced_deferrals.defer({lineno:124}))),__iced_deferrals._fulfill()}(function(){!function(__iced_k){return _this.opts.hide?(key_id=dummy_key_id,void function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),_this.asp.progress({what:"hide encryption",i:0,total:1},esc(__iced_deferrals.defer({lineno:127}))),__iced_deferrals._fulfill()}(function(){!function(__iced_k){var _ref3,_ref4;__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),ekey.hide({max:null!=(_ref3=_this.opts.hide)?_ref3.max:void 0,slosh:null!=(_ref4=_this.opts.hide)?_ref4.slosh:void 0,key:pub_k},esc(__iced_deferrals.defer({lineno:128}))),__iced_deferrals._fulfill()}(function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),_this.asp.progress({what:"hide encryption",i:1,total:1},esc(__iced_deferrals.defer({lineno:129}))),__iced_deferrals._fulfill()}(__iced_k)})})):__iced_k(key_id=encryption_key.get_key_id())}(function(){pkt=new PKESK({crypto_type:pub_k.type,key_id:key_id,ekey:ekey}),function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/burner.iced",funcname:"Burner._encrypt_session_key_once"}),pkt.write(esc(__iced_deferrals.defer({assign_fn:function(){return function(){return pkesk=arguments[0]}}(),lineno:137}))),__iced_deferrals._fulfill()}(function(){return cb(null,pkesk)})})})})}}(this))},Burner.prototype._encrypt_session_key=function(cb){var esc,k,pkesk,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),esc=make_esc(cb,"_encrypt_session_key"),this._pkesks=[],function(_this){return function(__iced_k){var _i,_len,_ref3,_results,_while;_ref3=_this.encryption_keys,_len=_ref3.length,_i=0,_results=[],(_while=function(__iced_k){var _break,_co
|
|||
|
},Global}(),G=new Global,CAST5=function(){function CAST5(key){var n;if(this.masking=new Array(16),this.rotate=new Array(16),this.reset(),key.sigBytes!==(n=this.keySize))throw new Error("key must be "+n+" bytes");this.keySchedule(key)}return CAST5.blockSize=8,CAST5.prototype.blockSize=CAST5.blockSize,CAST5.keySize=16,CAST5.prototype.keySize=CAST5.keySize,CAST5.prototype.reset=function(){var i,_i,_results;for(_results=[],i=_i=0;16>_i;i=++_i)this.masking[i]=0,_results.push(this.rotate[i]=0);return _results},CAST5.prototype.encryptBlock=function(words,offset){var bytes,res;return null==offset&&(offset=0),bytes=ui32a_to_ui8a(words),res=this._encrypt_ui8a(bytes),ui8a_to_ui32a(res,words)},CAST5.prototype.decryptBlock=function(words,offset){var bytes,res;return null==offset&&(offset=0),bytes=ui32a_to_ui8a(words),res=this._decrypt_ui8a(bytes),ui8a_to_ui32a(res,words)},CAST5.prototype._encrypt_ui8a=function(src){var dst,i,l,len,r,t,_i;for(len=src.length,dst=new Uint8Array(len),i=_i=0;len>_i;i=_i+=8)l=src[i]<<24|src[i+1]<<16|src[i+2]<<8|src[i+3],r=src[i+4]<<24|src[i+5]<<16|src[i+6]<<8|src[i+7],t=r,r=l^this.f1(r,this.masking[0],this.rotate[0]),l=t,t=r,r=l^this.f2(r,this.masking[1],this.rotate[1]),l=t,t=r,r=l^this.f3(r,this.masking[2],this.rotate[2]),l=t,t=r,r=l^this.f1(r,this.masking[3],this.rotate[3]),l=t,t=r,r=l^this.f2(r,this.masking[4],this.rotate[4]),l=t,t=r,r=l^this.f3(r,this.masking[5],this.rotate[5]),l=t,t=r,r=l^this.f1(r,this.masking[6],this.rotate[6]),l=t,t=r,r=l^this.f2(r,this.masking[7],this.rotate[7]),l=t,t=r,r=l^this.f3(r,this.masking[8],this.rotate[8]),l=t,t=r,r=l^this.f1(r,this.masking[9],this.rotate[9]),l=t,t=r,r=l^this.f2(r,this.masking[10],this.rotate[10]),l=t,t=r,r=l^this.f3(r,this.masking[11],this.rotate[11]),l=t,t=r,r=l^this.f1(r,this.masking[12],this.rotate[12]),l=t,t=r,r=l^this.f2(r,this.masking[13],this.rotate[13]),l=t,t=r,r=l^this.f3(r,this.masking[14],this.rotate[14]),l=t,t=r,r=l^this.f1(r,this.masking[15],this.rotate[15]),l=t,dst[i]=r>>>24&255,dst[i+1]=r>>>16&255,dst[i+2]=r>>>8&255,dst[i+3]=255&r,dst[i+4]=l>>>24&255,dst[i+5]=l>>>16&255,dst[i+6]=l>>>8&255,dst[i+7]=255&l;return dst},CAST5.prototype._decrypt_ui8a=function(src){var dst,i,l,len,r,t,_i;for(len=src.length,dst=new Uint8Array(len),i=_i=0;len>_i;i=_i+=8)l=src[i]<<24|src[i+1]<<16|src[i+2]<<8|src[i+3],r=src[i+4]<<24|src[i+5]<<16|src[i+6]<<8|src[i+7],t=r,r=l^this.f1(r,this.masking[15],this.rotate[15]),l=t,t=r,r=l^this.f3(r,this.masking[14],this.rotate[14]),l=t,t=r,r=l^this.f2(r,this.masking[13],this.rotate[13]),l=t,t=r,r=l^this.f1(r,this.masking[12],this.rotate[12]),l=t,t=r,r=l^this.f3(r,this.masking[11],this.rotate[11]),l=t,t=r,r=l^this.f2(r,this.masking[10],this.rotate[10]),l=t,t=r,r=l^this.f1(r,this.masking[9],this.rotate[9]),l=t,t=r,r=l^this.f3(r,this.masking[8],this.rotate[8]),l=t,t=r,r=l^this.f2(r,this.masking[7],this.rotate[7]),l=t,t=r,r=l^this.f1(r,this.masking[6],this.rotate[6]),l=t,t=r,r=l^this.f3(r,this.masking[5],this.rotate[5]),l=t,t=r,r=l^this.f2(r,this.masking[4],this.rotate[4]),l=t,t=r,r=l^this.f1(r,this.masking[3],this.rotate[3]),l=t,t=r,r=l^this.f3(r,this.masking[2],this.rotate[2]),l=t,t=r,r=l^this.f2(r,this.masking[1],this.rotate[1]),l=t,t=r,r=l^this.f1(r,this.masking[0],this.rotate[0]),l=t,dst[i]=r>>>24&255,dst[i+1]=r>>>16&255,dst[i+2]=r>>>8&255,dst[i+3]=255&r,dst[i+4]=l>>>24&255,dst[i+5]=l>>16&255,dst[i+6]=l>>8&255,dst[i+7]=255&l;return dst},CAST5.prototype.keySchedule=function(key){var a,b,half,i,j,k,ki,kw,round,t,w,x,_i,_j,_k,_l,_m,_results;for(t=function(){var _i,_len,_ref1,_results;for(_ref1=key.words,_results=[],_i=0,_len=_ref1.length;_len>_i;_i++)kw=_ref1[_i],_results.push(kw);return _results}(),k=new Array(32),x=[6,7,4,5],ki=0,half=_i=0;2>_i;half=++_i)for(round=_j=0;4>_j;round=++_j){for(j=_k=0;4>_k;j=++_k)a=G.scheduleA[round][j],w=t[a[1]],w^=G.sBox[4][t[a[2]>>>2]>>>24-8*(3&a[2])&255],w^=G.sBox[5][t[a[3]>>>2]>>>24-8*(3&a[3])&255],w^=G.sBox[6][t[a[4]>>>2]>>>24-8*(3&a[4])&255],w^=G.sBox[7][t[a[5]>>>2]>>>24-8*(3&a[5])&255],w^=G.sBox[x[j]][t[a[6]>>>2]>>>24-8*(3&a[6])&255],t[a[0]]=w;for(j=_l=0;4>_l;j=++_l)b=G.scheduleB[round][j]
|
|||
|
return _results},Engine.prototype._all_keys=function(){return[this.primary].concat(this.subkeys)},Engine.prototype.self_sign_primary=function(args,cb){return this._v_self_sign_primary(args,cb)},Engine.prototype.get_all_key_materials=function(){var k;return[[this.key(this.primary),!0]].concat(function(){var _i,_len,_ref5,_results;for(_ref5=this.subkeys,_results=[],_i=0,_len=_ref5.length;_len>_i;_i++)k=_ref5[_i],_results.push([this.key(k),!1]);return _results}.call(this))},Engine.prototype.sign_subkeys=function(_arg,cb){var asp,err,subkey,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),asp=_arg.asp,err=null,function(_this){return function(__iced_k){var _i,_len,_ref5,_results,_while;_ref5=_this.subkeys,_len=_ref5.length,_i=0,_results=[],(_while=function(__iced_k){var _break,_continue,_next;return _break=function(){return __iced_k(_results)},_continue=function(){return iced.trampoline(function(){return++_i,_while(__iced_k)})},_next=function(__iced_next_arg){return _results.push(__iced_next_arg),_continue()},_len>_i?(subkey=_ref5[_i],null!=err?_continue():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"Engine.sign_subkeys"}),_this._v_sign_subkey({asp:asp,subkey:subkey},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0]}}(),lineno:73})),__iced_deferrals._fulfill()}(_next)):_break()})(__iced_k)}}(this)(function(){return function(){return cb(err)}}(this))},Engine.prototype.get_subkey_materials=function(){var k,_i,_len,_ref5,_results;for(_ref5=this.subkeys,_results=[],_i=0,_len=_ref5.length;_len>_i;_i++)k=_ref5[_i],_results.push(this.key(k));return _results},Engine.prototype.is_locked=function(){var i,k,_i,_len,_ref5;for(_ref5=this._all_keys(),i=_i=0,_len=_ref5.length;_len>_i;i=++_i)if(k=_ref5[i],this.key(k).is_locked())return!0;return!1},Engine.prototype.has_private=function(){var k,_i,_len,_ref5;for(_ref5=this._all_keys(),_i=0,_len=_ref5.length;_len>_i;_i++)if(k=_ref5[_i],this.key(k).has_private())return!0;return!1},Engine.prototype.sign=function(_arg,cb){var asp,err,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),asp=_arg.asp,function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"Engine.sign"}),_this.self_sign_primary({asp:asp},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0]}}(),lineno:97})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){!function(__iced_k){return"undefined"!=typeof err&&null!==err?__iced_k():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"Engine.sign"}),_this.sign_subkeys({asp:asp},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0]}}(),lineno:98})),__iced_deferrals._fulfill()}(__iced_k)}(function(){return cb(err)})}}(this))},Engine.prototype.check_eq=function(eng2){var err,i,key,_i,_len,_ref5;if(err=null,this.primary.key.eq(eng2.primary.key))if(this.subkeys.length!==eng2.subkeys.length)err=new Error("different # of subkeys");else for(_ref5=this.subkeys,i=_i=0,_len=_ref5.length;_len>_i;i=++_i)key=_ref5[i],null==this.err&&(key.key.eq(eng2.subkeys[i].key)||(err=new Error("subkey "+i+" doesn't match")));else err=new Error("Primary keys don't match");return err},Engine.prototype.merge_private=function(eng2){var err,i,k,_i,_len,_ref5;if(err=this._merge_private_primary(eng2),null==err)for(_ref5=eng2.subkeys,i=_i=0,_len=_ref5.length;_len>_i&&(k=_ref5[i],null==(err=this._merge_private_subkey(k,i)));i=++_i);return err},Engine.prototype._merge_private_primary=function(eng2){var err;return err=this.key(eng2.primary).has_secret_key_material
|
|||
|
}}(),lineno:654})),__iced_deferrals._fulfill()}}(this)(function(){return function(){return cb(err,msg)}}(this))},KeyManager.prototype.export_private=function(_arg,cb){var asp,err,p3skb,passphrase,res,tsenc,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),passphrase=_arg.passphrase,p3skb=_arg.p3skb,asp=_arg.asp,function(_this){return function(__iced_k){p3skb?(tsenc=new Encryptor({key:bufferify(passphrase)}),function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"KeyManager.export_private"}),_this.export_private_to_server({tsenc:tsenc,asp:asp},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],res=arguments[1]}}(),lineno:662})),__iced_deferrals._fulfill()}(__iced_k)):!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"KeyManager.export_private"}),_this.export_pgp_private_to_client({passphrase:passphrase,asp:asp},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],res=arguments[1]}}(),lineno:664})),__iced_deferrals._fulfill()}(__iced_k)}}(this)(function(){return function(){return cb(err,res)}}(this))},KeyManager.prototype.sign_pgp=function(_arg,cb){var asp;return asp=_arg.asp,this.pgp.sign({asp:asp},cb)},KeyManager.prototype.sign=function(_arg,cb){var asp,err,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),asp=_arg.asp,asp=ASP.make(asp),asp.section("sign"),asp.progress({what:"sign PGP",total:1,i:0}),function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/keymanager.iced",funcname:"KeyManager.sign"}),_this.sign_pgp({asp:asp},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0]}}(),lineno:677})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){return asp.progress({what:"sign PGP",total:1,i:1}),("undefined"==typeof err||null===err)&&(_this._signed=!0),cb(err)}}(this))},KeyManager.prototype.get_userids=function(){return this.userids},KeyManager.prototype.get_userids_mark_primary=function(){var do_insert,i,k,max,max_s,mymax,obj,pair,prev,primary_time,ret,s,tab,userid,_i,_len,_ref5;for(max=null,max_s=null,tab={},mymax=function(a,b){return null==a&&null==b?null:null==a?b:null==b?a:a>b?a:b},_ref5=this.userids,i=_i=0,_len=_ref5.length;_len>_i;i=++_i)userid=_ref5[i],null!=userid&&(s=userid.utf8(),pair=userid.time_primary_pair(),obj={userid:userid,pair:pair,i:i},do_insert=!1,null!=(prev=tab[s])?(primary_time=mymax(prev.pair[1],pair[1]),(null==prev.pair[0]||pair[0]&&prev.pair[0]<pair[0])&&(do_insert=!0)):(primary_time=pair[1],do_insert=!0),do_insert&&(tab[s]=obj),null!=primary_time&&(null==max||primary_time>max)&&(max_s=s,max=primary_time));null!=max_s&&(tab[max_s].userid.primary=!0),ret=[];for(k in tab)obj=tab[k],obj.userid.most_recent_sig=obj.pair[0],ret.push(obj.userid);return ret},KeyManager.prototype.fetch=function(key_ids,flags,cb){return this.pgp.fetch(key_ids,flags,cb)},KeyManager.prototype.find_pgp_key=function(key_id){return this.pgp.find_key(key_id)},KeyManager.prototype.find_pgp_key_material=function(key_id){return this.pgp.find_key_material(key_id)},KeyManager.prototype.find_best_pgp_key=function(flags,need_priv){return this.pgp.find_best_key(flags,need_priv)},KeyManager.prototype.find_signing_pgp_key=function(){return this.find_best_pgp_key(C.key_flags.sign_data,!0)},KeyManager.prototype.find_verifying_pgp_key=function(){return this.find_best_pgp_key(C.key_flags.sign_data,!1)},KeyManager.prototype.find_crypt_pgp_key=function(need_priv){return null==need_priv&&(need_priv=!1),this.find_best_pgp_key(C.key_flags.encrypt_comm,need_priv)},KeyManager.prototype.can_verify=function(){return null!=this.find
|
|||
|
},KeyMaterial.prototype.add_flags=function(v){return this.flags|=v},KeyMaterial.prototype.private_body=function(opts){var bufs,p,pp,priv,ret;return bufs=[],this._write_public(bufs),priv=null!=(p=this.key.priv)?p.serialize():null,pp=opts.passphrase||this.passphrase,null==priv?this._write_dummy(bufs):null!=pp?this._write_private_enc(bufs,priv,pp):this._write_private_clear(bufs,priv),ret=Buffer.concat(bufs)},KeyMaterial.prototype.private_framed=function(opts){var T,body,tag;return body=this.private_body(opts),T=C.packet_tags,tag=opts.subkey?T.secret_subkey:T.secret_key,this.frame_packet(tag,body)},KeyMaterial.prototype.public_body=function(){var bufs;return bufs=[],this._write_public(bufs),Buffer.concat(bufs)},KeyMaterial.prototype.get_fingerprint=function(){var data;return data=this.public_body(),(new SHA1).bufhash(Buffer.concat([new Buffer([C.signatures.key]),uint_to_buffer(16,data.length),data]))},KeyMaterial.prototype.get_key_id=function(){return this.get_fingerprint().slice(12,20)},KeyMaterial.prototype.get_short_key_id=function(){return this.get_key_id().slice(-4).toString("hex").toUpperCase()},KeyMaterial.prototype.get_klass=function(){return this.key.constructor},KeyMaterial.prototype.export_framed=function(opts){return null==opts&&(opts={}),opts["private"]?this.private_framed(opts):this.public_framed(opts)},KeyMaterial.prototype.public_framed=function(opts){var T,body,tag;return null==opts&&(opts={}),body=this.public_body(),T=C.packet_tags,tag=opts.subkey?T.public_subkey:T.public_key,this.frame_packet(tag,body)},KeyMaterial.prototype.to_signature_payload=function(){var pk;return pk=this.public_body(),Buffer.concat([new Buffer([C.signatures.key]),uint_to_buffer(16,pk.length),pk])},KeyMaterial.prototype.self_sign_key=function(_arg,cb){var err,lifespan,primary,raw_payload,sig,sigs,userid,userids,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),userids=_arg.userids,lifespan=_arg.lifespan,raw_payload=_arg.raw_payload,err=null,sigs=[],primary=!0,function(_this){return function(__iced_k){var _i,_len,_ref4,_results,_while;_ref4=userids,_len=_ref4.length,_i=0,_results=[],(_while=function(__iced_k){var _break,_continue,_next;return _break=function(){return __iced_k(_results)},_continue=function(){return iced.trampoline(function(){return++_i,_while(__iced_k)})},_next=function(__iced_next_arg){return _results.push(__iced_next_arg),_continue()},_len>_i?(userid=_ref4[_i],null!=err?_continue():(sig=null,void function(__iced_k){return _this.key.can_sign()||raw_payload?void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/packet/keymaterial.iced",funcname:"KeyMaterial.self_sign_key"}),_this._self_sign_key({userid:userid,lifespan:lifespan,raw_payload:raw_payload,primary:primary},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],sig=arguments[1]}}(),lineno:193})),__iced_deferrals._fulfill()}(__iced_k):__iced_k(null==(sig=userid.get_framed_signature_output())?err=new Error("Cannot sign key --- don't have a private key, and can't replay"):void 0)}(function(){return primary=!1,_next(sigs.push(sig))}))):_break()})(__iced_k)}}(this)(function(){return function(){return cb(err,sig)}}(this))},KeyMaterial.prototype._self_sign_key=function(_arg,cb){var err,hsp,lifespan,payload,primary,ps,raw_payload,sig,type,userid,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),userid=_arg.userid,lifespan=_arg.lifespan,raw_payload=_arg.raw_payload,primary=_arg.primary,payload=Buffer.concat([this.to_signature_payload(),userid.to_signature_payload()]),type=C.sig_types.positive,hsp=[new S.CreationTime(lifespan.generated),new S.KeyFlags([this.flags]),new S.PreferredSymmetricAlgorithms([C.symmetric_key_algorithms.AES256,C.symmetric_key_algorithms.AES128]),new S.PreferredHashAlgorithms([C.hash_algorithms.SHA512,C.hash_algorithms.SHA256]),new S.Features([C.features.modification_de
|
|||
|
}}(),lineno:81}))),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){plaintext=Buffer.concat([plaintext,MDC.header,mdc_buf]),function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/packet/sess.iced",funcname:"SEIPD.encrypt"}),encrypt({cipher:cipher,plaintext:plaintext,prefixrandom:prefixrandom},esc(__iced_deferrals.defer({assign_fn:function(__slot_1){return function(){return __slot_1.ciphertext=arguments[0]}}(_this),lineno:83}))),__iced_deferrals._fulfill()}(function(){return cb(null)})}}(this))},SEIPD.prototype.write_unframed=function(cb){var err,ret;return err=ret=null,ret=Buffer.concat([uint_to_buffer(8,C.versions.SEIPD),this.ciphertext]),cb(err,ret)},SEIPD.prototype.write=function(cb){var err,ret,unframed,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),ret=err=null,function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/packet/sess.iced",funcname:"SEIPD.write"}),_this.write_unframed(__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],unframed=arguments[1]}}(),lineno:97})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){return null==err&&(ret=_this.frame_packet(C.packet_tags.SEIPD,unframed)),cb(err,ret)}}(this))},SEIPD}(Packet),MDC=function(_super){function MDC(_arg){this.digest=_arg.digest}return __extends(MDC,_super),MDC.header=new Buffer([192|C.packet_tags.MDC,SHA1.output_length]),MDC.prototype.header=MDC.header,MDC.parse=function(buf){return new MDC_Parser(buf).parse()},MDC.prototype.compute=function(_arg,cb){var asp,esc,hasher,i,plaintext,prefix,step,___iced_passed_deferral,__iced_deferrals,__iced_k,_begin,_end,_positive;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),plaintext=_arg.plaintext,prefix=_arg.prefix,asp=_arg.asp,asp=ASP.make(asp),hasher=streamers.SHA1(),hasher.update(Buffer.concat([prefix,prefix.slice(-2)])),esc=make_esc(cb,"MDC::compute"),step=1048576,function(){return function(__iced_k){var _results,_while;i=0,_begin=0,_end=plaintext.length,_positive=_end>_begin,_results=[],(_while=function(__iced_k){var _break,_continue,_next;return _break=function(){return __iced_k(_results)},_continue=function(){return iced.trampoline(function(){return _positive?i+=step:i-=step,_while(__iced_k)})},_next=function(__iced_next_arg){return _results.push(__iced_next_arg),_continue()},_positive===!0&&i>=plaintext.length||_positive===!1&&i<=plaintext.length?_break():(hasher.update(plaintext.slice(i,i+step)),void function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/openpgp/packet/sess.iced",funcname:"MDC.compute"}),asp.progress({what:"MDC",total:plaintext.length,i:i},esc(__iced_deferrals.defer({lineno:122}))),__iced_deferrals._fulfill()}(_next))})(__iced_k)}}(this)(function(_this){return function(){return hasher.update(_this.header),_this.computed=hasher(),cb(null,_this.computed)}}(this))},MDC.prototype.check=function(){return bufeq_secure(this.digest,this.computed)},MDC}(Packet),MDC_Parser=function(){function MDC_Parser(buf){this.buf=buf}return MDC_Parser.prototype.parse=function(){var chunk,digest,hl,len,rem;if(hl=MDC.header.length,len=SHA1.output_length+hl,rem=this.buf.slice(0,-len),chunk=this.buf.slice(-len),!bufeq_fast(chunk.slice(0,hl),MDC.header))throw new Error("Missing MDC header");return digest=chunk.slice(hl),[new MDC({digest:digest}),rem]},MDC_Parser}(),SEIPD_Parser=function(){function SEIPD_Parser(slice){this.slice=slice}return SEIPD_Parser.prototype.payload_split=function(){},SEIPD_Parser.prototype.parse=function(){var ciphertext,v;if((v=this.slice.read_uint8())!==C.versions.SEIPD)throw new Error("Unknown SEIPD version "+v);return ciphertext=this.slice.consume_rest_to_buffer(),new SEIPD({ciphertext:ciphertext})},SEIPD_Parser}(),PKESK_Parser=fun
|
|||
|
},Parser.prototype.parse_v4=function(){var end,hashed_subpacket_count,o,unhashed_subpacket_count;return o={},o.type=this.slice.read_uint8(),o.public_key_class=asymmetric.get_class(this.slice.read_uint8()),o.hasher=alloc_or_throw(this.slice.read_uint8()),hashed_subpacket_count=this.slice.read_uint16(),end=this.slice.i+hashed_subpacket_count,o.sig_data=this.slice.peek_to_buffer(hashed_subpacket_count),o.hashed_subpackets=function(){var _results;for(_results=[];this.slice.i<end;)_results.push(this.parse_subpacket());return _results}.call(this),unhashed_subpacket_count=this.slice.read_uint16(),end=this.slice.i+unhashed_subpacket_count,o.unhashed_subpackets=function(){var _results;for(_results=[];this.slice.i<end;)_results.push(this.parse_subpacket());return _results}.call(this),o.signed_hash_value_hash=this.slice.read_uint16(),o.sig=o.public_key_class.parse_sig(this.slice),o.version=4,new Signature(o)},Parser.prototype.parse_subpacket=function(){var critical,end,five_byte_len,klass,len,raw_type,ret,type,_ref3;return _ref3=this.slice.read_v4_length(),len=_ref3[0],five_byte_len=_ref3[1],raw_type=this.slice.read_uint8(),type=127&raw_type,critical=!!(128&raw_type),end=this.slice.clamp(len-1),klass=function(){switch(type){case S.creation_time:return CreationTime;case S.expiration_time:return ExpirationTime;case S.exportable_certificate:return Exportable;case S.trust_signature:return Trust;case S.regular_expression:return RegularExpression;case S.revocable:return Revocable;case S.key_expiration_time:return KeyExpirationTime;case S.preferred_symmetric_algorithms:return PreferredSymmetricAlgorithms;case S.revocation_key:return RevocationKey;case S.issuer:return Issuer;case S.notation_data:return NotationData;case S.preferred_hash_algorithms:return PreferredHashAlgorithms;case S.preferred_compression_algorithms:return PreferredCompressionAlgorithms;case S.key_server_preferences:return KeyServerPreferences;case S.preferred_key_server:return PreferredKeyServer;case S.primary_user_id:return PrimaryUserId;case S.policy_uri:return PolicyURI;case S.key_flags:return KeyFlags;case S.signers_user_id:return SignersUserID;case S.reason_for_revocation:return ReasonForRevocation;case S.features:return Features;case S.signature_target:return SignatureTarget;case S.embedded_signature:return EmbeddedSignature;default:if(type>=S.experimental_low&&type<=S.experimental_high)return Experimental;throw new Error("Unknown signature subpacket: "+type)}}(),ret=klass.parse(this.slice,type),ret.set_opts({critical:critical,five_byte_len:five_byte_len}),this.slice.unclamp(end),ret},Parser.prototype.parse=function(){var version;switch(version=this.slice.read_uint8()){case C.versions.signature.V2:return this.parse_v2_or_v3(version,Signature_v2);case C.versions.signature.V3:return this.parse_v2_or_v3(version,Signature_v3);case C.versions.signature.V4:return this.parse_v4();default:throw new Error("Unknown signature version: "+version)}},Parser}(),exports.CreationTime=CreationTime,exports.KeyFlags=KeyFlags,exports.KeyExpirationTime=KeyExpirationTime,exports.PreferredSymmetricAlgorithms=PreferredSymmetricAlgorithms,exports.PreferredHashAlgorithms=PreferredHashAlgorithms,exports.Features=Features,exports.KeyServerPreferences=KeyServerPreferences,exports.Issuer=Issuer,exports.EmbeddedSignature=EmbeddedSignature,exports.PrimaryUserId=PrimaryUserId}).call(this)}).call(this,require("buffer").Buffer)},{"../../asymmetric":1,"../../const":5,"../../hash":14,"../../util":70,"../buffer":35,"../util":60,"./base":45,"./packetsigs":51,assert:75,buffer:80,"iced-error":115,"iced-runtime":118,util:114}],54:[function(require,module,exports){(function(Buffer){(function(){var AES,C,Packet,SHA1,SHA256,UserAttribute,bufferify,encrypt,native_rng,parse,triplesec,uint_to_buffer,_ref,_ref1,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};C=require("../../const").ope
|
|||
|
__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),packets=_arg.packets,function(_this){return function(__iced_k){return null==_this.data&&null==_this.data_fn?__iced_k(err=new Error("Cannot verify detached signature without data input")):void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/processor.iced",funcname:"Message._verify_signature"}),verify_detached({packets:packets,data:_this.data,data_fn:_this.data_fn,keyfetch:_this.keyfetch},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],literals=arguments[1]}}(),lineno:314})),__iced_deferrals._fulfill()}(__iced_k)}}(this)(function(){return function(){return cb(err,literals)}}(this))},Message.prototype._process=function(_arg,cb){var err,literals,msg,packets,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),msg=_arg.msg,packets=_arg.packets,msg.type||(msg.type=C.message_types.generic),function(_this){return function(__iced_k){switch(msg.type){case C.message_types.generic:!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/processor.iced",funcname:"Message._process"}),_this._process_generic({packets:packets},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],literals=arguments[1]}}(),lineno:323})),__iced_deferrals._fulfill()}(__iced_k);break;case C.message_types.clearsign:!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/processor.iced",funcname:"Message._process"}),_this._verify_clearsign({packets:packets,clearsign:msg.clearsign},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],literals=arguments[1]}}(),lineno:325})),__iced_deferrals._fulfill()}(__iced_k);break;case C.message_types.signature:!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/processor.iced",funcname:"Message._process"}),_this._verify_signature({packets:packets},__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],literals=arguments[1]}}(),lineno:327})),__iced_deferrals._fulfill()}(__iced_k);break;default:return __iced_k(err=new Error("Needed a 'generic', 'clearsign', or 'signature' PGP message, got "+msg.type))}}}(this)(function(){return function(){return cb(err,literals)}}(this))},Message}(),exports.KeyBlock=KeyBlock,exports.Message=Message,exports.do_message=do_message=function(_arg,cb){var armored,data,data_fn,err,esk,keyfetch,literals,msg,msg_type,proc,raw,strict,warnings,___iced_passed_deferral,__iced_deferrals,__iced_k,_ref1;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),armored=_arg.armored,raw=_arg.raw,msg_type=_arg.msg_type,keyfetch=_arg.keyfetch,data_fn=_arg.data_fn,data=_arg.data,strict=_arg.strict,literals=null,err=msg=warnings=esk=null,null!=armored?(_ref1=armor.decode(armored),err=_ref1[0],msg=_ref1[1]):null!=raw?(msg_type||(msg_type=C.message_types.generic),msg={body:raw,type:msg_type}):err=new Error("No input to do_message; need either 'armored' or 'raw' input"),function(){return function(__iced_k){return null!=err?__iced_k():(null==strict&&(strict=!0),proc=new Message({keyfetch:keyfetch,data_fn:data_fn,data:data,strict:strict}),function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/Users/max/src/keybase/kbpgp/src/openpgp/processor.iced"}),proc.parse_and_process(msg,__iced_deferrals.defer({assign_fn:function(){return function(){return err=arguments[0],literals=arguments[1]}}(),lineno:373})),__iced_deferrals._fulfill()}(function(){return warnings=proc.warnings,__iced_k(esk=proc.encryption_subkey)}),void 0)}}(this)(function(){return function(){return cb(err,literals,warnings,esk)}}(this))
|
|||
|
}).call(this)},{}],65:[function(require,module,exports){(function(){var BigInteger,Lock,MRF,MediumRandomFountain,SRF,StrongRandomFountain,WordArray,iced,native_rng,prng,__iced_k,__iced_k_noop,_mrf,_ref,_srf;iced=require("iced-runtime").iced,__iced_k=__iced_k_noop=function(){},BigInteger=require("bn").BigInteger,_ref=require("triplesec"),WordArray=_ref.WordArray,prng=_ref.prng,native_rng=prng.native_rng,Lock=require("./lock").Lock,MediumRandomFountain=function(){function MediumRandomFountain(){}return MediumRandomFountain.prototype.nextBytes=function(v){var b,c,i,_i,_len,_results;for(b=native_rng(v.length),_results=[],i=_i=0,_len=b.length;_len>_i;i=++_i)c=b[i],_results.push(v[i]=c);return _results},MediumRandomFountain.prototype.random_word=function(){return native_rng(4).readUInt32BE(0)},MediumRandomFountain.prototype.random_zn=function(n){for(var i;;)if(i=BigInteger.random_nbit(n.bitLength(),this),i.compareTo(BigInteger.ONE)>0&&i.compareTo(n)<0)return i},MediumRandomFountain}(),_mrf=null,MRF=function(){return null==_mrf&&(_mrf=new MediumRandomFountain),_mrf},StrongRandomFountain=function(){function StrongRandomFountain(){this.buf=null,this.lock=new Lock}return StrongRandomFountain.prototype.random_word=function(cb){var wa,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),function(){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/rand.iced",funcname:"StrongRandomFountain.random_word"}),prng.generate(4,__iced_deferrals.defer({assign_fn:function(){return function(){return wa=arguments[0]}}(),lineno:49})),__iced_deferrals._fulfill()}}(this)(function(){return function(){return cb(wa.to_buffer().readUInt32BE(0))}}(this))},StrongRandomFountain.prototype.random_double=function(cb){var wa,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),function(){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/rand.iced",funcname:"StrongRandomFountain.random_double"}),prng.generate(8,__iced_deferrals.defer({assign_fn:function(){return function(){return wa=arguments[0]}}(),lineno:55})),__iced_deferrals._fulfill()}}(this)(function(){return function(){return cb(wa.to_buffer().readDoubleBE(0))}}(this))},StrongRandomFountain.prototype.rand_0_1=function(cb){var ret,w1,w2,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/rand.iced",funcname:"StrongRandomFountain.rand_0_1"}),_this.random_word(__iced_deferrals.defer({assign_fn:function(){return function(){return w1=arguments[0]}}(),lineno:61})),__iced_deferrals._fulfill()}}(this)(function(_this){return function(){!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/kbpgp/src/rand.iced",funcname:"StrongRandomFountain.rand_0_1"}),_this.random_word(__iced_deferrals.defer({assign_fn:function(){return function(){return w2=arguments[0]}}(),lineno:62})),__iced_deferrals._fulfill()}(function(){return ret=w1*Math.pow(2,-32)+w2*Math.pow(2,-64),cb(ret)})}}(this))},StrongRandomFountain.prototype.random_zn=function(n,cb){var go,ret,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),go=!0,ret=!1,function(_this){return function(__iced_k){var _results,_while;_results=[],(_while=function(__iced_k){var _break,_continue,_next;return _break=function(){return __iced_k(_results)},_continue=function(){return iced.trampoline(function(){return _while(__iced_k)})},_next=function(__iced_next_arg){return _results.push(__iced_next_arg),_continue()},go?void!function(__iced_k){__iced_deferrals=new iced.Deferrals
|
|||
|
}function nbv(i){return new BigInteger(bigint(i))}function bigint_or_number(x){return"number"==typeof x?nbv(x):x}function buffer_to_array(b){for(var ret=new Array,i=0;i<b.length;i++)ret[i]=b.readUInt8(i);return ret}function nbits(x){var t,r=1;return 0!=(t=x>>>16)&&(x=t,r+=16),0!=(t=x>>8)&&(x=t,r+=8),0!=(t=x>>4)&&(x=t,r+=4),0!=(t=x>>2)&&(x=t,r+=2),0!=(t=x>>1)&&(x=t,r+=1),r}var bigint=require("./wrap").engine,zed=bigint(0),one=bigint(1);BigInteger.prototype.bitLength=function(){var ret;return ret=0==this.signum()?0:this._v.bitLength()},BigInteger.prototype.byteLength=function(){return this.bitLength()>>3},BigInteger.prototype.modPowInt=function(i,n){return new BigInteger(this._v.powm(bigint(i),n._v))},BigInteger.prototype.modInt=function(i){return this._v.mod(bigint(i)).toNumber()},BigInteger.prototype.testBit=function(i){var bi=one.shiftLeft(i),tmp=this._v.and(bi),ret=tmp.eq(zed)?0:1;return ret},BigInteger.prototype.setBit=function(i){var mask=bigint(1).shiftLeft(i);return new BigInteger(this._v.or(mask))},BigInteger.prototype.shiftLeft=function(i){return new BigInteger(this._v.shiftLeft(i))},BigInteger.prototype.shiftRight=function(i){return new BigInteger(this._v.shiftRight(i))},BigInteger.prototype.compareTo=function(b){return this._v.cmp(b._v)},BigInteger.prototype.modPow=function(e,n){return new BigInteger(this._v.powm(e._v,n._v))},BigInteger.prototype.square=function(){return new BigInteger(this._v.mul(this._v))},BigInteger.prototype.mod=function(m){var x=this._v.mod(m._v);return x.cmp(zed)<0&&(x=x.add(m._v)),new BigInteger(x)},BigInteger.prototype.abs=function(){return new BigInteger(this._v.abs())},BigInteger.prototype.pow=function(e){return new BigInteger(this._v.pow(bigint_or_number(e)._v))},BigInteger.prototype.intValue=function(){return this._v.toNumber()},BigInteger.prototype.signum=function(){var cmp=this._v.cmp(zed);return ret=cmp>0?1:0===cmp?0:-1},BigInteger.prototype.negate=function(){return new BigInteger(this._v.neg())},BigInteger.prototype.equals=function(b){return this._v.eq(b._v)},BigInteger.prototype.subtract=function(x){return new BigInteger(this._v.sub(x._v))},BigInteger.prototype.add=function(x){return new BigInteger(this._v.add(x._v))},BigInteger.prototype.multiply=function(x){return new BigInteger(this._v.mul(x._v))},BigInteger.prototype.divide=function(x){if(this._v.ge(zed)&&x._v.ge(zed))i=this._v.div(x._v);else{var sign=this.signum()*x.signum();i=this._v.abs().div(x._v.abs()),0>sign&&(i=i.neg())}return new BigInteger(i)},BigInteger.prototype.gcd=function(x){return new BigInteger(this._v.gcd(x._v))},BigInteger.prototype.fromBuffer=function(x){return new BigInteger(bigint.fromBuffer(x))},BigInteger.fromByteArrayUnsigned=function(b){return BigInteger.fromBuffer(new Buffer(b))},BigInteger.fromBuffer=function(x){return new BigInteger(bigint.fromBuffer(x))},BigInteger.fromDERInteger=function(buf){var ret;if(0==buf.length)ret=BigInteger.ZERO;else if(0==buf[0])ret=BigInteger.fromBuffer(buf);else if(ret=BigInteger.fromBuffer(buf),128&buf[0]){var z=BigInteger.ONE.shiftLeft(ret.bitLength());ret=ret.subtract(z)}return ret},BigInteger.prototype.compute_twos_complement=function(){var l=this.add(BigInteger.ONE).bitLength(),bytes=Math.floor(l/8)+1,y=BigInteger.ONE.shiftLeft(8*bytes);return y.add(this)},BigInteger.prototype.toDERInteger=function(){var ret=null,s=this.signum();if(0==s)ret=new Buffer([0]);else if(0>s){var z=this.compute_twos_complement();ret=z.toBuffer()}else{var ret=this.toBuffer();this.bitLength()%8==0&&(pad=new Buffer([0]),ret=Buffer.concat([pad,ret]))}return buffer_to_array(ret)},BigInteger.prototype.divideAndRemainder=function(m){var q=new BigInteger(this._v.div(m._v)),r=new BigInteger(this._v.mod(m._v));return[q,r]},BigInteger.fromString=function(s,base){var bi;return bi=256===base?bigint.fromBuffer(s):bigint(s,base),new BigInteger(bi)},BigInteger.prototype.fromString=function(s,base){return BigInteger.fromString(s,base)},BigInteger.prototype.toByteArray=function(){for(var b=this.toBuffer(),l=b.length,ret=new Array(l),i=0;l>i;i++)ret[i]=b[i];return ret},BigInteger.prototype.toByteArrayUn
|
|||
|
var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=stackStartFunction.name,idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",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(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}},{"util/":77}],76:[function(require,module){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],77:[function(require,module,exports){(function(process,global){function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str){return str}function arrayToHash(array){var hash={};return array.forEach(function(val){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(0>recurseTimes)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ct
|
|||
|
if(!(offset>=len)){for(var i=0,j=Math.min(len-offset,4);j>i;i++)buf[offset+i]=value>>>8*(littleEndian?i:3-i)&255;return offset+4}}function writeInt16(buf,value,offset,littleEndian,noAssert){noAssert||(assert(void 0!==value&&null!==value,"missing value"),assert("boolean"==typeof littleEndian,"missing or invalid endian"),assert(void 0!==offset&&null!==offset,"missing offset"),assert(offset+1<buf.length,"Trying to write beyond buffer length"),verifsint(value,32767,-32768));var len=buf.length;if(!(offset>=len))return value>=0?writeUInt16(buf,value,offset,littleEndian,noAssert):writeUInt16(buf,65535+value+1,offset,littleEndian,noAssert),offset+2}function writeInt32(buf,value,offset,littleEndian,noAssert){noAssert||(assert(void 0!==value&&null!==value,"missing value"),assert("boolean"==typeof littleEndian,"missing or invalid endian"),assert(void 0!==offset&&null!==offset,"missing offset"),assert(offset+3<buf.length,"Trying to write beyond buffer length"),verifsint(value,2147483647,-2147483648));var len=buf.length;if(!(offset>=len))return value>=0?writeUInt32(buf,value,offset,littleEndian,noAssert):writeUInt32(buf,4294967295+value+1,offset,littleEndian,noAssert),offset+4}function writeFloat(buf,value,offset,littleEndian,noAssert){noAssert||(assert(void 0!==value&&null!==value,"missing value"),assert("boolean"==typeof littleEndian,"missing or invalid endian"),assert(void 0!==offset&&null!==offset,"missing offset"),assert(offset+3<buf.length,"Trying to write beyond buffer length"),verifIEEE754(value,3.4028234663852886e38,-3.4028234663852886e38));var len=buf.length;if(!(offset>=len))return ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){noAssert||(assert(void 0!==value&&null!==value,"missing value"),assert("boolean"==typeof littleEndian,"missing or invalid endian"),assert(void 0!==offset&&null!==offset,"missing offset"),assert(offset+7<buf.length,"Trying to write beyond buffer length"),verifIEEE754(value,1.7976931348623157e308,-1.7976931348623157e308));var len=buf.length;if(!(offset>=len))return ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){for(str=stringtrim(str).replace(INVALID_BASE64_RE,"");str.length%4!==0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function isArray(subject){return(Array.isArray||function(subject){return"[object Array]"===Object.prototype.toString.call(subject)})(subject)}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&"object"==typeof subject&&"number"==typeof subject.length}function toHex(n){return 16>n?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(str){for(var byteArray=[],i=0;i<str.length;i++){var b=str.charCodeAt(i);if(127>=b)byteArray.push(b);else{var start=i;b>=55296&&57343>=b&&i++;for(var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%"),j=0;j<h.length;j++)byteArray.push(parseInt(h[j],16))}}return byteArray}function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;i++)byteArray.push(255&str.charCodeAt(i));return byteArray}function utf16leToBytes(str){for(var c,hi,lo,byteArray=[],i=0;i<str.length;i++)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length){for(var i=0;length>i&&!(i+offset>=dst.length||i>=src.length);i++)dst[i+offset]=src[i];return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}function verifuint(value,max){assert("number"==typeof value,"cannot write a non-number as a number"),assert(value>=0,"specified a negative value for writing an unsigned value"),assert(max>=value,"value is larger than maximum value for type"),assert(Math.floor(value)===value,"value has a fractional component")}function verifsint(value,max,min){assert("number"==typeof value,"cannot write a non-number as a number"),assert(max>=value,"value larger than maximum allowed value"),assert(
|
|||
|
},Sha1.prototype._hash=function(){POOL.length<100&&POOL.push(this);var H=new Buffer(20);return H.writeInt32BE(0|this._a,A),H.writeInt32BE(0|this._b,B),H.writeInt32BE(0|this._c,C),H.writeInt32BE(0|this._d,D),H.writeInt32BE(0|this._e,E),H},Sha1}},{util:114}],92:[function(require,module){{var inherits=require("util").inherits;require("./util")}module.exports=function(Buffer,Hash){function Sha256(){POOL.length,this.init(),this._w=W,Hash.call(this,64,56)}function S(X,n){return X>>>n|X<<32-n}function R(X,n){return X>>>n}function Ch(x,y,z){return x&y^~x&z}function Maj(x,y,z){return x&y^x&z^y&z}function Sigma0256(x){return S(x,2)^S(x,13)^S(x,22)}function Sigma1256(x){return S(x,6)^S(x,11)^S(x,25)}function Gamma0256(x){return S(x,7)^S(x,18)^R(x,3)}function Gamma1256(x){return S(x,17)^S(x,19)^R(x,10)}var 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];inherits(Sha256,Hash);var W=new Array(64),POOL=[];Sha256.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._len=this._s=0,this};return Sha256.prototype._update=function(){var a,b,c,d,e,f,g,h,T1,T2,M=this._block,W=this._w;a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,f=0|this._f,g=0|this._g,h=0|this._h;for(var j=0;64>j;j++){var w=W[j]=16>j?M.readInt32BE(4*j):Gamma1256(W[j-2])+W[j-7]+Gamma0256(W[j-15])+W[j-16];T1=h+Sigma1256(e)+Ch(e,f,g)+K[j]+w,T2=Sigma0256(a)+Maj(a,b,c),h=g,g=f,f=e,e=d+T1,d=c,c=b,b=a,a=T1+T2}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0,this._f=f+this._f|0,this._g=g+this._g|0,this._h=h+this._h|0},Sha256.prototype._hash=function(){POOL.length<10&&POOL.push(this);var H=new Buffer(32);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H.writeInt32BE(this._h,28),H},Sha256}},{"./util":93,util:114}],93:[function(require,module,exports){function write(buffer,string,enc,start,from,to){var l=to-from;if("ascii"===enc||"binary"===enc)for(var i=0;l>i;i++)buffer[start+i]=string.charCodeAt(i+from);else if(null==enc)for(var i=0;l>i;i++)buffer[start+i]=string[i+from];else{if("hex"!==enc)throw new Error("base64"===enc?"base64 encoding not yet supported":enc+" encoding not yet supported");for(var i=0;l>i;i++){var j=from+i;buffer[start+i]=parseInt(string[2*j]+string[2*j+1],16)}}}function zeroFill(buf,from){for(var i=from;i<buf.length;i++)buf[i]=0}exports.write=write,exports.zeroFill=zeroFill,exports.toString=toString},{}],94:[function(require,module){(function(Buffer){var blocksize=64,zeroBuffer=new Buffer(blocksize);zeroBuffer.fill(0),module.exports=function(createHmac,exports){return exports=exports||{},exports.pbkdf2=function(password,salt,iterations,keylen,cb){if("function"!=typeof cb)throw new Error("No callback provided to pbkdf2");setTimeout(function(){cb(null,exports.pbkdf2Sync(password,salt,iterations,keylen))})},exports.pbkdf2Sync=function(key,salt,iterations,keylen){if("number"!=typeof iterations)throw new TypeError("Iterations not a number");if(0>iterations)throw new TypeError("Bad iterations");if("number"!=typeof keylen)throw new TypeError("Key length not a number");if(0>keylen)throw new TypeError("Bad key length");var key=Buffer.isBuffer(key)?key:new Buffer(key);key.length>blocksize?key=createHa
|
|||
|
}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||"undefined"==typeof arg}function isBuffer(arg){return Buffer.isBuffer(arg)}function objectToString(o){return Object.prototype.toString.call(o)}exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=isBuffer}).call(this,require("buffer").Buffer)},{buffer:80}],107:[function(require,module,exports){function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding))throw new Error("Unknown encoding: "+encoding)}function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){var incomplete=this.charReceived=buffer.length%2;return this.charLength=incomplete?2:0,incomplete}function base64DetectIncompleteChar(buffer){var incomplete=this.charReceived=buffer.length%3;return this.charLength=incomplete?3:0,incomplete}var Buffer=require("buffer").Buffer,isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},StringDecoder=exports.StringDecoder=function(encoding){switch(this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(encoding),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(buffer){for(var charStr="",offset=0;this.charLength;){var i=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;if(buffer.copy(this.charBuffer,this.charReceived,offset,i),this.charReceived+=i-offset,offset=i,this.charReceived<this.charLength)return"";charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(!(charCode>=55296&&56319>=charCode)){if(this.charReceived=this.charLength=0,i==buffer.length)return charStr;buffer=buffer.slice(i,buffer.length);break}this.charLength+=this.surrogateSize,charStr=""}var lenIncomplete=this.detectIncompleteChar(buffer),end=buffer.length;this.charLength&&(buffer.copy(this.charBuffer,0,buffer.length-lenIncomplete,end),this.charReceived=lenIncomplete,end-=lenIncomplete),charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1,charCode=charStr.charCodeAt(end);if(charCode>=55296&&56319>=charCode){var size=this.surrogateSize;return this.charLength+=size,this.charReceived+=size,this.charBuffer.copy(this.charBuffer,size,0,size),this.charBuffer.write(charStr.charAt(charStr.length-1),this.encoding),charStr.substring(0,end)}return charStr},StringDecoder.prototype.detectIncompleteChar=function(buffer){for(var
|
|||
|
fast&&(model=new DefSumModel(encoder,alphabetSize+1));var runLength=0,emitLastRun=function(){for(;0!==runLength;)1&runLength?(model.encode(0),runLength-=1):(model.encode(1),runLength-=2),runLength>>>=1};for(i=0;length>i;i++)c=U[i],0===c?runLength++:(emitLastRun(),model.encode(c+1),runLength=0);emitLastRun()}while(length===block.length);encoder.encodeFreq(1,2,3),encoder.encodeFinish()},!0),BWTC.decompressFile=Util.decompressFileHelper(BWTC.MAGIC,function(input,output){var decoder=new RangeCoder(input);decoder.decodeStart(!0);var blockSize=decoder.decodeByte();console.assert(blockSize>=1&&9>=blockSize);var fast=5>=blockSize;blockSize*=1e5;for(var b,length,i,j,c,block=Util.makeU8Buffer(blockSize),U=Util.makeU8Buffer(blockSize),A=Util.makeS32Buffer(blockSize),M=Util.makeU8Buffer(256),bitModelFactory=NoModel.factory(decoder),lenModel=new LogDistanceModel(blockSize,0,bitModelFactory,bitModelFactory);;){var blockIndicator=decoder.decodeCulFreq(3);if(decoder.decodeUpdate(1,blockIndicator,3),0===blockIndicator)length=blockSize,b=block;else if(1===blockIndicator)length=lenModel.decode(),b=block.subarray(0,length);else if(2===blockIndicator)break;var pidx=lenModel.decode(),useTree=Util.makeU16Buffer(512);for(useTree[0]=1,i=1;512>i;i++){var parent=i>>>1,full=1<<9-Util.fls(i);if(0===useTree[parent]||useTree[parent]===2*full)useTree[i]=useTree[parent]>>>1;else if(i>=256)useTree[i]=decoder.decodeBit();else{var v=decoder.decodeCulFreq(3);decoder.decodeUpdate(1,v,3),useTree[i]=2===v?full:v}}var alphabetSize=0;for(i=0;256>i;i++)useTree[256+i]&&(M[alphabetSize++]=i);useTree=null;var model=new FenwickModel(decoder,alphabetSize+1,F_PROB_MAX,F_PROB_INCR);fast&&(model=new DefSumModel(decoder,alphabetSize+1,!0));var val=1;for(i=0;length>i;)if(c=model.decode(),0===c){for(j=0;val>j;j++)b[i++]=0;val*=2}else if(1===c){for(j=0;val>j;j++)b[i++]=0,b[i++]=0;val*=2}else val=1,b[i++]=c-1;for(i=0;length>i;i++){for(j=b[i],b[i]=c=M[j];j>0;j--)M[j]=M[j-1];M[0]=c}BWT.unbwtransform(block,U,A,length,pidx),output.write(U,0,length)}decoder.decodeFinish()}),BWTC};module.exports=body_fn.apply(null,libs)},{"./BWT":121,"./DefSumModel":127,"./FenwickModel":131,"./LogDistanceModel":134,"./NoModel":139,"./RangeCoder":141,"./Stream":143,"./Util":144,"./freeze":145}],123:[function(require,module){var libs=[require("./Stream")],body_fn=function(Stream){var BitStream=function(stream){(function(){var bufferByte=256;this.readBit=function(){if(0===(255&bufferByte)){var ch=stream.readByte();if(ch===Stream.EOF)return this._eof=!0,ch;bufferByte=ch<<1|1}var bit=256&bufferByte?1:0;return bufferByte<<=1,bit},this.seekBit=function(pos){var n_byte=pos>>>3,n_bit=pos-8*n_byte;this.seek(n_byte),this._eof=!1,this.readBits(n_bit)},this.tellBit=function(){for(var pos=8*stream.tell(),b=bufferByte;0!==(255&b);)pos--,b<<=1;return pos},this.readByte=function(){return 0===(255&bufferByte)?stream.readByte():this.readBits(8)},this.seek=function(pos){stream.seek(pos),bufferByte=256}}).call(this),function(){var bufferByte=1;this.writeBit=function(b){bufferByte<<=1,b&&(bufferByte|=1),256&bufferByte&&(stream.writeByte(255&bufferByte),bufferByte=1)},this.writeByte=function(_byte){1===bufferByte?stream.writeByte(_byte):stream.writeBits(8,_byte)},this.flush=function(){for(;1!==bufferByte;)this.writeBit(0);stream.flush&&stream.flush()}}.call(this)};return BitStream.EOF=Stream.EOF,BitStream.prototype=Object.create(Stream.prototype),BitStream.prototype.readBits=function(n){var i,r=0;if(n>31)return r=65536*this.readBits(n-16),r+this.readBits(16);for(i=0;n>i;i++)r<<=1,this.readBit()>0&&r++;return r},BitStream.prototype.writeBits=function(n,value){if(n>32){var low=65535&value,high=(value-low)/65536;return this.writeBits(n-16,high),void this.writeBits(16,low)}var i;for(i=n-1;i>=0;i--)this.writeBit(value>>>i&1)},BitStream};module.exports=body_fn.apply(null,libs)},{"./Stream":143}],124:[function(require,module){var libs=[require("./freeze"),require("./BitStream"),require("./BWT"),require("./CRC32"),require("./HuffmanAllocator"),require("./Stream"),require("./Util")],body_fn=function(freeze,BitStream,BWT,CRC32,Hu
|
|||
|
},Dummy.prototype._read16=function(){var hi=this.stream.readByte(),lo=this.stream.readByte();return hi<<8|lo},Dummy.prototype.encodeStart=function(c){this.stream.writeByte(c)},Dummy.prototype.encodeFreq=function(sy_f,lt_f,tot_f){console.assert(sy_f>0),console.assert(tot_f>0),console.assert(1<<23>=tot_f),sy_f+lt_f>tot_f&&console.error("dummy coder: lt_f + sy_f > tot_f",sy_f,lt_f,tot_f),Util.writeUnsignedNumber(this.stream,sy_f),Util.writeUnsignedNumber(this.stream,lt_f),Util.writeUnsignedNumber(this.stream,tot_f)},Dummy.prototype.encodeShift=function(sy_f,lt_f,shift){this.encodeFreq(sy_f,lt_f,1<<shift)},Dummy.prototype.encodeFinish=function(){return 0},Dummy.prototype.decodeStart=function(skipInitialRead){return skipInitialRead?0:this.stream.readByte()},Dummy.prototype.decodeCulFreq=function(tot_f){return console.assert(tot_f>0),this.sy_f=Util.readUnsignedNumber(this.stream),this.lt_f=Util.readUnsignedNumber(this.stream),this.tot_f=Util.readUnsignedNumber(this.stream),tot_f!==this.tot_f&&console.error("decodeCul* wrong total: got",tot_f,"expected",this.tot_f),(this.sy_f>>>1)+this.lt_f},Dummy.prototype.decodeCulShift=function(shift){return this.decodeCulFreq(1<<shift)},Dummy.prototype.decodeUpdate=function(sy_f,lt_f,tot_f){console.assert(sy_f>0),console.assert(tot_f>0),(sy_f!==this.sy_f||lt_f!==this.lt_f||tot_f!==this.tot_f)&&console.error("decodeUpdate wrong parameters; got",sy_f,lt_f,tot_f,"expected",this.sy_f,this.lt_f,this.tot_f)},Dummy.prototype.decodeFinish=function(){},Dummy};module.exports=body_fn.apply(null,libs)},{"./RangeCoder":141,"./Util":144}],131:[function(require,module){var libs=[require("./RangeCoder"),require("./Stream"),require("./Util")],body_fn=function(RangeCoder,Stream,Util){var DEFAULT_MAX_PROB=65280,DEFAULT_INCREMENT=256,ESC_MASK=65535,ESC_SHIFT=0,SYM_MASK=4294901760,SYM_SHIFT=16,SCALE_MASK=4294901758,FenwickModel=function(coder,size,max_prob,increment){this.coder=coder,this.numSyms=size+1,this.tree=Util.makeU32Buffer(2*this.numSyms),this.increment=+increment||DEFAULT_INCREMENT,this.max_prob=+max_prob||DEFAULT_MAX_PROB,console.assert(this.max_prob+(this.increment-1)<=65535),console.assert(65535>=size);var i;for(i=0;size>i;i++)this.tree[this.numSyms+i]=1<<ESC_SHIFT|0<<SYM_SHIFT;this.tree[this.numSyms+i]=0<<ESC_SHIFT|this.increment<<SYM_SHIFT,this._sumTree()};return FenwickModel.factory=function(coder,max_prob,increment){return function(size){return new FenwickModel(coder,size,max_prob,increment)}},FenwickModel.prototype.clone=function(){var i,newModel=new FenwickModel(this.coder,this.size,this.max_prob,this.increment);for(i=1;i<this.tree.length;i++)newModel.tree[i]=this.tree[i];return newModel},FenwickModel.prototype.encode=function(symbol){var i=this.numSyms+symbol,sy_f=this.tree[i],mask=SYM_MASK,shift=SYM_SHIFT,update=this.increment<<SYM_SHIFT;0===(sy_f&SYM_MASK)?(this.encode(this.numSyms-1),mask=ESC_MASK,update-=1<<ESC_SHIFT,shift=ESC_SHIFT):symbol===this.numSyms-1&&(this.tree[1]&ESC_MASK)>>>ESC_SHIFT===1&&(update=-this.tree[i]);for(var lt_f=0;i>1;){var isRight=1&i,parent=i>>>1;isRight&&(lt_f+=this.tree[2*parent]),this.tree[i]+=update,i=parent}var tot_f=this.tree[1];this.tree[1]+=update,sy_f=(sy_f&mask)>>>shift,lt_f=(lt_f&mask)>>>shift,tot_f=(tot_f&mask)>>>shift,this.coder.encodeFreq(sy_f,lt_f,tot_f),(this.tree[1]&SYM_MASK)>>>SYM_SHIFT>=this.max_prob&&this._rescale()},FenwickModel.prototype._decode=function(isEscape){var mask=SYM_MASK,shift=SYM_SHIFT,update=this.increment<<SYM_SHIFT;isEscape&&(mask=ESC_MASK,update-=1<<ESC_SHIFT,shift=ESC_SHIFT);for(var tot_f=(this.tree[1]&mask)>>>shift,prob=this.coder.decodeCulFreq(tot_f),i=1,lt_f=0;i<this.numSyms;){this.tree[i]+=update;var leftProb=(this.tree[2*i]&mask)>>>shift;i*=2,prob-lt_f>=leftProb&&(lt_f+=leftProb,i++)}var symbol=i-this.numSyms,sy_f=(this.tree[i]&mask)>>>shift;if(this.tree[i]+=update,this.coder.decodeUpdate(sy_f,lt_f,tot_f),symbol===this.numSyms-1&&(this.tree[1]&ESC_MASK)>>>ESC_SHIFT===1)for(update=-this.tree[i];i>=1;)this.tree[i]+=update,i>>>=1;return(this.tree[1]&SYM_MASK)>>>SYM_SHIFT>=this.max_prob&&this._rescale(),symbol},FenwickModel
|
|||
|
range.decodeStart(!0);var model=new MTFModel(range,0>fileSize?257:256);Util.decompressWithModel(outStream,fileSize,model),range.decodeFinish()}),MTFModel};module.exports=body_fn.apply(null,libs)},{"./RangeCoder":141,"./Stream":143,"./Util":144}],139:[function(require,module){var libs=[require("./BitStream"),require("./Util")],body_fn=function(BitStream,Util){var NoModel=function(bitstream,size){this.bitstream=bitstream,this.bits=Util.fls(size-1)};return NoModel.factory=function(bitstream){return function(size){return new NoModel(bitstream,size)}},NoModel.prototype.encode=function(symbol){var i;for(i=this.bits-1;i>=0;i--){var b=symbol>>>i&1;this.bitstream.writeBit(b)}},NoModel.prototype.decode=function(){var i,r=0;for(i=this.bits-1;i>=0;i--)r<<=1,this.bitstream.readBit()&&r++;return r},NoModel.MAGIC="nomo",NoModel.compressFile=Util.compressFileHelper(NoModel.MAGIC,function(inStream,outStream,fileSize){var bitstream=new BitStream(outStream),model=new NoModel(bitstream,0>fileSize?257:256);Util.compressWithModel(inStream,fileSize,model),bitstream.flush()}),NoModel.decompressFile=Util.decompressFileHelper(NoModel.MAGIC,function(inStream,outStream,fileSize){var bitstream=new BitStream(inStream),model=new NoModel(bitstream,0>fileSize?257:256);Util.decompressWithModel(outStream,fileSize,model)}),NoModel};module.exports=body_fn.apply(null,libs)},{"./BitStream":123,"./Util":144}],140:[function(require,module){var libs=[require("./RangeCoder"),require("./Util")],body_fn=function(RangeCoder,Util){var MAX_CONTEXT=5,LOG_WINDOW_SIZE=18,WINDOW_SIZE=1<<LOG_WINDOW_SIZE,Window=function(){this.buffer=Util.makeU8Buffer(WINDOW_SIZE),this.pos=0,this.firstPass=!0;for(var i=0;MAX_CONTEXT>i;i++)this.put("cSaCsA".charCodeAt(i%6))};Window.prototype.put=function(_byte){return this.buffer[this.pos++]=_byte,this.pos>=WINDOW_SIZE&&(this.pos=0,this.firstPass=!1),_byte},Window.prototype.get=function(pos){return this.buffer[pos&WINDOW_SIZE-1]},Window.prototype.context=function(pos,n){var i,c=[];for(pos=pos-n&WINDOW_SIZE-1,i=0;n>i;i++)c.push(this.buffer[pos++]),pos>=WINDOW_SIZE&&(pos=0);return String.fromCharCode.apply(String,c)};var DMM_INCREMENT=256,DMM_MAX_PROB=65280,PPM=function(coder,size){this.window=new Window,this.contexts=Object.create(null);var Cm1Context=function(){};Cm1Context.prototype.encode=function(symbol,exclude){var i,lt_f=0;for(i=0;symbol>i;i++)exclude[i]||lt_f++;var tot_f=size-exclude.total;coder.encodeFreq(1,lt_f,tot_f)},Cm1Context.prototype.decode=function(exclude){var i,symbol,lt_f,tot_f=size-exclude.total;for(symbol=lt_f=coder.decodeCulFreq(tot_f),i=0;symbol>=i;i++)exclude[i]&&symbol++;return coder.decodeUpdate(1,lt_f,tot_f),symbol},this.cm1coder=new Cm1Context;var DenseMTFModel=function(){this.sym=[size],this.prob=[0,DMM_INCREMENT],this.refcount=0};DenseMTFModel.prototype._rescale=function(){var i,j,seenSyms=this.sym.length,total=0,noEscape=!0;for(i=0,j=0;seenSyms>i;i++){var sym=this.sym[i],sy_f=this.prob[i+1]-this.prob[i];sy_f>>>=1,sy_f>0&&(sym===size&&(noEscape=!1),this.sym[j]=sym,this.prob[j++]=total,total+=sy_f)}return this.prob[j]=total,seenSyms=this.sym.length=j,this.prob.length=seenSyms+1,noEscape&&size>seenSyms&&(total=this._update(size,seenSyms,0,1)),total},DenseMTFModel.prototype.update=function(symbol,incr){var i=0;for(i=0;i<this.sym.length;i++)if(this.sym[i]===symbol)return this._update(symbol,i,this.prob[i+1]-this.prob[i],incr);return this._update(symbol,i,0,incr)},DenseMTFModel.prototype._update=function(symbol,index,sy_f,incr){var i,j,tot_f,seenSyms=this.sym.length;for(j=index;seenSyms-1>j;j++)this.sym[j]=this.sym[j+1],this.prob[j]=this.prob[j+1]-sy_f;if(seenSyms>index)this.sym[j]=symbol,this.prob[j]=this.prob[j+1]-sy_f,this.prob[seenSyms]=tot_f=this.prob[seenSyms]+incr;else if(tot_f=this.prob[seenSyms],this.sym[index]=symbol,this.prob[index]=tot_f,tot_f+=incr,this.prob[++seenSyms]=tot_f,this.sym.length>size)for(i=0;seenSyms>i;i++)size===this.sym[i]&&(this._update(size,i,this.prob[i+1]-this.prob[i],-1),this.sym.length--,this.prob.length--,tot_f=this.prob[this.prob.length-1]);return tot_f>=DMM_MAX_PROB&&(tot_f=this._
|
|||
|
},{}],154:[function(require,module){"use strict";function makeTable(){for(var c,table=[],n=0;256>n;n++){c=n;for(var k=0;8>k;k++)c=1&c?3988292384^c>>>1:c>>>1;table[n]=c}return table}function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc=-1^crc;for(var i=pos;end>i;i++)crc=crc>>>8^t[255&(crc^buf[i])];return-1^crc}var crcTable=makeTable();module.exports=crc32},{}],155:[function(require,module,exports){"use strict";function err(strm,errorCode){return strm.msg=msg[errorCode],errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function flush_pending(strm){var s=strm.state,len=s.pending;len>strm.avail_out&&(len=strm.avail_out),0!==len&&(utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out),strm.next_out+=len,s.pending_out+=len,strm.total_out+=len,strm.avail_out-=len,s.pending-=len,0===s.pending&&(s.pending_out=0))}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last),s.block_start=s.strstart,flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255,s.pending_buf[s.pending++]=255&b}function read_buf(strm,buf,start,size){var len=strm.avail_in;return len>size&&(len=size),0===len?0:(strm.avail_in-=len,utils.arraySet(buf,strm.input,strm.next_in,len,start),1===strm.state.wrap?strm.adler=adler32(strm.adler,buf,len,start):2===strm.state.wrap&&(strm.adler=crc32(strm.adler,buf,len,start)),strm.next_in+=len,strm.total_in+=len,len)}function longest_match(s,cur_match){var match,len,chain_length=s.max_chain_length,scan=s.strstart,best_len=s.prev_length,nice_match=s.nice_match,limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0,_win=s.window,wmask=s.w_mask,prev=s.prev,strend=s.strstart+MAX_MATCH,scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len];s.prev_length>=s.good_match&&(chain_length>>=2),nice_match>s.lookahead&&(nice_match=s.lookahead);do if(match=cur_match,_win[match+best_len]===scan_end&&_win[match+best_len-1]===scan_end1&&_win[match]===_win[scan]&&_win[++match]===_win[scan+1]){scan+=2,match++;do;while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&strend>scan);if(len=MAX_MATCH-(strend-scan),scan=strend-MAX_MATCH,len>best_len){if(s.match_start=cur_match,best_len=len,len>=nice_match)break;scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len]}}while((cur_match=prev[cur_match&wmask])>limit&&0!==--chain_length);return best_len<=s.lookahead?best_len:s.lookahead}function fill_window(s){var p,n,m,more,str,_w_size=s.w_size;do{if(more=s.window_size-s.lookahead-s.strstart,s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0),s.match_start-=_w_size,s.strstart-=_w_size,s.block_start-=_w_size,n=s.hash_size,p=n;do m=s.head[--p],s.head[p]=m>=_w_size?m-_w_size:0;while(--n);n=_w_size,p=n;do m=s.prev[--p],s.prev[p]=m>=_w_size?m-_w_size:0;while(--n);more+=_w_size}if(0===s.strm.avail_in)break;if(n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more),s.lookahead+=n,s.lookahead+s.insert>=MIN_MATCH)for(str=s.strstart-s.insert,s.ins_h=s.window[str],s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+1])&s.hash_mask;s.insert&&(s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask,s.prev[str&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=str,str++,s.insert--,!(s.lookahead+s.insert<MIN_MATCH)););}while(s.lookahead<MIN_LOOKAHEAD&&0!==s.strm.avail_in)}function deflate_stored(s,flush){var max_block_size=65535;for(max_block_size>s.pending_buf_size-5&&(max_block_size=s.pending_buf_size-5);;){if(s.lookahead<=1){if(fill_window(s),0===s.lookahead&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}s.strstart+=s.lookahead,s.lookahead=0;var max_start=s.block_start+max_block_size;if((0===s.strstart||s.strstart>=max_start)&&(s.lookahead=s.strstart-max
|
|||
|
break}state.have=0,state.mode=LENLENS;case LENLENS:for(;state.have<state.ncode;){for(;3>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.lens[order[state.have++]]=7&hold,hold>>>=3,bits-=3}for(;state.have<19;)state.lens[order[state.have++]]=0;if(state.lencode=state.lendyn,state.lenbits=7,opts={bits:state.lenbits},ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid code lengths set",state.mode=BAD;break}state.have=0,state.mode=CODELENS;case CODELENS:for(;state.have<state.nlen+state.ndist;){for(;here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(16>here_val)hold>>>=here_bits,bits-=here_bits,state.lens[state.have++]=here_val;else{if(16===here_val){for(n=here_bits+2;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold>>>=here_bits,bits-=here_bits,0===state.have){strm.msg="invalid bit length repeat",state.mode=BAD;break}len=state.lens[state.have-1],copy=3+(3&hold),hold>>>=2,bits-=2}else if(17===here_val){for(n=here_bits+3;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len=0,copy=3+(7&hold),hold>>>=3,bits-=3}else{for(n=here_bits+7;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len=0,copy=11+(127&hold),hold>>>=7,bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat",state.mode=BAD;break}for(;copy--;)state.lens[state.have++]=len}}if(state.mode===BAD)break;if(0===state.lens[256]){strm.msg="invalid code -- missing end-of-block",state.mode=BAD;break}if(state.lenbits=9,opts={bits:state.lenbits},ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid literal/lengths set",state.mode=BAD;break}if(state.distbits=6,state.distcode=state.distdyn,opts={bits:state.distbits},ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts),state.distbits=opts.bits,ret){strm.msg="invalid distances set",state.mode=BAD;break}if(state.mode=LEN_,flush===Z_TREES)break inf_leave;case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,inflate_fast(strm,_out),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,state.mode===TYPE&&(state.back=-1);break}for(state.back=0;here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(here_op&&0===(240&here_op)){for(last_bits=here_bits,last_op=here_op,last_val=here_val;here=state.lencode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=last_bits+here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,state.length=here_val,0===here_op){state.mode=LIT;break}if(32&here_op){state.back=-1,state.mode=TYPE;break}if(64&here_op){strm.msg="invalid literal/length code",state.mode=BAD;break}state.extra=15&here_op,state.mode=LENEXT;case LENEXT:if(state.extra){for(n=state.extra;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.length+=hold&(1<<state.extra)-1,hold>>>=state.extra,bits-=state.extra,state.back+=state.extra}state.was=state.length,state.mode=DIST;case DIST:for(;here=state.distcode[hold&(1<<state.distbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(0===(240&here_op)){for(last_bits=here_bi
|
|||
|
},Parser.prototype.v_unframe=function(){return!0},Parser.prototype.unframe=function(){var found_pre,found_pre_clearsign,found_pre_std,go,line,m,payload,post,pre,ret,rxx,rxx_b,rxx_e,stage,type;for(rxx_b=/^(-{5}BEGIN PGP (.*?)-{5}.*$)/,rxx_e=/^(-{5}END PGP (.*?)-{5})(.*)$/m,rxx=rxx_b,payload=[],stage=0,type=null,ret=null,go=!0,pre=[],post=[],found_pre_std=function(l){return pre.push(l)},found_pre_clearsign=function(_this){return function(l){return _this.ret.clearsign.lines.push(l)}}(this),found_pre=found_pre_std;this.lines.length&&go;)switch(line=this.lines.shift(),stage){case-1:if(m=line.match(/^([^:]+): (.*)$/))this.ret.clearsign.headers[m[1].toLowerCase()]=m[2];else{if(!line.match(/^\s*$/))throw new Error("Bad line in clearsign header");stage++,found_pre=found_pre_clearsign}this.ret.lines.push(line);break;case 0:null!=(m=line.match(rxx_b))?(found_pre("",!0),this.ret.lines.push(this.ret.clearsign?line:m[1]),null==this.type&&(this.type=m[2]),this.last_type=m[2],"SIGNED MESSAGE"===m[2]?(stage--,this.ret.make_clearsign()):stage++):(this.ret.clearsign&&this.ret.lines.push(line),found_pre(line,!1));break;case 1:if(m=line.match(rxx_e)){if(this.ret.lines.push(m[1]),m[2]!==this.last_type)throw new Error("type mismatch -- begin "+this.last_type+" w/ end "+m[1]);stage++,post=[m[3]].concat(this.lines),this.lines=[],go=!1}else this.ret.lines.push(line),payload.push(line)}if(0===stage)throw new Error("no header found");if(1===stage)throw new Error("no tailer found");return this.payload=payload,this.ret.finish_unframe({pre:pre,post:post})},Parser}(),exports.decode=decode=function(data){return katch(function(){return new Parser(data).parse()})},exports.mdecode=decode=function(data){return katch(function(){return new Parser(data).mparse()})},exports.compute_crc24=compute_crc24}).call(this)}).call(this,require("buffer").Buffer)},{"./util":165,buffer:80}],163:[function(require,module,exports){(function(){exports.armor=require("./armor"),exports.util=require("./util"),exports.userid=require("./userid")}).call(this)},{"./armor":162,"./userid":164,"./util":165}],164:[function(require,module,exports){(function(){exports.parse=function(input){var components,m,x;return components=null,x=/^([^(<]*?)(?:\s*\((.*?)\))?(?:\s*<(.*?)>)?$/,null!=(m=input.match(x))&&(components={username:m[1],comment:m[2],email:m[3]}),components},exports.format=function(d){var parts,_ref,_ref1,_ref2;return parts=[],(null!=(_ref=d.username)?_ref.length:void 0)&&parts.push(d.username),(null!=(_ref1=d.comment)?_ref1.length:void 0)&&parts.push("("+d.comment+")"),(null!=(_ref2=d.email)?_ref2.length:void 0)&&parts.push("<"+d.email+">"),parts.join(" ")}}).call(this)},{}],165:[function(require,module,exports){(function(Buffer){(function(){var ASP,Canceler,Warnings,assert,assert_no_nulls,asyncify,bufeq_secure,buffer_to_ui8a,bufferify,iced,katch,obj_extract,strip,trim,ui32a_to_ui8a,ui8Ga_to_ui32a,xxd,__iced_k,__iced_k_noop,__slice=[].slice;iced=require("iced-runtime"),__iced_k=__iced_k_noop=function(){},Canceler=require("iced-error").Canceler,assert=require("assert"),exports.uint_to_buffer=function(nbits,i){var ret;switch(ret=null,nbits){case 16:ret=new Buffer(2),ret.writeUInt16BE(i,0);break;case 32:ret=new Buffer(4),ret.writeUInt32BE(i,0);break;case 8:ret=new Buffer(1),ret.writeUInt8(i,0);break;default:throw new Error("Bit types not found: "+nbit)}return ret},exports.ASP=ASP=function(){function ASP(_arg){var canceler,delay,progress_hook;progress_hook=_arg.progress_hook,delay=_arg.delay,canceler=_arg.canceler,this._delay=null!=delay?delay:2,this._canceler=canceler||new Canceler,this._progress_hook=progress_hook||function(){},this._section=null}return ASP.prototype.section=function(s){return this._section=s,this},ASP.prototype.progress=function(o,cb){var err,___iced_passed_deferral,__iced_deferrals,__iced_k;return __iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),this._section&&(o.section=this._section),this._progress_hook(o),null==cb?__iced_k():void!function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_pa
|
|||
|
},AES}(BlockCipher),exports.AES=AES}).call(this)},{"./algbase":174,"./util":195}],174:[function(require,module,exports){(function(){var BlockCipher,BufferedBlockAlgorithm,Hasher,StreamCipher,WordArray,util,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};WordArray=require("./wordarray").WordArray,util=require("./util"),BufferedBlockAlgorithm=function(){function BufferedBlockAlgorithm(){this.reset()}return BufferedBlockAlgorithm.prototype._minBufferSize=0,BufferedBlockAlgorithm.prototype.reset=function(){return this._data=new WordArray,this._nDataBytes=0},BufferedBlockAlgorithm.prototype._append=function(data){return this._data.concat(data),this._nDataBytes+=data.sigBytes},BufferedBlockAlgorithm.prototype._process=function(doFlush){var blockSizeBytes,data,dataSigBytes,dataWords,nBlocksReady,nBytesReady,nWordsReady,offset,processedWords,_i,_ref;if(data=this._data,dataWords=data.words,dataSigBytes=data.sigBytes,blockSizeBytes=4*this.blockSize,nBlocksReady=dataSigBytes/blockSizeBytes,nBlocksReady=doFlush?Math.ceil(nBlocksReady):Math.max((0|nBlocksReady)-this._minBufferSize,0),nWordsReady=nBlocksReady*this.blockSize,nBytesReady=Math.min(4*nWordsReady,dataSigBytes),nWordsReady){for(offset=_i=0,_ref=this.blockSize;_ref>0?nWordsReady>_i:_i>nWordsReady;offset=_i+=_ref)this._doProcessBlock(dataWords,offset);processedWords=dataWords.splice(0,nWordsReady),data.sigBytes-=nBytesReady}return new WordArray(processedWords,nBytesReady)},BufferedBlockAlgorithm.prototype.copy_to=function(out){return out._data=this._data.clone(),out._nDataBytes=this._nDataBytes},BufferedBlockAlgorithm.prototype.clone=function(){var obj;return obj=new BufferedBlockAlgorithm,this.copy_to(obj),obj},BufferedBlockAlgorithm}(),Hasher=function(_super){function Hasher(){Hasher.__super__.constructor.call(this)}return __extends(Hasher,_super),Hasher.prototype.reset=function(){return Hasher.__super__.reset.call(this),this._doReset(),this},Hasher.prototype.update=function(messageUpdate){return this._append(messageUpdate),this._process(),this},Hasher.prototype.finalize=function(messageUpdate){return messageUpdate&&this._append(messageUpdate),this._doFinalize()},Hasher.prototype.bufhash=function(input){var out,wa_in,wa_out;return wa_in=WordArray.from_buffer(input),wa_out=this.finalize(wa_in),out=wa_out.to_buffer(),wa_in.scrub(),wa_out.scrub(),out},Hasher}(BufferedBlockAlgorithm),exports.BlockCipher=BlockCipher=function(){function BlockCipher(){}return BlockCipher.prototype.encryptBlock=function(){},BlockCipher}(),StreamCipher=function(){function StreamCipher(){}return StreamCipher.prototype.encryptBlock=function(word_array,dst_offset){var n_words,pad;return null==dst_offset&&(dst_offset=0),pad=this.get_pad(),n_words=Math.min(word_array.words.length-dst_offset,this.bsiw),word_array.xor(pad,{dst_offset:dst_offset,n_words:n_words}),pad.scrub(),this.bsiw},StreamCipher.prototype.encrypt=function(word_array){var i,_i,_ref,_ref1;for(i=_i=0,_ref=word_array.words.length,_ref1=this.bsiw;_ref1>0?_ref>_i:_i>_ref;i=_i+=_ref1)this.encryptBlock(word_array,i);return word_array},StreamCipher.prototype.bulk_encrypt=function(_arg,cb){var async_args,input,progress_hook,slice_args,what;return input=_arg.input,progress_hook=_arg.progress_hook,what=_arg.what,slice_args={update:function(_this){return function(lo,hi){var i,_i,_ref,_results;for(_results=[],i=_i=lo,_ref=_this.bsiw;_ref>0?hi>_i:_i>hi;i=_i+=_ref)_results.push(_this.encryptBlock(input,i));return _results}}(this),finalize:function(){return input},default_n:1024*this.bsiw},async_args={progress_hook:progress_hook,cb:cb,what:what},util.bulk(input.sigBytes,slice_args,async_args)},StreamCipher}(),exports.BlockCipher=BlockCipher,exports.Hasher=Hasher,exports.BufferedBlockAlgorithm=BufferedBlockAlgorithm,exports.StreamCipher=StreamCipher}).call(this)},{"./util":195,"./wordarray":196}],175:[function(require,module,ex
|
|||
|
__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),input=_arg.input,key=_arg.key,iv=_arg.iv,progress_hook=_arg.progress_hook,function(_this){return function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/triplesec/src/enc.iced",funcname:"Base.run_aes"}),_this._check_scrubbed(key,"AES",cb,__iced_deferrals.defer({lineno:249})),__iced_deferrals._fulfill()}}(this)(function(){return function(){block_cipher=new AES(key),function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/triplesec/src/enc.iced",funcname:"Base.run_aes"}),ctr.bulk_encrypt({block_cipher:block_cipher,iv:iv,input:input,progress_hook:progress_hook,what:"aes"},__iced_deferrals.defer({assign_fn:function(){return function(){return ct=arguments[0]}}(),lineno:251})),__iced_deferrals._fulfill()}(function(){return block_cipher.scrub(),cb(null,iv.clone().concat(ct))})}}(this))},Base.prototype.scrub=function(){var key,key_ring,salt,_i,_len,_ref1;if(null!=this.key&&this.key.scrub(),null!=this.derived_keys){_ref1=this.derived_keys;for(salt in _ref1)for(key_ring=_ref1[salt],_i=0,_len=key_ring.length;_len>_i;_i++)key=key_ring[_i],key.scrub()}return this.derived_keys={},null!=this.salt&&this.salt.scrub(),this.salt=null,this.key=null},Base}(),Encryptor=function(_super){function Encryptor(_arg){var key,rng,version;key=_arg.key,rng=_arg.rng,version=_arg.version,Encryptor.__super__.constructor.call(this,{key:key,version:version}),this.rng=rng||prng.generate}return __extends(Encryptor,_super),Encryptor.prototype.pick_random_ivs=function(_arg,cb){var iv_lens,ivs,k,progress_hook,v,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),progress_hook=_arg.progress_hook,iv_lens={aes:AES.ivSize,twofish:TwoFish.ivSize,salsa20:salsa20.Salsa20.ivSize},ivs={},function(_this){return function(__iced_k){var _i,_k,_keys,_ref1,_results,_while;_ref1=iv_lens,_keys=function(){var _results1;_results1=[];for(_k in _ref1)_results1.push(_k);return _results1}(),_i=0,_results=[],(_while=function(__iced_k){var _break,_continue,_next;return _break=function(){return __iced_k(_results)},_continue=function(){return iced.trampoline(function(){return++_i,_while(__iced_k)})},_next=function(__iced_next_arg){return _results.push(__iced_next_arg),_continue()},_i<_keys.length?(k=_keys[_i],v=_ref1[k],function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/triplesec/src/enc.iced",funcname:"Encryptor.pick_random_ivs"}),_this.rng(v,__iced_deferrals.defer({assign_fn:function(__slot_1,__slot_2){return function(){return __slot_1[__slot_2]=arguments[0]}}(ivs,k),lineno:353})),__iced_deferrals._fulfill()}(_next),void 0):_break()})(__iced_k)}}(this)(function(){return function(){return cb(ivs)}}(this))},Encryptor.prototype.resalt=function(_arg,cb){var err,extra_keymaterial,progress_hook,salt,___iced_passed_deferral,__iced_deferrals,__iced_k;__iced_k=__iced_k_noop,___iced_passed_deferral=iced.findDeferral(arguments),salt=_arg.salt,extra_keymaterial=_arg.extra_keymaterial,progress_hook=_arg.progress_hook,err=null,function(_this){return function(__iced_k){return null!=salt?__iced_k(salt.length!==_this.version.salt_size?err=new Error("Need a salt of exactly "+_this.version.salt_size+" bytes (got "+salt.length+")"):_this.salt=WordArray.alloc(salt)):void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:"/home/max/src/keybase/triplesec/src/enc.iced",funcname:"Encryptor.resalt"}),_this.rng(_this.version.salt_size,__iced_deferrals.defer({assign_fn:function(__slot_1){return function(){return __slot_1.salt=arguments[0]}}(_this),lineno:369})),__iced_deferrals._fulfill()}(__iced_k)}}(this)(function(_this){return function(){!function(__iced_k){return null!=err?__iced_k():void!function(__iced_k){__iced_deferrals=new iced.Deferrals(__iced_k,{parent:___iced_passed_deferral,filename:
|
|||
|
for(x0=v[0],x1=v[1],x2=v[2],x3=v[3],x4=v[4],x5=v[5],x6=v[6],x7=v[7],x8=v[8],x9=v[9],x10=v[10],x11=v[11],x12=v[12],x13=v[13],x14=v[14],x15=v[15],i=_i=0,_ref1=this.rounds;_i<_ref1;i=_i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;return[x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15]},Salsa20InnerCore}(),Salsa20Core=function(_super){function Salsa20Core(key,nonce){var _ref1;if(Salsa20Core.__super__.constructor.call(this,20),this.key=key.clone().endian_reverse(),this.nonce=nonce.clone().endian_reverse(),(16!==this.key.sigBytes||8!==this.nonce.sigBytes)&&(32!==this.key.sigBytes||8!==(_ref1=this.nonce.sigBytes)&&24!==_ref1))throw new Error("Bad key/nonce lengths");24===this.nonce.sigBytes&&this.xsalsa_setup(),this.input=this.key_iv_setup(this.nonce,this.key),this._reset()}return __extends(Salsa20Core,_super),Salsa20Core.prototype.sigma=WordArray.from_buffer_le(new Buffer("expand 32-byte k")),Salsa20Core.prototype.tau=WordArray.from_buffer_le(new Buffer("expand 16-byte k")),Salsa20Core.blockSize=64,Salsa20Core.prototype.blockSize=Salsa20Core.blockSize,Salsa20Core.keySize=32,Salsa20Core.prototype.keySize=Salsa20Core.keySize,Salsa20Core.ivSize=24,Salsa20Core.prototype.ivSize=Salsa20Core.ivSize,Salsa20Core.prototype.scrub=function(){return this.key.scrub(),this.nonce.scrub(),util.scrub_vec(this.input)},Salsa20Core.prototype.xsalsa_setup=function(){var n0,n1;return n0=new WordArray(this.nonce.words.slice(0,4)),this.nonce=n1=new WordArray(this.nonce.words.slice(4)),this.key=this.hsalsa20(n0,this.key)},Salsa20Core.prototype.hsalsa20=function(nonce,key){var i,indexes,input,v;return input=this.key_iv_setup(nonce,key),input[8]=nonce.words[2],input[9]=nonce.words[3],v=this._core(input),indexes=[0,5,10,15,6,7,8,9],v=function(){var _i,_len,_results;for(_results=[],_i=0,_len=indexes.length;_len>_i;_i++)i=indexes[_i],_results.push(fixup_uint32(v[i]));return _results}(),util.scrub_vec(input),new WordArray(v)},Salsa20Core.prototype.key_iv_setup=function(nonce,key){var A,C,i,out,_i,_j,_k,_ref1;for(out=[],i=_i=0;4>_i;i=++_i)out[i+1]=key.words[i];for(_ref1=32===key.sigBytes?[this.sigma,key.words.slice(4)]:[this.tau,key.words],C=_ref1[0],A=_ref1[1],i=_j=0;4>_j;i=++_j)out[i+11]=A[i];for(i=_k=0;4>_k;i=++_k)out[5*i]=C.words[i];return out[6]=nonce.words[0],out[7]=nonce.words[1],out},Salsa20Core.prototype.counter_setup=function(){return this.input[8]=this.counter.get().words[0],this.input[9]=this.counter.get().words[1]},Salsa20Core.prototype._reset=function(){return this.counter=new Counter({len:2})},Salsa20Core.prototype._generateBlock=function(){var v;return this.counter_setup(),v=this._core(this.input),asum(v,this.input),this.counter.inc_le(),v},Salsa20Core}(Salsa20InnerCore),exports.Salsa20WordStream=Salsa20WordStream=function(_super){function Salsa20WordStream(){return Salsa20WordStream.__super__.constructor.apply(this,arguments)}return __extends(Salsa20WordStream,_super),Salsa20WordStream.prototype._reset=function(){return Salsa20WordStream.__super__._reset.call(this)},Salsa20WordStream.prototype.getWordArray=function(nbytes){var blocks,i,nblocks,w,words,_i,_len,_ref1;for(null==nbytes||nbytes===this.blockSize?words=this._generateBlock():(nblocks=Math.ceil(nbytes/this.blockSize),blocks=function(){var _i,_results;
|
|||
|
for(_results=[],i=_i=0;80>_i;i=++_i)_results.push(new X64Word(0,0));return _results}()}return Global.convert=function(raw){var i,_i,_ref1,_results;for(_results=[],i=_i=0,_ref1=raw.length;_ref1>_i;i=_i+=2)_results.push(new X64Word(raw[i],raw[i+1]));return _results},Global.prototype.convert=function(raw){return Global.convert(raw)},Global}(),exports.Global=Global,glbl=new Global,exports.SHA512=SHA512=function(_super){function SHA512(){return SHA512.__super__.constructor.apply(this,arguments)}return __extends(SHA512,_super),SHA512.blockSize=32,SHA512.prototype.blockSize=SHA512.blockSize,SHA512.output_size=64,SHA512.prototype.output_size=SHA512.output_size,SHA512.prototype._doReset=function(){return this._hash=glbl.I.clone()},SHA512.prototype._doProcessBlock=function(M,offset){var H,H0,H0h,H0l,H1,H1h,H1l,H2,H2h,H2l,H3,H3h,H3l,H4,H4h,H4l,H5,H5h,H5l,H6,H6h,H6l,H7,H7h,H7l,Ki,Kih,Kil,W,Wi,Wi16,Wi16h,Wi16l,Wi7,Wi7h,Wi7l,Wih,Wil,ah,al,bh,bl,ch,chh,chl,cl,dh,dl,eh,el,fh,fl,gamma0h,gamma0l,gamma0x,gamma0xh,gamma0xl,gamma1h,gamma1l,gamma1x,gamma1xh,gamma1xl,gh,gl,hh,hl,i,majh,majl,sigma0h,sigma0l,sigma1h,sigma1l,t1h,t1l,t2h,t2l,_i;for(H=this._hash.words,W=glbl.W,H0=H[0],H1=H[1],H2=H[2],H3=H[3],H4=H[4],H5=H[5],H6=H[6],H7=H[7],H0h=H0.high,H0l=H0.low,H1h=H1.high,H1l=H1.low,H2h=H2.high,H2l=H2.low,H3h=H3.high,H3l=H3.low,H4h=H4.high,H4l=H4.low,H5h=H5.high,H5l=H5.low,H6h=H6.high,H6l=H6.low,H7h=H7.high,H7l=H7.low,ah=H0h,al=H0l,bh=H1h,bl=H1l,ch=H2h,cl=H2l,dh=H3h,dl=H3l,eh=H4h,el=H4l,fh=H5h,fl=H5l,gh=H6h,gl=H6l,hh=H7h,hl=H7l,i=_i=0;80>_i;i=++_i)Wi=W[i],16>i?(Wih=Wi.high=0|M[offset+2*i],Wil=Wi.low=0|M[offset+2*i+1]):(gamma0x=W[i-15],gamma0xh=gamma0x.high,gamma0xl=gamma0x.low,gamma0h=(gamma0xh>>>1|gamma0xl<<31)^(gamma0xh>>>8|gamma0xl<<24)^gamma0xh>>>7,gamma0l=(gamma0xl>>>1|gamma0xh<<31)^(gamma0xl>>>8|gamma0xh<<24)^(gamma0xl>>>7|gamma0xh<<25),gamma1x=W[i-2],gamma1xh=gamma1x.high,gamma1xl=gamma1x.low,gamma1h=(gamma1xh>>>19|gamma1xl<<13)^(gamma1xh<<3|gamma1xl>>>29)^gamma1xh>>>6,gamma1l=(gamma1xl>>>19|gamma1xh<<13)^(gamma1xl<<3|gamma1xh>>>29)^(gamma1xl>>>6|gamma1xh<<26),Wi7=W[i-7],Wi7h=Wi7.high,Wi7l=Wi7.low,Wi16=W[i-16],Wi16h=Wi16.high,Wi16l=Wi16.low,Wil=gamma0l+Wi7l,Wih=gamma0h+Wi7h+(gamma0l>>>0>Wil>>>0?1:0),Wil+=gamma1l,Wih=Wih+gamma1h+(gamma1l>>>0>Wil>>>0?1:0),Wil+=Wi16l,Wih=Wih+Wi16h+(Wi16l>>>0>Wil>>>0?1:0),Wi.high=Wih,Wi.low=Wil),chh=eh&fh^~eh&gh,chl=el&fl^~el&gl,majh=ah&bh^ah&ch^bh&ch,majl=al&bl^al&cl^bl&cl,sigma0h=(ah>>>28|al<<4)^(ah<<30|al>>>2)^(ah<<25|al>>>7),sigma0l=(al>>>28|ah<<4)^(al<<30|ah>>>2)^(al<<25|ah>>>7),sigma1h=(eh>>>14|el<<18)^(eh>>>18|el<<14)^(eh<<23|el>>>9),sigma1l=(el>>>14|eh<<18)^(el>>>18|eh<<14)^(el<<23|eh>>>9),Ki=glbl.K[i],Kih=Ki.high,Kil=Ki.low,t1l=hl+sigma1l,t1h=hh+sigma1h+(hl>>>0>t1l>>>0?1:0),t1l+=chl,t1h=t1h+chh+(chl>>>0>t1l>>>0?1:0),t1l+=Kil,t1h=t1h+Kih+(Kil>>>0>t1l>>>0?1:0),t1l+=Wil,t1h=t1h+Wih+(Wil>>>0>t1l>>>0?1:0),t2l=sigma0l+majl,t2h=sigma0h+majh+(sigma0l>>>0>t2l>>>0?1:0),hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,el=dl+t1l|0,eh=dh+t1h+(dl>>>0>el>>>0?1:0)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,al=t1l+t2l|0,ah=t1h+t2h+(t1l>>>0>al>>>0?1:0)|0;return H0l=H0.low=H0l+al,H0.high=H0h+ah+(al>>>0>H0l>>>0?1:0),H1l=H1.low=H1l+bl,H1.high=H1h+bh+(bl>>>0>H1l>>>0?1:0),H2l=H2.low=H2l+cl,H2.high=H2h+ch+(cl>>>0>H2l>>>0?1:0),H3l=H3.low=H3l+dl,H3.high=H3h+dh+(dl>>>0>H3l>>>0?1:0),H4l=H4.low=H4l+el,H4.high=H4h+eh+(el>>>0>H4l>>>0?1:0),H5l=H5.low=H5l+fl,H5.high=H5h+fh+(fl>>>0>H5l>>>0?1:0),H6l=H6.low=H6l+gl,H6.high=H6h+gh+(gl>>>0>H6l>>>0?1:0),H7l=H7.low=H7l+hl,H7.high=H7h+hh+(hl>>>0>H7l>>>0?1:0)},SHA512.prototype._doFinalize=function(){var dataWords,nBitsLeft,nBitsTotal;return dataWords=this._data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*this._data.sigBytes,dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[(nBitsLeft+128>>>10<<5)+30]=Math.floor(nBitsTotal/4294967296),dataWords[(nBitsLeft+128>>>10<<5)+31]=nBitsTotal,this._data.sigBytes=4*dataWords.length,this._process(),this._hash.toX32()},SHA512.prototype.copy_to=function(obj){return SHA512.__super__.copy_to.call(this,obj),obj._hash=this._hash.clone()},SHA512.prototype.clone=functio
|
|||
|
x0=x0+j0|0,x1=x1+j1|0,x2=x2+j2|0,x3=x3+j3|0,x4=x4+j4|0,x5=x5+j5|0,x6=x6+j6|0,x7=x7+j7|0,x8=x8+j8|0,x9=x9+j9|0,x10=x10+j10|0,x11=x11+j11|0,x12=x12+j12|0,x13=x13+j13|0,x14=x14+j14|0,x15=x15+j15|0,o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x1>>>0&255,o[5]=x1>>>8&255,o[6]=x1>>>16&255,o[7]=x1>>>24&255,o[8]=x2>>>0&255,o[9]=x2>>>8&255,o[10]=x2>>>16&255,o[11]=x2>>>24&255,o[12]=x3>>>0&255,o[13]=x3>>>8&255,o[14]=x3>>>16&255,o[15]=x3>>>24&255,o[16]=x4>>>0&255,o[17]=x4>>>8&255,o[18]=x4>>>16&255,o[19]=x4>>>24&255,o[20]=x5>>>0&255,o[21]=x5>>>8&255,o[22]=x5>>>16&255,o[23]=x5>>>24&255,o[24]=x6>>>0&255,o[25]=x6>>>8&255,o[26]=x6>>>16&255,o[27]=x6>>>24&255,o[28]=x7>>>0&255,o[29]=x7>>>8&255,o[30]=x7>>>16&255,o[31]=x7>>>24&255,o[32]=x8>>>0&255,o[33]=x8>>>8&255,o[34]=x8>>>16&255,o[35]=x8>>>24&255,o[36]=x9>>>0&255,o[37]=x9>>>8&255,o[38]=x9>>>16&255,o[39]=x9>>>24&255,o[40]=x10>>>0&255,o[41]=x10>>>8&255,o[42]=x10>>>16&255,o[43]=x10>>>24&255,o[44]=x11>>>0&255,o[45]=x11>>>8&255,o[46]=x11>>>16&255,o[47]=x11>>>24&255,o[48]=x12>>>0&255,o[49]=x12>>>8&255,o[50]=x12>>>16&255,o[51]=x12>>>24&255,o[52]=x13>>>0&255,o[53]=x13>>>8&255,o[54]=x13>>>16&255,o[55]=x13>>>24&255,o[56]=x14>>>0&255,o[57]=x14>>>8&255,o[58]=x14>>>16&255,o[59]=x14>>>24&255,o[60]=x15>>>0&255,o[61]=x15>>>8&255,o[62]=x15>>>16&255,o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){for(var u,j0=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,j1=255&k[0]|(255&k[1])<<8|(255&k[2])<<16|(255&k[3])<<24,j2=255&k[4]|(255&k[5])<<8|(255&k[6])<<16|(255&k[7])<<24,j3=255&k[8]|(255&k[9])<<8|(255&k[10])<<16|(255&k[11])<<24,j4=255&k[12]|(255&k[13])<<8|(255&k[14])<<16|(255&k[15])<<24,j5=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,j6=255&p[0]|(255&p[1])<<8|(255&p[2])<<16|(255&p[3])<<24,j7=255&p[4]|(255&p[5])<<8|(255&p[6])<<16|(255&p[7])<<24,j8=255&p[8]|(255&p[9])<<8|(255&p[10])<<16|(255&p[11])<<24,j9=255&p[12]|(255&p[13])<<8|(255&p[14])<<16|(255&p[15])<<24,j10=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,j11=255&k[16]|(255&k[17])<<8|(255&k[18])<<16|(255&k[19])<<24,j12=255&k[20]|(255&k[21])<<8|(255&k[22])<<16|(255&k[23])<<24,j13=255&k[24]|(255&k[25])<<8|(255&k[26])<<16|(255&k[27])<<24,j14=255&k[28]|(255&k[29])<<8|(255&k[30])<<16|(255&k[31])<<24,j15=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;20>i;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x5>>>0&255,o[5]=x5>>>8&255,o[6]=x5>>>16&255,o[7]=x5>>>24&255,o[8]=x10>>>0&255,o[9]=x10>>>8&255,o[10]=x10>>>16&255,o[11]=x10>>>24&255,o[12]=x15>>>0&255,o[13]=x15>>>8&255,o[14]=x15>>>16&255,o[15]=x15>>>24&255,o[16]=x6>>>0&255,o[17]=x6>>>8&255,o[18]=x6>>>16&255,o[19]=x6>>>24&255,o[20]=x7>>>0&255,o[21]=x7>>>8&255,o[22]=x7>>>16&255,o[23]=x7>>>24&255,o[24]=x8>>>0&255,o[25]=x8>>>8&255,o[26]=x8>>>16&255,o[27]=x8>>>24&255,o[28]=x9>>>0&255,o[29]=x9>>>8&255,o[30]=x9>>>16&255,o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var u,i,z=new Uint8Array(16),x=
|
|||
|
for(i=0;i<d.length;i++)b[i]=d.charCodeAt(i);return b},nacl.util.encodeUTF8=function(arr){var i,s=[];for(i=0;i<arr.length;i++)s.push(String.fromCharCode(arr[i]));return decodeURIComponent(escape(s.join("")))},nacl.util.encodeBase64=function(arr){if("undefined"==typeof btoa)return new Buffer(arr).toString("base64");var i,s=[],len=arr.length;for(i=0;len>i;i++)s.push(String.fromCharCode(arr[i]));return btoa(s.join(""))},nacl.util.decodeBase64=function(s){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(s,"base64"),0));var i,d=atob(s),b=new Uint8Array(d.length);for(i=0;i<d.length;i++)b[i]=d.charCodeAt(i);return b},nacl.randomBytes=function(n){var b=new Uint8Array(n);return randombytes(b,n),b},nacl.secretbox=function(msg,nonce,key){checkArrayTypes(msg,nonce,key),checkLengths(key,nonce);for(var m=new Uint8Array(crypto_secretbox_ZEROBYTES+msg.length),c=new Uint8Array(m.length),i=0;i<msg.length;i++)m[i+crypto_secretbox_ZEROBYTES]=msg[i];return crypto_secretbox(c,m,m.length,nonce,key),c.subarray(crypto_secretbox_BOXZEROBYTES)},nacl.secretbox.open=function(box,nonce,key){checkArrayTypes(box,nonce,key),checkLengths(key,nonce);for(var c=new Uint8Array(crypto_secretbox_BOXZEROBYTES+box.length),m=new Uint8Array(c.length),i=0;i<box.length;i++)c[i+crypto_secretbox_BOXZEROBYTES]=box[i];return c.length<32?!1:0!==crypto_secretbox_open(m,c,c.length,nonce,key)?!1:m.subarray(crypto_secretbox_ZEROBYTES)},nacl.secretbox.keyLength=crypto_secretbox_KEYBYTES,nacl.secretbox.nonceLength=crypto_secretbox_NONCEBYTES,nacl.secretbox.overheadLength=crypto_secretbox_BOXZEROBYTES,nacl.scalarMult=function(n,p){if(checkArrayTypes(n,p),n.length!==crypto_scalarmult_SCALARBYTES)throw new Error("bad n size");if(p.length!==crypto_scalarmult_BYTES)throw new Error("bad p size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult(q,n,p),q},nacl.scalarMult.base=function(n){if(checkArrayTypes(n),n.length!==crypto_scalarmult_SCALARBYTES)throw new Error("bad n size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult_base(q,n),q},nacl.scalarMult.scalarLength=crypto_scalarmult_SCALARBYTES,nacl.scalarMult.groupElementLength=crypto_scalarmult_BYTES,nacl.box=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox(msg,nonce,k)},nacl.box.before=function(publicKey,secretKey){checkArrayTypes(publicKey,secretKey),checkBoxLengths(publicKey,secretKey);var k=new Uint8Array(crypto_box_BEFORENMBYTES);return crypto_box_beforenm(k,publicKey,secretKey),k},nacl.box.after=nacl.secretbox,nacl.box.open=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox.open(msg,nonce,k)},nacl.box.open.after=nacl.secretbox.open,nacl.box.keyPair=function(){var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES),sk=new Uint8Array(crypto_box_SECRETKEYBYTES);return crypto_box_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.box.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),secretKey.length!==crypto_box_SECRETKEYBYTES)throw new Error("bad secret key size");var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES);return crypto_scalarmult_base(pk,secretKey),{publicKey:pk,secretKey:new Uint8Array(secretKey)}},nacl.box.publicKeyLength=crypto_box_PUBLICKEYBYTES,nacl.box.secretKeyLength=crypto_box_SECRETKEYBYTES,nacl.box.sharedKeyLength=crypto_box_BEFORENMBYTES,nacl.box.nonceLength=crypto_box_NONCEBYTES,nacl.box.overheadLength=nacl.secretbox.overheadLength,nacl.sign=function(msg,secretKey){if(checkArrayTypes(msg,secretKey),secretKey.length!==crypto_sign_SECRETKEYBYTES)throw new Error("bad secret key size");var signedMsg=new Uint8Array(crypto_sign_BYTES+msg.length);return crypto_sign(signedMsg,msg,msg.length,secretKey),signedMsg},nacl.sign.open=function(signedMsg,publicKey){if(2!==arguments.length)throw new Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(checkArrayTypes(signedMsg,publicKey),publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw new Error("bad public key size");var tmp=new
|
|||
|
})):"undefined"!=typeof require&&(crypto=require("crypto"),crypto&&nacl.setPRNG(function(x,n){var i,v=crypto.randomBytes(n);for(i=0;n>i;i++)x[i]=v[i]}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{})}).call(this,require("buffer").Buffer)},{buffer:80,crypto:86}],202:[function(require,module){module.exports={name:"kbpgp",description:"Keybase's PGP Implementation",keywords:["crypto","pgp","keybase"],author:"Maxwell Krohn",version:"2.0.8",license:"BSD-3-Clause",main:"./lib/main.js",directories:{lib:"lib/"},homepage:"http://github.com/keybase/kbpgp",bugs:"https://github.com/keybase/kbpgp/issues",repository:{type:"git",url:"git://github.com/keybase/kbpgp.git"},dependencies:{bn:"^1.0.0","deep-equal":">=0.2.1","iced-error":">=0.0.9","iced-runtime":">=0.0.1","keybase-compressjs":"^1.0.1-c","keybase-ecurve":"^1.0.0","pgp-utils":">=0.0.28",purepack:">=1.0.1",triplesec:">=3.0.19",tweetnacl:"^0.12.2"},devDependencies:{browserify:"^5.9.1",colors:"0.6.2","iced-coffee-script":"1.7.1-c","iced-test":">=0.0.21",icsify:"0.6.0",minimist:"0.0.8",optimist:"0.6.1","uglify-js":"^2.4.13"}}},{}]},{},[29])(29)});
|