xxhash-wasm
Version:
A WebAssembly implementation of xxHash
3 lines (2 loc) • 5.07 kB
JavaScript
;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,20,3,96,2,127,127,0,96,3,127,127,127,1,127,96,3,127,127,126,1,126,3,4,3,1,2,0,5,3,1,0,1,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,2,10,192,9,3,242,2,1,4,127,32,0,32,1,106,33,3,32,1,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,1,32,2,65,247,148,175,175,120,106,33,4,32,2,65,177,243,221,241,121,107,33,5,3,64,32,1,32,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,1,32,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,5,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,0,65,4,106,34,0,32,6,77,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,1,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,106,33,2,3,64,32,0,65,4,106,32,3,77,4,64,32,2,32,0,40,2,0,65,189,220,202,149,124,108,106,65,17,119,65,175,214,211,190,2,108,33,2,32,0,65,4,106,33,0,12,1,11,11,3,64,32,0,32,3,73,4,64,32,2,32,0,45,0,0,65,177,207,217,178,1,108,106,65,11,119,65,177,243,221,241,121,108,33,2,32,0,65,1,106,33,0,12,1,11,11,32,2,32,2,65,15,118,115,65,247,148,175,175,120,108,34,0,65,13,118,32,0,115,65,189,220,202,149,124,108,34,0,65,16,118,32,0,115,11,150,6,2,2,127,3,126,32,0,32,1,106,33,3,32,1,65,32,79,4,126,32,3,65,32,107,33,4,32,2,66,135,149,175,175,152,182,222,155,158,127,124,66,207,214,211,190,210,199,171,217,66,124,33,5,32,2,66,207,214,211,190,210,199,171,217,66,124,33,6,32,2,66,0,124,33,7,32,2,66,135,149,175,175,152,182,222,155,158,127,125,33,2,3,64,32,5,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,6,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,7,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,2,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,0,65,8,106,34,0,32,4,77,13,0,11,32,7,66,12,137,32,2,66,18,137,124,32,6,66,7,137,124,32,5,66,1,137,124,32,5,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,6,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,7,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,2,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,33,2,3,64,32,0,65,8,106,32,3,77,4,64,32,2,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,33,2,32,0,65,8,106,33,0,12,1,11,11,32,0,65,4,106,32,3,77,4,64,32,2,32,0,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,2,32,0,65,4,106,33,0,11,3,64,32,0,32,3,73,4,64,32,2,32,0,49,0,0,66,197,207,217,178,241,229,186,234,39,126,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,0,65,1,106,33,0,12,1,11,11,32,2,32,2,66,33,136,133,66,207,214,211,190,210,199,171,217,66,126,34,2,66,29,136,32,2,133,66,249,243,221,241,153,246,153,171,22,126,34,2,66,32,136,32,2,133,11,50,1,1,126,32,0,32,0,65,8,106,32,1,32,0,65,4,106,53,2,0,32,0,53,2,0,66,32,134,132,16,1,34,2,66,32,136,62,2,0,32,0,65,4,106,32,2,62,2,0,11]),n=new(require("util").TextEncoder);function e(t,n,e){if(n.buffer.byteLength<t.byteLength+e){const r=Math.ceil((t.byteLength+e-n.buffer.byteLength)/65536);n.grow(r)}new Uint8Array(n.buffer,e).set(t)}module.exports=async function(){const{instance:{exports:{mem:r,xxh32:i,xxh64:o}}}=await WebAssembly.instantiate(t);function u(t,n=0){return e(t,r,0),i(0,t.byteLength,n)>>>0}function c(t,n=0,i=0){e(t,r,8);const u=new DataView(r.buffer);return u.setUint32(0,n,!0),u.setUint32(4,i,!0),o(0,t.byteLength),u}return{h32:function(t,e=0){return u(n.encode(t),e).toString(16)},h32Raw:u,h64:function(t,e=0,r=0){const i=c(n.encode(t),e,r);return i.getUint32(0,!0).toString(16)+i.getUint32(4,!0).toString(16)},h64Raw:function(t,n=0,e=0){return new Uint8Array(c(t,n,e).buffer,0,8)}}};
//# sourceMappingURL=xxhash-wasm.js.map