Socket
Socket
Sign inDemoInstall

xxhash-wasm

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

2

cjs/xxhash-wasm.js

@@ -1,2 +0,2 @@

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

@@ -1,2 +0,2 @@

const wasmBytes=new Uint8Array([0,97,115,109,1,0,0,0,1,32,5,96,3,127,127,127,1,127,96,2,127,127,1,127,96,3,127,127,126,1,126,96,2,126,126,1,126,96,2,127,127,0,3,7,6,0,1,2,3,3,4,5,3,1,0,1,6,113,10,127,0,65,177,243,221,241,121,11,127,0,65,247,148,175,175,120,11,127,0,65,189,220,202,149,124,11,127,0,65,175,214,211,190,2,11,127,0,65,177,207,217,178,1,11,126,0,66,135,149,175,175,152,182,222,155,158,127,11,126,0,66,207,214,211,190,210,199,171,217,66,11,126,0,66,249,243,221,241,153,246,153,171,22,11,126,0,66,227,220,202,149,252,206,242,245,133,127,11,126,0,66,197,207,217,178,241,229,186,234,39,11,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,5,10,129,7,6,193,2,1,7,127,32,0,32,1,106,33,4,32,1,65,16,79,4,64,2,64,32,4,65,16,107,33,5,32,2,35,0,106,35,1,106,33,6,32,2,35,1,106,33,7,32,2,65,0,106,33,8,32,2,35,0,107,33,9,3,64,32,6,32,0,40,2,0,16,1,33,6,32,0,65,4,106,33,0,32,7,32,0,40,2,0,16,1,33,7,32,0,65,4,106,33,0,32,8,32,0,40,2,0,16,1,33,8,32,0,65,4,106,33,0,32,9,32,0,40,2,0,16,1,33,9,32,0,65,4,106,33,0,32,0,32,5,77,13,0,11,32,6,65,1,119,32,7,65,7,119,32,8,65,12,119,32,9,65,18,119,106,106,106,33,3,11,5,32,2,35,4,106,33,3,11,32,3,32,1,106,33,3,2,64,3,64,32,0,65,4,106,32,4,75,13,1,32,3,32,0,40,2,0,35,2,108,106,33,3,32,3,65,17,119,35,3,108,33,3,32,0,65,4,106,33,0,12,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,45,0,0,35,4,108,106,33,3,32,3,65,11,119,35,0,108,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,65,15,118,115,33,3,32,3,35,1,108,33,3,32,3,32,3,65,13,118,115,33,3,32,3,35,2,108,33,3,32,3,32,3,65,16,118,115,33,3,32,3,11,28,0,32,0,32,1,35,1,108,106,33,0,32,0,65,13,119,33,0,32,0,35,0,108,33,0,32,0,11,153,3,3,1,126,2,127,4,126,32,0,32,1,106,33,4,32,1,65,32,79,4,64,2,64,32,4,65,32,107,33,5,32,2,35,5,124,35,6,124,33,6,32,2,35,6,124,33,7,32,2,66,0,124,33,8,32,2,35,5,125,33,9,3,64,32,6,32,0,41,3,0,16,3,33,6,32,0,65,8,106,33,0,32,7,32,0,41,3,0,16,3,33,7,32,0,65,8,106,33,0,32,8,32,0,41,3,0,16,3,33,8,32,0,65,8,106,33,0,32,9,32,0,41,3,0,16,3,33,9,32,0,65,8,106,33,0,32,0,32,5,77,13,0,11,32,6,66,1,137,32,7,66,7,137,32,8,66,12,137,32,9,66,18,137,124,124,124,33,3,32,3,32,6,16,4,33,3,32,3,32,7,16,4,33,3,32,3,32,8,16,4,33,3,32,3,32,9,16,4,33,3,11,5,32,2,35,9,124,33,3,11,32,3,32,1,173,124,33,3,2,64,3,64,32,0,65,8,106,32,4,75,13,1,32,3,66,0,32,0,41,3,0,16,3,133,33,3,32,3,66,27,137,35,5,126,35,8,124,33,3,32,0,65,8,106,33,0,12,0,11,11,32,0,65,4,106,32,4,77,4,64,2,64,32,3,32,0,53,2,0,35,5,126,133,33,3,32,3,66,23,137,35,6,126,35,7,124,33,3,32,0,65,4,106,33,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,49,0,0,35,9,126,133,33,3,32,3,66,11,137,35,5,126,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,66,33,136,133,33,3,32,3,35,6,126,33,3,32,3,32,3,66,29,136,133,33,3,32,3,35,7,126,33,3,32,3,32,3,66,32,136,133,33,3,32,3,11,28,0,32,0,32,1,35,6,126,124,33,0,32,0,66,31,137,33,0,32,0,35,5,126,33,0,32,0,11,29,0,66,0,32,1,16,3,33,1,32,0,32,1,133,33,0,32,0,35,5,126,35,8,124,33,0,32,0,11,73,3,1,126,1,127,1,126,32,0,65,0,106,33,3,32,0,53,2,0,66,32,134,32,0,65,4,106,53,2,0,132,33,2,32,0,65,8,106,33,0,32,0,32,1,32,2,16,2,33,4,32,3,32,4,66,32,136,167,54,2,0,32,3,65,4,106,32,4,167,54,2,0,11]),encoder=new TextEncoder("utf-8");class Xxhash{constructor(){this.wasmInstance=WebAssembly.instantiate(wasmBytes).then(t=>t.instance)}async h32(t,e=0){const n=encoder.encode(t);var s=(await this.wasmInstance).exports;const r=s.mem,a=s.xxh32;return this.writeBufferToMemory(n,r,0),(a(0,n.byteLength,e)>>>0).toString(16)}async h64(t,e=0,n=0){const s=encoder.encode(t);var r=(await this.wasmInstance).exports;const a=r.mem,o=r.xxh64;this.writeBufferToMemory(s,a,8);const i=new DataView(a.buffer);return i.setUint32(0,e,!0),i.setUint32(4,n,!0),o(0,s.byteLength),i.getUint32(0,!0).toString(16)+i.getUint32(4,!0).toString(16)}writeBufferToMemory(t,e,n){if(e.buffer.byteLength<t.byteLength+n){const s=Math.ceil((t.byteLength+n-e.buffer.byteLength)/65536);e.grow(s)}new Uint8Array(e.buffer,n).set(t)}}export default Xxhash;
function t(t,e,n){if(e.buffer.byteLength<t.byteLength+n){const r=Math.ceil((t.byteLength+n-e.buffer.byteLength)/65536);e.grow(r)}new Uint8Array(e.buffer,n).set(t)}const e=new Uint8Array([0,97,115,109,1,0,0,0,1,32,5,96,3,127,127,127,1,127,96,2,127,127,1,127,96,3,127,127,126,1,126,96,2,126,126,1,126,96,2,127,127,0,3,7,6,0,1,2,3,3,4,5,3,1,0,1,6,113,10,127,0,65,177,243,221,241,121,11,127,0,65,247,148,175,175,120,11,127,0,65,189,220,202,149,124,11,127,0,65,175,214,211,190,2,11,127,0,65,177,207,217,178,1,11,126,0,66,135,149,175,175,152,182,222,155,158,127,11,126,0,66,207,214,211,190,210,199,171,217,66,11,126,0,66,249,243,221,241,153,246,153,171,22,11,126,0,66,227,220,202,149,252,206,242,245,133,127,11,126,0,66,197,207,217,178,241,229,186,234,39,11,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,5,10,129,7,6,193,2,1,7,127,32,0,32,1,106,33,4,32,1,65,16,79,4,64,2,64,32,4,65,16,107,33,5,32,2,35,0,106,35,1,106,33,6,32,2,35,1,106,33,7,32,2,65,0,106,33,8,32,2,35,0,107,33,9,3,64,32,6,32,0,40,2,0,16,1,33,6,32,0,65,4,106,33,0,32,7,32,0,40,2,0,16,1,33,7,32,0,65,4,106,33,0,32,8,32,0,40,2,0,16,1,33,8,32,0,65,4,106,33,0,32,9,32,0,40,2,0,16,1,33,9,32,0,65,4,106,33,0,32,0,32,5,77,13,0,11,32,6,65,1,119,32,7,65,7,119,32,8,65,12,119,32,9,65,18,119,106,106,106,33,3,11,5,32,2,35,4,106,33,3,11,32,3,32,1,106,33,3,2,64,3,64,32,0,65,4,106,32,4,75,13,1,32,3,32,0,40,2,0,35,2,108,106,33,3,32,3,65,17,119,35,3,108,33,3,32,0,65,4,106,33,0,12,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,45,0,0,35,4,108,106,33,3,32,3,65,11,119,35,0,108,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,65,15,118,115,33,3,32,3,35,1,108,33,3,32,3,32,3,65,13,118,115,33,3,32,3,35,2,108,33,3,32,3,32,3,65,16,118,115,33,3,32,3,11,28,0,32,0,32,1,35,1,108,106,33,0,32,0,65,13,119,33,0,32,0,35,0,108,33,0,32,0,11,153,3,3,1,126,2,127,4,126,32,0,32,1,106,33,4,32,1,65,32,79,4,64,2,64,32,4,65,32,107,33,5,32,2,35,5,124,35,6,124,33,6,32,2,35,6,124,33,7,32,2,66,0,124,33,8,32,2,35,5,125,33,9,3,64,32,6,32,0,41,3,0,16,3,33,6,32,0,65,8,106,33,0,32,7,32,0,41,3,0,16,3,33,7,32,0,65,8,106,33,0,32,8,32,0,41,3,0,16,3,33,8,32,0,65,8,106,33,0,32,9,32,0,41,3,0,16,3,33,9,32,0,65,8,106,33,0,32,0,32,5,77,13,0,11,32,6,66,1,137,32,7,66,7,137,32,8,66,12,137,32,9,66,18,137,124,124,124,33,3,32,3,32,6,16,4,33,3,32,3,32,7,16,4,33,3,32,3,32,8,16,4,33,3,32,3,32,9,16,4,33,3,11,5,32,2,35,9,124,33,3,11,32,3,32,1,173,124,33,3,2,64,3,64,32,0,65,8,106,32,4,75,13,1,32,3,66,0,32,0,41,3,0,16,3,133,33,3,32,3,66,27,137,35,5,126,35,8,124,33,3,32,0,65,8,106,33,0,12,0,11,11,32,0,65,4,106,32,4,77,4,64,2,64,32,3,32,0,53,2,0,35,5,126,133,33,3,32,3,66,23,137,35,6,126,35,7,124,33,3,32,0,65,4,106,33,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,49,0,0,35,9,126,133,33,3,32,3,66,11,137,35,5,126,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,66,33,136,133,33,3,32,3,35,6,126,33,3,32,3,32,3,66,29,136,133,33,3,32,3,35,7,126,33,3,32,3,32,3,66,32,136,133,33,3,32,3,11,28,0,32,0,32,1,35,6,126,124,33,0,32,0,66,31,137,33,0,32,0,35,5,126,33,0,32,0,11,29,0,66,0,32,1,16,3,33,1,32,0,32,1,133,33,0,32,0,35,5,126,35,8,124,33,0,32,0,11,73,3,1,126,1,127,1,126,32,0,65,0,106,33,3,32,0,53,2,0,66,32,134,32,0,65,4,106,53,2,0,132,33,2,32,0,65,8,106,33,0,32,0,32,1,32,2,16,2,33,4,32,3,32,4,66,32,136,167,54,2,0,32,3,65,4,106,32,4,167,54,2,0,11]),n=new TextEncoder("utf-8");export default async function(){var r=(await WebAssembly.instantiate(e)).instance.exports;const i=r.mem,o=r.xxh32,s=r.xxh64;return{h32(e,r=0){const s=n.encode(e);return t(s,i,0),(o(0,s.byteLength,r)>>>0).toString(16)},h64(e,r=0,o=0){const c=n.encode(e);t(c,i,8);const a=new DataView(i.buffer);return a.setUint32(0,r,!0),a.setUint32(4,o,!0),s(0,c.byteLength),a.getUint32(0,!0).toString(16)+a.getUint32(4,!0).toString(16)}}};
//# sourceMappingURL=xxhash-wasm.js.map
{
"name": "xxhash-wasm",
"version": "0.2.0",
"version": "0.3.0",
"description": "A WebAssembly implementation of xxHash",

@@ -5,0 +5,0 @@ "main": "cjs/xxhash-wasm.js",

@@ -29,3 +29,3 @@ # xxhash-wasm

<script type="module">
import Xxhash from "https://unpkg.com/xxhash-wasm/esm/xxhash-wasm.js";
import xxhash from "https://unpkg.com/xxhash-wasm/esm/xxhash-wasm.js";
</script>

@@ -40,3 +40,3 @@ ```

The global `Xxhash` will be available.
The global `xxhash` will be available.

@@ -49,12 +49,25 @@ ## Usage

```javascript
import Xxhash from "xxhash-wasm";
import xxhash from "xxhash-wasm";
// Creates the WebAssembly instance.
const xxhash = new Xxhash();
xxhash().then(hasher => {
const input = "The string that is being hashed";
// 32-bit version
hasher.h32(input); // ee563564
// 64-bit version
hasher.h64(input); // 502b0c5fc4a5704c
});
```
Or with `async`/`await` and destructuring:
```javascript
// Creates the WebAssembly instance.
const { h32, h64 } = await xxhash();
const input = "The string that is being hashed";
// 32-bit version
xxhash.h32(input).then(h32 => console.log(h32)); // ee563564
h32(input); // ee563564
// 64-bit version
xxhash.h64(input).then(h64 => console.log(h64)); // 502b0c5fc4a5704c
h64(input); // 502b0c5fc4a5704c
```

@@ -78,6 +91,6 @@

```javascript
const Xxhash = require("xxhash-wasm");
const xxhash = require("xxhash-wasm");
// Or explicitly use the cjs bundle
const Xxhash = require("xxhash-wasm/cjs/xxhash-wasm");
const xxhash = require("xxhash-wasm/cjs/xxhash-wasm");
```

@@ -92,7 +105,7 @@

`const xxhash = new Xxhash()`
`const { h32, h64 } = await xxhash()`
Create a WebAssembly instance.
`xxhash.h32(input: string, [seed: u32]): Promise<string>`
`h32(input: string, [seed: u32]): string`

@@ -103,6 +116,5 @@ Generate a 32-bit hash of `input`. The optional `seed` is a `u32` and any number

The returned promise resolves with the string of the hash
in hexadecimal.
Returns a string of the hash in hexadecimal.
`xxhash.h64(input: string, [seedHigh: u32, seedLow: u32]): Promise<string>`
`h64(input: string, [seedHigh: u32, seedLow: u32]): string`

@@ -128,3 +140,3 @@ Generate a 64-bit hash of `input`. Because JavaScript doesn't support `u64` the

The returned promise resolves with the string of the hash in hexadecimal.
Returns a string of the hash in hexadecimal.

@@ -131,0 +143,0 @@ [npm-badge]: https://img.shields.io/npm/v/xxhash-wasm.svg?style=flat-square

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Xxhash=e()}(this,function(){"use strict";const t=new Uint8Array([0,97,115,109,1,0,0,0,1,32,5,96,3,127,127,127,1,127,96,2,127,127,1,127,96,3,127,127,126,1,126,96,2,126,126,1,126,96,2,127,127,0,3,7,6,0,1,2,3,3,4,5,3,1,0,1,6,113,10,127,0,65,177,243,221,241,121,11,127,0,65,247,148,175,175,120,11,127,0,65,189,220,202,149,124,11,127,0,65,175,214,211,190,2,11,127,0,65,177,207,217,178,1,11,126,0,66,135,149,175,175,152,182,222,155,158,127,11,126,0,66,207,214,211,190,210,199,171,217,66,11,126,0,66,249,243,221,241,153,246,153,171,22,11,126,0,66,227,220,202,149,252,206,242,245,133,127,11,126,0,66,197,207,217,178,241,229,186,234,39,11,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,5,10,129,7,6,193,2,1,7,127,32,0,32,1,106,33,4,32,1,65,16,79,4,64,2,64,32,4,65,16,107,33,5,32,2,35,0,106,35,1,106,33,6,32,2,35,1,106,33,7,32,2,65,0,106,33,8,32,2,35,0,107,33,9,3,64,32,6,32,0,40,2,0,16,1,33,6,32,0,65,4,106,33,0,32,7,32,0,40,2,0,16,1,33,7,32,0,65,4,106,33,0,32,8,32,0,40,2,0,16,1,33,8,32,0,65,4,106,33,0,32,9,32,0,40,2,0,16,1,33,9,32,0,65,4,106,33,0,32,0,32,5,77,13,0,11,32,6,65,1,119,32,7,65,7,119,32,8,65,12,119,32,9,65,18,119,106,106,106,33,3,11,5,32,2,35,4,106,33,3,11,32,3,32,1,106,33,3,2,64,3,64,32,0,65,4,106,32,4,75,13,1,32,3,32,0,40,2,0,35,2,108,106,33,3,32,3,65,17,119,35,3,108,33,3,32,0,65,4,106,33,0,12,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,45,0,0,35,4,108,106,33,3,32,3,65,11,119,35,0,108,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,65,15,118,115,33,3,32,3,35,1,108,33,3,32,3,32,3,65,13,118,115,33,3,32,3,35,2,108,33,3,32,3,32,3,65,16,118,115,33,3,32,3,11,28,0,32,0,32,1,35,1,108,106,33,0,32,0,65,13,119,33,0,32,0,35,0,108,33,0,32,0,11,153,3,3,1,126,2,127,4,126,32,0,32,1,106,33,4,32,1,65,32,79,4,64,2,64,32,4,65,32,107,33,5,32,2,35,5,124,35,6,124,33,6,32,2,35,6,124,33,7,32,2,66,0,124,33,8,32,2,35,5,125,33,9,3,64,32,6,32,0,41,3,0,16,3,33,6,32,0,65,8,106,33,0,32,7,32,0,41,3,0,16,3,33,7,32,0,65,8,106,33,0,32,8,32,0,41,3,0,16,3,33,8,32,0,65,8,106,33,0,32,9,32,0,41,3,0,16,3,33,9,32,0,65,8,106,33,0,32,0,32,5,77,13,0,11,32,6,66,1,137,32,7,66,7,137,32,8,66,12,137,32,9,66,18,137,124,124,124,33,3,32,3,32,6,16,4,33,3,32,3,32,7,16,4,33,3,32,3,32,8,16,4,33,3,32,3,32,9,16,4,33,3,11,5,32,2,35,9,124,33,3,11,32,3,32,1,173,124,33,3,2,64,3,64,32,0,65,8,106,32,4,75,13,1,32,3,66,0,32,0,41,3,0,16,3,133,33,3,32,3,66,27,137,35,5,126,35,8,124,33,3,32,0,65,8,106,33,0,12,0,11,11,32,0,65,4,106,32,4,77,4,64,2,64,32,3,32,0,53,2,0,35,5,126,133,33,3,32,3,66,23,137,35,6,126,35,7,124,33,3,32,0,65,4,106,33,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,49,0,0,35,9,126,133,33,3,32,3,66,11,137,35,5,126,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,66,33,136,133,33,3,32,3,35,6,126,33,3,32,3,32,3,66,29,136,133,33,3,32,3,35,7,126,33,3,32,3,32,3,66,32,136,133,33,3,32,3,11,28,0,32,0,32,1,35,6,126,124,33,0,32,0,66,31,137,33,0,32,0,35,5,126,33,0,32,0,11,29,0,66,0,32,1,16,3,33,1,32,0,32,1,133,33,0,32,0,35,5,126,35,8,124,33,0,32,0,11,73,3,1,126,1,127,1,126,32,0,65,0,106,33,3,32,0,53,2,0,66,32,134,32,0,65,4,106,53,2,0,132,33,2,32,0,65,8,106,33,0,32,0,32,1,32,2,16,2,33,4,32,3,32,4,66,32,136,167,54,2,0,32,3,65,4,106,32,4,167,54,2,0,11]),e=new TextEncoder("utf-8");class n{constructor(){this.wasmInstance=WebAssembly.instantiate(t).then(t=>t.instance)}async h32(t,n=0){const s=e.encode(t);var r=(await this.wasmInstance).exports;const o=r.mem,i=r.xxh32;return this.writeBufferToMemory(s,o,0),(i(0,s.byteLength,n)>>>0).toString(16)}async h64(t,n=0,s=0){const r=e.encode(t);var o=(await this.wasmInstance).exports;const i=o.mem,f=o.xxh64;this.writeBufferToMemory(r,i,8);const a=new DataView(i.buffer);return a.setUint32(0,n,!0),a.setUint32(4,s,!0),f(0,r.byteLength),a.getUint32(0,!0).toString(16)+a.getUint32(4,!0).toString(16)}writeBufferToMemory(t,e,n){if(e.buffer.byteLength<t.byteLength+n){const s=Math.ceil((t.byteLength+n-e.buffer.byteLength)/65536);e.grow(s)}new Uint8Array(e.buffer,n).set(t)}}return n});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.xxhash=e()}(this,function(){"use strict";function t(t,e,n){if(e.buffer.byteLength<t.byteLength+n){const i=Math.ceil((t.byteLength+n-e.buffer.byteLength)/65536);e.grow(i)}new Uint8Array(e.buffer,n).set(t)}const e=new Uint8Array([0,97,115,109,1,0,0,0,1,32,5,96,3,127,127,127,1,127,96,2,127,127,1,127,96,3,127,127,126,1,126,96,2,126,126,1,126,96,2,127,127,0,3,7,6,0,1,2,3,3,4,5,3,1,0,1,6,113,10,127,0,65,177,243,221,241,121,11,127,0,65,247,148,175,175,120,11,127,0,65,189,220,202,149,124,11,127,0,65,175,214,211,190,2,11,127,0,65,177,207,217,178,1,11,126,0,66,135,149,175,175,152,182,222,155,158,127,11,126,0,66,207,214,211,190,210,199,171,217,66,11,126,0,66,249,243,221,241,153,246,153,171,22,11,126,0,66,227,220,202,149,252,206,242,245,133,127,11,126,0,66,197,207,217,178,241,229,186,234,39,11,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,5,10,129,7,6,193,2,1,7,127,32,0,32,1,106,33,4,32,1,65,16,79,4,64,2,64,32,4,65,16,107,33,5,32,2,35,0,106,35,1,106,33,6,32,2,35,1,106,33,7,32,2,65,0,106,33,8,32,2,35,0,107,33,9,3,64,32,6,32,0,40,2,0,16,1,33,6,32,0,65,4,106,33,0,32,7,32,0,40,2,0,16,1,33,7,32,0,65,4,106,33,0,32,8,32,0,40,2,0,16,1,33,8,32,0,65,4,106,33,0,32,9,32,0,40,2,0,16,1,33,9,32,0,65,4,106,33,0,32,0,32,5,77,13,0,11,32,6,65,1,119,32,7,65,7,119,32,8,65,12,119,32,9,65,18,119,106,106,106,33,3,11,5,32,2,35,4,106,33,3,11,32,3,32,1,106,33,3,2,64,3,64,32,0,65,4,106,32,4,75,13,1,32,3,32,0,40,2,0,35,2,108,106,33,3,32,3,65,17,119,35,3,108,33,3,32,0,65,4,106,33,0,12,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,45,0,0,35,4,108,106,33,3,32,3,65,11,119,35,0,108,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,65,15,118,115,33,3,32,3,35,1,108,33,3,32,3,32,3,65,13,118,115,33,3,32,3,35,2,108,33,3,32,3,32,3,65,16,118,115,33,3,32,3,11,28,0,32,0,32,1,35,1,108,106,33,0,32,0,65,13,119,33,0,32,0,35,0,108,33,0,32,0,11,153,3,3,1,126,2,127,4,126,32,0,32,1,106,33,4,32,1,65,32,79,4,64,2,64,32,4,65,32,107,33,5,32,2,35,5,124,35,6,124,33,6,32,2,35,6,124,33,7,32,2,66,0,124,33,8,32,2,35,5,125,33,9,3,64,32,6,32,0,41,3,0,16,3,33,6,32,0,65,8,106,33,0,32,7,32,0,41,3,0,16,3,33,7,32,0,65,8,106,33,0,32,8,32,0,41,3,0,16,3,33,8,32,0,65,8,106,33,0,32,9,32,0,41,3,0,16,3,33,9,32,0,65,8,106,33,0,32,0,32,5,77,13,0,11,32,6,66,1,137,32,7,66,7,137,32,8,66,12,137,32,9,66,18,137,124,124,124,33,3,32,3,32,6,16,4,33,3,32,3,32,7,16,4,33,3,32,3,32,8,16,4,33,3,32,3,32,9,16,4,33,3,11,5,32,2,35,9,124,33,3,11,32,3,32,1,173,124,33,3,2,64,3,64,32,0,65,8,106,32,4,75,13,1,32,3,66,0,32,0,41,3,0,16,3,133,33,3,32,3,66,27,137,35,5,126,35,8,124,33,3,32,0,65,8,106,33,0,12,0,11,11,32,0,65,4,106,32,4,77,4,64,2,64,32,3,32,0,53,2,0,35,5,126,133,33,3,32,3,66,23,137,35,6,126,35,7,124,33,3,32,0,65,4,106,33,0,11,11,2,64,3,64,32,0,32,4,79,13,1,32,3,32,0,49,0,0,35,9,126,133,33,3,32,3,66,11,137,35,5,126,33,3,32,0,65,1,106,33,0,12,0,11,11,32,3,32,3,66,33,136,133,33,3,32,3,35,6,126,33,3,32,3,32,3,66,29,136,133,33,3,32,3,35,7,126,33,3,32,3,32,3,66,32,136,133,33,3,32,3,11,28,0,32,0,32,1,35,6,126,124,33,0,32,0,66,31,137,33,0,32,0,35,5,126,33,0,32,0,11,29,0,66,0,32,1,16,3,33,1,32,0,32,1,133,33,0,32,0,35,5,126,35,8,124,33,0,32,0,11,73,3,1,126,1,127,1,126,32,0,65,0,106,33,3,32,0,53,2,0,66,32,134,32,0,65,4,106,53,2,0,132,33,2,32,0,65,8,106,33,0,32,0,32,1,32,2,16,2,33,4,32,3,32,4,66,32,136,167,54,2,0,32,3,65,4,106,32,4,167,54,2,0,11]),n=new TextEncoder("utf-8");return async function(){var i=(await WebAssembly.instantiate(e)).instance.exports;const o=i.mem,r=i.xxh32,f=i.xxh64;return{h32(e,i=0){const f=n.encode(e);return t(f,o,0),(r(0,f.byteLength,i)>>>0).toString(16)},h64(e,i=0,r=0){const s=n.encode(e);t(s,o,8);const c=new DataView(o.buffer);return c.setUint32(0,i,!0),c.setUint32(4,r,!0),f(0,s.byteLength),c.getUint32(0,!0).toString(16)+c.getUint32(4,!0).toString(16)}}}});
//# sourceMappingURL=xxhash-wasm.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc