1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-11 02:46:12 -05:00
sdrangel/plugins/feature/map/Cesium/ThirdParty/Workers/z-worker-pako.js

1 line
13 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
!function(){"use strict";const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}class e{constructor(t){this.crc=t||-1}append(e){let n=0|this.crc;for(let s=0,r=0|e.length;s<r;s++)n=n>>>8^t[255&(n^e[s])];this.crc=n}get(){return~this.crc}}const n={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const s=t[t.length-1],r=n.getPartial(s);return 32===r?t.concat(e):n._shiftRight(e,r,0|s,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const s=t[e-1];return 32*(e-1)+n.getPartial(s)},clamp(t,e){if(32*t.length<e)return t;const s=(t=t.slice(0,Math.ceil(e/32))).length;return e&=31,s>0&&e&&(t[s-1]=n.partial(e,t[s-1]&2147483648>>e-1,1)),t},partial:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,getPartial:t=>Math.round(t/1099511627776)||32,_shiftRight(t,e,s,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(s),s=0;if(0===e)return r.concat(t);for(let n=0;n<t.length;n++)r.push(s|t[n]>>>e),s=t[n]<<32-e;const a=t.length?t[t.length-1]:0,i=n.getPartial(a);return r.push(n.partial(e+i&31,e+i>32?s:r.pop(),1)),r}},s={bytes:{fromBits(t){const e=n.bitLength(t)/8,s=new Uint8Array(e);let r;for(let n=0;n<e;n++)0==(3&n)&&(r=t[n/4]),s[n]=r>>>24,r<<=8;return s},toBits(t){const e=[];let s,r=0;for(s=0;s<t.length;s++)r=r<<8|t[s],3==(3&s)&&(e.push(r),r=0);return 3&s&&e.push(n.partial(8*(3&s),r)),e}}},r={sha1:function(t){t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()}};r.sha1.prototype={blockSize:512,reset:function(){const t=this;return t._h=this._init.slice(0),t._buffer=[],t._length=0,t},update:function(t){const e=this;"string"==typeof t&&(t=s.utf8String.toBits(t));const r=e._buffer=n.concat(e._buffer,t),a=e._length,i=e._length=a+n.bitLength(t);if(i>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const c=new Uint32Array(r);let o=0;for(let t=e.blockSize+a-(e.blockSize+a&e.blockSize-1);t<=i;t+=e.blockSize)e._block(c.subarray(16*o,16*(o+1))),o+=1;return r.splice(0,16*o),e},finalize:function(){const t=this;let e=t._buffer;const s=t._h;e=n.concat(e,[n.partial(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(Math.floor(t._length/4294967296)),e.push(0|t._length);e.length;)t._block(e.splice(0,16));return t.reset(),s},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(t,e,n,s){return t<=19?e&n|~e&s:t<=39?e^n^s:t<=59?e&n|e&s|n&s:t<=79?e^n^s:void 0},_S:function(t,e){return e<<t|e>>>32-t},_block:function(t){const e=this,n=e._h,s=Array(80);for(let e=0;e<16;e++)s[e]=t[e];let r=n[0],a=n[1],i=n[2],c=n[3],o=n[4];for(let t=0;t<=79;t++){t>=16&&(s[t]=e._S(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const n=e._S(5,r)+e._f(t,a,i,c)+o+s[t]+e._key[Math.floor(t/20)]|0;o=c,c=i,i=e._S(30,a),a=r,r=n}n[0]=n[0]+r|0,n[1]=n[1]+a|0,n[2]=n[2]+i|0,n[3]=n[3]+c|0,n[4]=n[4]+o|0}};const a=class{constructor(t){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const n=e._tables[0][4],s=e._tables[1],r=t.length;let a,i,c,o=1;if(4!==r&&6!==r&&8!==r)throw new Error("invalid aes key size");for(e._key=[i=t.slice(0),c=[]],a=r;a<4*r+28;a++){let t=i[a-1];(a%r==0||8===r&&a%r==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],a%r==0&&(t=t<<8^t>>>24^o<<24,o=o<<1^283*(o>>7))),i[a]=i[a-r]^t}for(let t=0;a;t++,a--){const e=i[3&t?a:a-4];c[t]=a<=4||t<4?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this._crypt(t,0)}decrypt(t){return this._crypt(t,1)}_precompute(){const t=this._tables[0],e=this._tables[1],n=t[4],s=e[4],r=[],a=[];let i,c,o,l;for(let t=0;t<256;t++)a[(r[t]=t<<1^283*(t>>7))^t]=t;for(let h=i=0;!n[h];h^=c||1,i=a[i]||1){let a=i^i<<1^i<<2^i<<3^i<<4;a=a>>8^255&a^99,n[h]=a,s[a]=h,l=r[o=r[c=r[h]]];let p=16843009*l^65537*o^257*c^16843008*h,u=257*r[a]^16843008*a;for(let n=0;n<4;n++)t[n][h]=u=u<<24^u>>>8,e[n][a]=p=p<<24^p>>>8}for(let n=0;n<5;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}_crypt(t,e){if(4!==t.length)throw new Error("invalid aes block size");const n=this._key[e],s=n.length/4-2,r=[0,0,0,0],a