Merge pull request #61 from ZiRo-/master

make final adjustments to the siphash function
This commit is contained in:
Jeff committed 2016-05-18 10:22:24 -04:00
commit 4f0ae8fec3
2 files changed
+11 -5

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ $packages["runtime/trace"]=(function(){var $pkg={},$init,A,B;A=$packages["io"];B
$packages["testing"]=(function(){var $pkg={},$init,H,B,C,E,I,D,A,K,L,M,N,J,F,G,P,Q,R,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;H=$packages["bytes"];B=$packages["flag"];C=$packages["fmt"];E=$packages["github.com/gopherjs/gopherjs/nosync"];I=$packages["io"];D=$packages["os"];A=$packages["runtime"];K=$packages["runtime/debug"];L=$packages["runtime/pprof"];M=$packages["runtime/trace"];N=$packages["strconv"];J=$packages["strings"];F=$packages["sync/atomic"];G=$packages["time"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=H.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=I.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=K.$init();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=L.$init();$s=9;case 9:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=M.$init();$s=10;case 10:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=N.$init();$s=11;case 11:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=J.$init();$s=12;case 12:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=13;case 13:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=G.$init();$s=14;case 14:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}a=B.String("test.bench","","regular expression to select benchmarks to run");$s=15;case 15:if($c){$c=false;a=a.$blk();}if(a&&a.$blk!==undefined){break s;}P=a;b=B.Duration("test.benchtime",new G.Duration(0,1000000000),"approximate run time for each benchmark");$s=16;case 16:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}Q=b;c=B.Bool("test.benchmem",false,"print memory allocations for benchmarks");$s=17;case 17:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}R=c;d=B.Bool("test.short",false,"run smaller test suite to save time");$s=18;case 18:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}AP=d;e=B.String("test.outputdir","","directory in which to write profiles");$s=19;case 19:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}AQ=e;f=B.Bool("test.v",false,"verbose: print additional output");$s=20;case 20:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}AR=f;g=B.Uint("test.count",1,"run tests and benchmarks `n` times");$s=21;case 21:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}AS=g;h=B.String("test.coverprofile","","write a coverage profile to the named file after execution");$s=22;case 22:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}AT=h;i=B.String("test.run","","regular expression to select tests and examples to run");$s=23;case 23:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}AU=i;j=B.String("test.memprofile","","write a memory profile to the named file after execution");$s=24;case 24:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}AV=j;k=B.Int("test.memprofilerate",0,"if >=0, sets runtime.MemProfileRate");$s=25;case 25:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}AW=k;l=B.String("test.cpuprofile","","write a cpu profile to the named file during execution");$s=26;case 26:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}AX=l;m=B.String("test.blockprofile","","write a goroutine blocking profile to the named file after execution");$s=27;case 27:if($c){$c=false;m=m.$blk();}if(m&&m.$blk!==undefined){break s;}AY=m;n=B.Int("test.blockprofilerate",1,"if >= 0, calls runtime.SetBlockProfileRate()");$s=28;case 28:if($c){$c=false;n=n.$blk();}if(n&&n.$blk!==undefined){break s;}AZ=n;o=B.String("test.trace","","write an execution trace to the named file after execution");$s=29;case 29:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}BA=o;p=B.Duration("test.timeout",new G.Duration(0,0),"if positive, sets an aggregate time limit for all tests");$s=30;case 30:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}BB=p;q=B.String("test.cpu","","comma-separated list of number of CPUs to use for each test");$s=31;case 31:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}BC=q;r=B.Int("test.parallel",A.GOMAXPROCS(0),"maximum test parallelism");$s=32;case 32:if($c){$c=false;r=r.$blk();}if(r&&r.$blk!==undefined){break s;}BD=r;}return;}if($f===undefined){$f={$blk:$init};}$f.$s=Line truncated
$packages["unicode/utf16"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
$packages["encoding/json"]=(function(){var $pkg={},$init,B,C,D,E,F,P,Q,M,G,H,N,I,O,A,J,K,L,X,AK,AL,AM,AO,AQ,AU,BJ,BP,BR,BU,BW,BY,CA,CF,CG,CI,CJ,CY,CZ,ER,ET,EU,EV,EW,EX,EY,EZ,FA,FB,FC,FD,FG,FH,FI,FJ,FN,FS,FT,FV,FW,FX,FY,FZ,GA,GB,GC,GD,GE,AA,AD,AP,AV,AY,AZ,BK,BL,CM,a,b,Y,AH,AT,AW,AX,BA,BB,BC,BD,BE,BF,BG,BH,BI,BM,BN,BO,BQ,BS,BT,BV,BX,BZ,CB,CC,CD,CE,CH,CK,CL,CN,CO,CP,CQ,CR,CT,DA,DB,DC,DD,DE,DF,DG,DH,DI,DJ,DK,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,EG,ES;B=$packages["bytes"];C=$packages["encoding"];D=$packages["encoding/base64"];E=$packages["errors"];F=$packages["fmt"];P=$packages["github.com/gopherjs/gopherjs/nosync"];Q=$packages["io"];M=$packages["math"];G=$packages["reflect"];H=$packages["runtime"];N=$packages["sort"];I=$packages["strconv"];O=$packages["strings"];A=$packages["testing"];J=$packages["unicode"];K=$packages["unicode/utf16"];L=$packages["unicode/utf8"];X=$pkg.Number=$newType(8,$kindString,"json.Number","Number","encoding/json",null);AK=$pkg.Marshaler=$newType(8,$kindInterface,"json.Marshaler","Marshaler","encoding/json",null);AL=$pkg.UnsupportedTypeError=$newType(0,$kindStruct,"json.UnsupportedTypeError","UnsupportedTypeError","encoding/json",function(Type_){this.$val=this;if(arguments.length===0){this.Type=$ifaceNil;return;}this.Type=Type_;});AM=$pkg.UnsupportedValueError=$newType(0,$kindStruct,"json.UnsupportedValueError","UnsupportedValueError","encoding/json",function(Value_,Str_){this.$val=this;if(arguments.length===0){this.Value=new G.Value.ptr(FD.nil,0,0);this.Str="";return;}this.Value=Value_;this.Str=Str_;});AO=$pkg.MarshalerError=$newType(0,$kindStruct,"json.MarshalerError","MarshalerError","encoding/json",function(Type_,Err_){this.$val=this;if(arguments.length===0){this.Type=$ifaceNil;this.Err=$ifaceNil;return;}this.Type=Type_;this.Err=Err_;});AQ=$pkg.encodeState=$newType(0,$kindStruct,"json.encodeState","encodeState","encoding/json",function(Buffer_,scratch_){this.$val=this;if(arguments.length===0){this.Buffer=new B.Buffer.ptr(EZ.nil,0,FG.zero(),FH.zero(),0);this.scratch=FH.zero();return;}this.Buffer=Buffer_;this.scratch=scratch_;});AU=$pkg.encoderFunc=$newType(4,$kindFunc,"json.encoderFunc","encoderFunc","encoding/json",null);BJ=$pkg.floatEncoder=$newType(4,$kindInt,"json.floatEncoder","floatEncoder","encoding/json",null);BP=$pkg.structEncoder=$newType(0,$kindStruct,"json.structEncoder","structEncoder","encoding/json",function(fields_,fieldEncs_){this.$val=this;if(arguments.length===0){this.fields=EW.nil;this.fieldEncs=FJ.nil;return;}this.fields=fields_;this.fieldEncs=fieldEncs_;});BR=$pkg.mapEncoder=$newType(0,$kindStruct,"json.mapEncoder","mapEncoder","encoding/json",function(elemEnc_){this.$val=this;if(arguments.length===0){this.elemEnc=$throwNilPointerError;return;}this.elemEnc=elemEnc_;});BU=$pkg.sliceEncoder=$newType(0,$kindStruct,"json.sliceEncoder","sliceEncoder","encoding/json",function(arrayEnc_){this.$val=this;if(arguments.length===0){this.arrayEnc=$throwNilPointerError;return;}this.arrayEnc=arrayEnc_;});BW=$pkg.arrayEncoder=$newType(0,$kindStruct,"json.arrayEncoder","arrayEncoder","encoding/json",function(elemEnc_){this.$val=this;if(arguments.length===0){this.elemEnc=$throwNilPointerError;return;}this.elemEnc=elemEnc_;});BY=$pkg.ptrEncoder=$newType(0,$kindStruct,"json.ptrEncoder","ptrEncoder","encoding/json",function(elemEnc_){this.$val=this;if(arguments.length===0){this.elemEnc=$throwNilPointerError;return;}this.elemEnc=elemEnc_;});CA=$pkg.condAddrEncoder=$newType(0,$kindStruct,"json.condAddrEncoder","condAddrEncoder","encoding/json",function(canAddrEnc_,elseEnc_){this.$val=this;if(arguments.length===0){this.canAddrEnc=$throwNilPointerError;this.elseEnc=$throwNilPointerError;return;}this.canAddrEnc=canAddrEnc_;this.elseEnc=elseEnc_;});CF=$pkg.stringValues=$newType(12,$kindSlice,"json.stringValues","stringValues","encoding/json",null);CG=$pkg.field=$newType(0,$kindStruct,"json.field","field","encoding/json",function(name_,nameBytes_,equalFold_,tag_,index_,typ_,omitEmpty_,quoted_){this.$val=this;if(arguments.length===0){this.name="";this.nameBytes=EZ.nil;this.equalFold=$throwNilPointerError;this.tag=false;this.index=FC.nil;this.typ=$ifaceNil;this.omitEmpty=false;this.quoted=false;return;}this.name=name_;this.nameBytes=nameBytes_;this.equalFold=equalFold_;this.tag=tag_;this.index=index_;this.typ=typ_;this.omitEmpty=omitEmpty_;this.quoted=quoted_;});CI=$pkg.byName=$newType(12,$kindSlice,"json.byName","byName","encoding/json",null);CJ=$pkg.byIndex=$newType(12,$kindSlice,"json.byIndex","byIndex","encoding/json",null);CY=$pkg.SyntaxError=$newType(0,$kindStruct,"json.SyntaxError","SyntaxError","encoding/json",function(msg_,Offset_){this.$val=this;if(arguments.length===0){this.msg="";this.Offset=new $Int64(0,0);return;}this.msg=msg_;this.Offset=Offset_;});CZ=$pkg.scanner=$newType(0,$kindStruct,"json.scanner","scanner","encoding/json",function(step_,endTop_,parseState_,err_,redo_,redoCode_,redoState_,bytes_){this.$val=this;if(arguments.length===0){this.step=$Line truncated
$packages["github.com/ZiRo-/cuckgo/miner_js"]=(function(){var $pkg={},$init,C,A,D,E,B,F,K,N,U,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AJ,AK,L,G,H,I,J,M,O,P,Q,R,S,T,W;C=$packages["crypto/rand"];A=$packages["crypto/sha256"];D=$packages["encoding/base64"];E=$packages["encoding/json"];B=$packages["github.com/gopherjs/gopherjs/js"];F=$pkg.Cuckoo=$newType(0,$kindStruct,"main.Cuckoo","Cuckoo","github.com/ZiRo-/cuckgo/miner_js",function(v_,key_){this.$val=this;if(arguments.length===0){this.v=Z.zero();this.key=AA.nil;return;}this.v=v_;this.key=key_;});K=$pkg.Edge=$newType(0,$kindStruct,"main.Edge","Edge","github.com/ZiRo-/cuckgo/miner_js",function(U_,V_){this.$val=this;if(arguments.length===0){this.U=new $Uint64(0,0);this.V=new $Uint64(0,0);return;}this.U=U_;this.V=V_;});N=$pkg.CuckooSolve=$newType(0,$kindStruct,"main.CuckooSolve","CuckooSolve","github.com/ZiRo-/cuckgo/miner_js",function(graph_,easiness_,cuckoo_,sols_,nsols_,nthreads_){this.$val=this;if(arguments.length===0){this.graph=AC.nil;this.easiness=0;this.cuckoo=AD.nil;this.sols=AE.nil;this.nsols=0;this.nthreads=0;return;}this.graph=graph_;this.easiness=easiness_;this.cuckoo=cuckoo_;this.sols=sols_;this.nsols=nsols_;this.nthreads=nthreads_;});U=$pkg.CuckooJSON=$newType(0,$kindStruct,"main.CuckooJSON","CuckooJSON","github.com/ZiRo-/cuckgo/miner_js",function(Parameter_,InputData_,Cycle_){this.$val=this;if(arguments.length===0){this.Parameter=false;this.InputData=AA.nil;this.Cycle=AB.nil;return;}this.Parameter=Parameter_;this.InputData=InputData_;this.Cycle=Cycle_;});Y=$arrayType($Uint8,32);Z=$arrayType($Uint64,4);AA=$sliceType($Uint8);AB=$sliceType($Uint64);AC=$ptrType(F);AD=$sliceType($Int);AE=$sliceType(AD);AF=$ptrType(K);AG=$funcType([$Float64],[$String],false);AH=$mapType($String,$emptyInterface);AJ=$ptrType(N);AK=$mapType($String,$Uint64);G=function(a){var $ptr,a,b;return(b=new $Uint64(0,a),new $Uint64(b.$high&0,(b.$low&255)>>>0));};H=function(a,b){var $ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;a=$clone(a,Y);return(c=(d=(e=(f=(g=(h=(i=G(((b<0||b>=a.length)?$throwRuntimeError("index out of range"):a[b])),j=$shiftLeft64(G((k=b+1>>0,((k<0||k>=a.length)?$throwRuntimeError("index out of range"):a[k]))),8),new $Uint64(i.$high|j.$high,(i.$low|j.$low)>>>0)),l=$shiftLeft64(G((m=b+2>>0,((m<0||m>=a.length)?$throwRuntimeError("index out of range"):a[m]))),16),new $Uint64(h.$high|l.$high,(h.$low|l.$low)>>>0)),n=$shiftLeft64(G((o=b+3>>0,((o<0||o>=a.length)?$throwRuntimeError("index out of range"):a[o]))),24),new $Uint64(g.$high|n.$high,(g.$low|n.$low)>>>0)),p=$shiftLeft64(G((q=b+4>>0,((q<0||q>=a.length)?$throwRuntimeError("index out of range"):a[q]))),32),new $Uint64(f.$high|p.$high,(f.$low|p.$low)>>>0)),r=$shiftLeft64(G((s=b+5>>0,((s<0||s>=a.length)?$throwRuntimeError("index out of range"):a[s]))),40),new $Uint64(e.$high|r.$high,(e.$low|r.$low)>>>0)),t=$shiftLeft64(G((u=b+6>>0,((u<0||u>=a.length)?$throwRuntimeError("index out of range"):a[u]))),48),new $Uint64(d.$high|t.$high,(d.$low|t.$low)>>>0)),v=$shiftLeft64(G((w=b+7>>0,((w<0||w>=a.length)?$throwRuntimeError("index out of range"):a[w]))),56),new $Uint64(c.$high|v.$high,(c.$low|v.$low)>>>0));};I=function(a){var $ptr,a,b;b=$clone(A.Sum256(a),Y);return J(b);};$pkg.NewCuckoo=I;J=function(a){var $ptr,a,b,c,d;a=$clone(a,Y);b=new F.ptr(Z.zero(),AA.nil);c=H(a,0);d=H(a,8);b.v[0]=new $Uint64(c.$high^1936682341,(c.$low^1886610805)>>>0);b.v[1]=new $Uint64(d.$high^1685025377,(d.$low^1852075885)>>>0);b.v[2]=new $Uint64(c.$high^1819895653,(c.$low^1852142177)>>>0);b.v[3]=new $Uint64(d.$high^1952801890,(d.$low^2037671283)>>>0);b.key=new AA(a);return b;};$pkg.NewCuckooSHA=J;K.ptr.prototype.HashCode=function(){var $ptr,a;a=this;return((a.U.$low>>0)^(a.V.$low>>0))>>0;};K.prototype.HashCode=function(){return this.$val.HashCode();};F.ptr.prototype.Sipedge=function(a){var $ptr,a,b;b=this;return new K.ptr(b.Sipnode(a,0),b.Sipnode(a,1));};F.prototype.Sipedge=function(a){return this.$val.Sipedge(a);};F.ptr.prototype.siphash24=function(a){var $ptr,a,b;b=this;return M(b.key,a);};F.prototype.siphash24=function(a){return this.$val.siphash24(a);};M=function(a,b){var $ptr,a,b,c,d,e,f;c=L.hash($externalize(a,AA),0,$externalize(b,$Uint64));d=$internalize(c[0],$Uint64);e=$internalize(c[1],$Uint64);return(f=$shiftLeft64(d,32),new $Uint64(f.$high|e.$high,(f.$low|e.$low)>>>0));};F.ptr.prototype.Sipnode=function(a,b){var $ptr,a,b,c,d,e,f;c=this;return(d=c.siphash24((e=$mul64(new $Uint64(0,2),a),f=new $Uint64(0,b),new $Uint64(e.$high+f.$high,e.$low+f.$low))),new $Uint64(d.$high&0,(d.$low&524287)>>>0));};F.prototype.Sipnode=function(a,b){return this.$val.Sipnode(a,b);};F.ptr.prototype.Verify=function(a,b){var $ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;c=this;d=$makeSlice(AB,42);e=$makeSlice(AB,42);f=0;g=new $Uint64(0,0);g=new $Uint64(0,0);while(true){if(!((g.$high<0||(g.$high===0&&g.$low<42)))){break;}if((h=(($flatten64(g)<0||$flatten64(g)>=a.$length)?$throwRuntimeError("index out of range"):a.$array[a.$offset+$flatten64(g)]),(h.$high>b.$high||(h.$hLine truncated
$packages["github.com/ZiRo-/cuckgo/miner_js"]=(function(){var $pkg={},$init,C,A,D,E,B,F,K,N,U,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AK,AL,L,G,H,I,J,M,O,P,Q,R,S,T,W;C=$packages["crypto/rand"];A=$packages["crypto/sha256"];D=$packages["encoding/base64"];E=$packages["encoding/json"];B=$packages["github.com/gopherjs/gopherjs/js"];F=$pkg.Cuckoo=$newType(0,$kindStruct,"main.Cuckoo","Cuckoo","github.com/ZiRo-/cuckgo/miner_js",function(v_,vh_,vl_,key_){this.$val=this;if(arguments.length===0){this.v=Z.zero();this.vh=AA.zero();this.vl=AA.zero();this.key=AB.nil;return;}this.v=v_;this.vh=vh_;this.vl=vl_;this.key=key_;});K=$pkg.Edge=$newType(0,$kindStruct,"main.Edge","Edge","github.com/ZiRo-/cuckgo/miner_js",function(U_,V_){this.$val=this;if(arguments.length===0){this.U=new $Uint64(0,0);this.V=new $Uint64(0,0);return;}this.U=U_;this.V=V_;});N=$pkg.CuckooSolve=$newType(0,$kindStruct,"main.CuckooSolve","CuckooSolve","github.com/ZiRo-/cuckgo/miner_js",function(graph_,easiness_,cuckoo_,sols_,nsols_,nthreads_){this.$val=this;if(arguments.length===0){this.graph=AD.nil;this.easiness=0;this.cuckoo=AE.nil;this.sols=AF.nil;this.nsols=0;this.nthreads=0;return;}this.graph=graph_;this.easiness=easiness_;this.cuckoo=cuckoo_;this.sols=sols_;this.nsols=nsols_;this.nthreads=nthreads_;});U=$pkg.CuckooJSON=$newType(0,$kindStruct,"main.CuckooJSON","CuckooJSON","github.com/ZiRo-/cuckgo/miner_js",function(Parameter_,InputData_,Cycle_){this.$val=this;if(arguments.length===0){this.Parameter=false;this.InputData=AB.nil;this.Cycle=AC.nil;return;}this.Parameter=Parameter_;this.InputData=InputData_;this.Cycle=Cycle_;});Y=$arrayType($Uint8,32);Z=$arrayType($Uint64,4);AA=$arrayType($Uint32,4);AB=$sliceType($Uint8);AC=$sliceType($Uint64);AD=$ptrType(F);AE=$sliceType($Int);AF=$sliceType(AE);AG=$ptrType(K);AH=$funcType([$Float64],[$String],false);AI=$mapType($String,$emptyInterface);AK=$ptrType(N);AL=$mapType($String,$Uint64);G=function(a){var $ptr,a,b;return(b=new $Uint64(0,a),new $Uint64(b.$high&0,(b.$low&255)>>>0));};H=function(a,b){var $ptr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;a=$clone(a,Y);return(c=(d=(e=(f=(g=(h=(i=G(((b<0||b>=a.length)?$throwRuntimeError("index out of range"):a[b])),j=$shiftLeft64(G((k=b+1>>0,((k<0||k>=a.length)?$throwRuntimeError("index out of range"):a[k]))),8),new $Uint64(i.$high|j.$high,(i.$low|j.$low)>>>0)),l=$shiftLeft64(G((m=b+2>>0,((m<0||m>=a.length)?$throwRuntimeError("index out of range"):a[m]))),16),new $Uint64(h.$high|l.$high,(h.$low|l.$low)>>>0)),n=$shiftLeft64(G((o=b+3>>0,((o<0||o>=a.length)?$throwRuntimeError("index out of range"):a[o]))),24),new $Uint64(g.$high|n.$high,(g.$low|n.$low)>>>0)),p=$shiftLeft64(G((q=b+4>>0,((q<0||q>=a.length)?$throwRuntimeError("index out of range"):a[q]))),32),new $Uint64(f.$high|p.$high,(f.$low|p.$low)>>>0)),r=$shiftLeft64(G((s=b+5>>0,((s<0||s>=a.length)?$throwRuntimeError("index out of range"):a[s]))),40),new $Uint64(e.$high|r.$high,(e.$low|r.$low)>>>0)),t=$shiftLeft64(G((u=b+6>>0,((u<0||u>=a.length)?$throwRuntimeError("index out of range"):a[u]))),48),new $Uint64(d.$high|t.$high,(d.$low|t.$low)>>>0)),v=$shiftLeft64(G((w=b+7>>0,((w<0||w>=a.length)?$throwRuntimeError("index out of range"):a[w]))),56),new $Uint64(c.$high|v.$high,(c.$low|v.$low)>>>0));};I=function(a){var $ptr,a,b;b=$clone(A.Sum256(a),Y);return J(b);};$pkg.NewCuckoo=I;J=function(a){var $ptr,a,b,c,d,e,f,g,h,i,j;a=$clone(a,Y);b=new F.ptr(Z.zero(),AA.zero(),AA.zero(),AB.nil);c=H(a,0);d=H(a,8);b.v[0]=new $Uint64(c.$high^1936682341,(c.$low^1886610805)>>>0);b.v[1]=new $Uint64(d.$high^1685025377,(d.$low^1852075885)>>>0);b.v[2]=new $Uint64(c.$high^1819895653,(c.$low^1852142177)>>>0);b.v[3]=new $Uint64(d.$high^1952801890,(d.$low^2037671283)>>>0);b.key=new AB(a);e=b.v;f=0;while(true){if(!(f<4)){break;}g=f;h=((f<0||f>=e.length)?$throwRuntimeError("index out of range"):e[f]);(i=b.vl,((g<0||g>=i.length)?$throwRuntimeError("index out of range"):i[g]=(new $Uint64(h.$high&0,(h.$low&4294967295)>>>0).$low>>>0)));(j=b.vh,((g<0||g>=j.length)?$throwRuntimeError("index out of range"):j[g]=($shiftRightUint64((new $Uint64(h.$high&4294967295,(h.$low&0)>>>0)),32).$low>>>0)));f++;}return b;};$pkg.NewCuckooSHA=J;K.ptr.prototype.HashCode=function(){var $ptr,a;a=this;return((a.U.$low>>0)^(a.V.$low>>0))>>0;};K.prototype.HashCode=function(){return this.$val.HashCode();};F.ptr.prototype.Sipedge=function(a){var $ptr,a,b;b=this;return new K.ptr(b.Sipnode(a,0),b.Sipnode(a,1));};F.prototype.Sipedge=function(a){return this.$val.Sipedge(a);};F.ptr.prototype.siphash24=function(a){var $ptr,a,b;b=this;return M(b.vh,b.vl,a);};F.prototype.siphash24=function(a){return this.$val.siphash24(a);};M=function(a,b,c){var $ptr,a,b,c,d,e,f,g;b=$clone(b,AA);a=$clone(a,AA);d=L.hash(a[0],b[0],a[1],b[1],a[2],b[2],a[3],b[3],0,$externalize(c,$Uint64));e=$internalize(d[0],$Uint64);f=$internalize(d[1],$Uint64);return(g=$shiftLeft64(e,32),new $Uint64(g.$high|f.$high,(g.$low|f.$low)>>>0));};F.ptr.prototype.Sipnode=function(a,b){var $ptr,a,b,c,d,e,f;c=this;return(d=c.siphash24((e=$Line truncated
$synthesizeMethods();
var $mainPkg = $packages["github.com/ZiRo-/cuckgo/miner_js"];
$packages["runtime"].$init();
+10 -4
View File
@@ -47,9 +47,15 @@ var SipHash = (function() {
}
function hash(key, mh, ml) {
var mi = { h: mh, l: ml }
var k0 = u8to64(key, 0);
function hash(v0h, v0l, v1h, v1l, v2h, v2l, v3h, v3l, mh, ml) {
var mi = { h: mh, l: ml };
var v0 = { h: v0h, l: v0l };
var v1 = { h: v1h, l: v1l };
var v2 = { h: v2h, l: v2l };
var v3 = { h: v3h, l: v3l };
/*var k0 = u8to64(key, 0);
var k1 = u8to64(key, 8);
var v0 = { h: k0.h, l: k0.l }, v2 = k0;
@@ -58,7 +64,7 @@ var SipHash = (function() {
_xor(v0, { h: 0x736f6d65, l: 0x70736575 });
_xor(v1, { h: 0x646f7261, l: 0x6e646f6d });
_xor(v2, { h: 0x6c796765, l: 0x6e657261 });
_xor(v3, { h: 0x74656462, l: 0x79746573 });
_xor(v3, { h: 0x74656462, l: 0x79746573 });*/
_xor(v3, mi);
_compress(v0, v1, v2, v3);