tweb/public/6b540956a47ff257d3ee.worker.js

7 lines
77 KiB
JavaScript
Raw Normal View History

2020-02-06 16:43:07 +01:00
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{f(n.next(t))}catch(t){o(t)}}function a(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(r(4)),s=r(5),a=r(2),f=i(r(6)),h=r(1);function u(t){var e=s.bigInt2str(t,16);return h.bytesFromHex(e)}function c(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var e,r=t.length,n=[];for(e=0;e<r;e++)n[e>>>2]|=t[e]<<24-e%4*8;return new f.default.lib.WordArray.init(n,r)}function l(t){var e,r,n,i,o,a,f=Math.ceil(64/s.bpe)+1,c=0,l=new Array(f),d=new Array(f),p=new Array(f),g=new Array(f),v=new Array(f),y=new Array(f),m=new Array(f);for(e=0;e<3;e++){for(r=17+(15&h.nextRandomInt(128)),s.copyInt_(y,h.nextRandomInt(1e9)+1),s.copy_(m,y),i=1<<e+18,n=1;n<i;n++){for(++c,s.copy_(l,y),s.copy_(d,y),s.copyInt_(p,r);!s.isZero(d);)1&d[0]&&(s.add_(p,l),s.greater(p,t)&&s.sub_(p,t)),s.add_(l,l),s.greater(l,t)&&s.sub_(l,t),s.rightShift_(d,1);if(s.copy_(y,p),s.greater(y,m)?(s.copy_(v,y),s.sub_(v,m)):(s.copy_(v,m),s.sub_(v,y)),s.eGCD_(v,t,g,l,d),!s.equalsInt(g,1))break;0==(n&n-1)&&s.copy_(m,y)}if(s.greater(g,s.one))break}return s.divide_(t,g,y,m),s.greater(g,y)?(o=y,a=g):(o=g,a=y),[u(o),u(a),c]}e.bytesFromLeemonBigInt=u,e.bytesToWords=c,e.sha1HashSync=function(t){const e=[];let r=o.default(String.fromCharCode.apply(null,t instanceof Uint8Array?[...t]:[...new Uint8Array(t)]));for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t));return new Uint8Array(e)},e.sha256HashSync=function(t){var e=f.default.SHA256(c(t));return h.bytesFromWords(e)},e.aesEncryptSync=function(t,e,r,n="IGE"){t=h.addPadding(t);let i=f.default.mode[n],o=f.default.AES.encrypt(c(t),c(e),{iv:c(r),padding:f.default.pad.NoPadding,mode:i}).ciphertext;return h.bytesFromWords(o)},e.aesDecryptSync=function(t,e,r,n="IGE"){let i=f.default.mode[n];var o=f.default.AES.decrypt({ciphertext:c(t)},c(e),{iv:c(r),padding:f.default.pad.NoPadding,mode:i});return h.bytesFromWords(o)},e.rsaEncrypt=function(t,e){console.log(h.dT(),"RSA encrypt start",t,e),e=h.addPadding(e,255);var r=s.str2bigInt(t.modulus,16),n=s.str2bigInt(t.exponent,16),i=s.str2bigInt(h.bytesToHex(e),16),o=s.powMod(i,n,r),a=h.bytesFromHex(s.bigInt2str(o,16));return console.log(h.dT(),"RSA encrypt finish"),a},e.hash_pbkdf2=function(t,e,r){return n(this,void 0,void 0,(function*(){let n="undefined"!=typeof window&&"crypto"in window?window.crypto.subtle:self.crypto.subtle,i=yield n.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);return yield n.deriveKey({name:"PBKDF2",salt:e,iterations:r,hash:{name:"SHA-512"}},i,{name:"AES-CTR",length:256},!1,["encrypt","decrypt"]),n.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:"SHA-512"}},i,512)}))},e.pqPrimeFactorization=function(t){var e=new a.BigInteger(t),r=!1;console.log(h.dT(),"PQ start",t,e.toString(16),e.bitLength());try{console.time("PQ leemon"),r=l(s.str2bigInt(e.toString(16),16,Math.ceil(6
/*!
* Webogram v0.7.0 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=r(2),o=n(r(7));var s=(new Date).getTime();function a(t){return new i.BigInteger(t.toString(16),16)}function f(t){return new i.BigInteger(t,10)}function h(t){return t<26?t+65:t<52?t+71:t<62?t-4:62===t?43:63===t?47:65}function u(t,e){for(var r=atob(t),n=r.length,i=Math.ceil(n/1024),o=new Array(i),s=0;s<i;++s){for(var a=1024*s,f=Math.min(a+1024,n),h=new Array(f-a),u=a,l=0;u<f;++l,++u)h[l]=r[u].charCodeAt(0);o[s]=new Uint8Array(h)}return c(o,e)}function c(t,e=""){var r,n=l(e);try{r=new Blob(t,{type:n})}catch(e){var i=new BlobBuilder;t.forEach((function(t){i.append(t)})),r=i.getBlob(n)}return r}function l(t){return-1===["image/jpeg","image/png","image/gif","image/webp","image/bmp","video/mp4","video/webm","video/quicktime","audio/ogg","audio/mpeg","audio/mp4"].indexOf(t)?"application/octet-stream":t}function d(t){return new Uint8Array(t).buffer}function p(t){return void 0!==t.buffer?t:new Uint8Array(t)}function g(t,e){var r=t.byteLength||t.length,n=e.byteLength||e.length,i=new Uint8Array(r+n);return i.set(t instanceof ArrayBuffer?new Uint8Array(t):t,0),i.set(e instanceof ArrayBuffer?new Uint8Array(e):e,r),i.buffer}function v(t){var e=f(t).divideAndRemainder(a(4294967296));return[e[0].intValue(),e[1].intValue()]}function y(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++)n.push(e[i>>>2]>>>24-i%4*8&255);return n}e.dT=function(){return"["+(((new Date).getTime()-s)/1e3).toFixed(3)+"]"},e.bigint=a,e.bigStringInt=f,e.bytesToHex=function(t){t=t||[];for(var e=[],r=0;r<t.length;r++)e.push((t[r]<16?"0":"")+(t[r]||0).toString(16));return e.join("")},e.bytesFromHex=function(t){var e,r=t.length,n=0,i=[];for(t.length%2&&(i.push(parseInt(t.charAt(0),16)),n++),e=n;e<r;e+=2)i.push(parseInt(t.substr(e,2),16));return i},e.bytesToBase64=function(t){for(var e,r="",n=t.length,i=0,o=0;o<n;o++)e=o%3,i|=t[o]<<(16>>>e&24),2!==e&&n-o!=1||(r+=String.fromCharCode(h(i>>>18&63),h(i>>>12&63),h(i>>>6&63),h(63&i)),i=0);return r.replace(/A(?=A$|$)/g,"=")},e.uint6ToBase64=h,e.base64ToBlob=u,e.dataUrlToBlob=function(t){var e=t.split(",");return u(e[1],e[0].split(":")[1].split(";")[0])},e.blobConstruct=c,e.blobSafeMimeType=l,e.bytesCmp=function(t,e){var r=t.length;if(r!=e.length)return!1;for(var n=0;n<r;n++)if(t[n]!=e[n])return!1;return!0},e.bytesXor=function(t,e){for(var r=t.length,n=[],i=0;i<r;++i)n[i]=t[i]^e[i];return n},e.bytesFromBigInt=function(t,e){var r=t.toByteArray();if(e&&r.length<e){for(var n=[],i=0,o=e-r.length;i<o;i++)n[i]=0;r=r instanceof ArrayBuffer?g(n,r):n.concat(r)}else for(;!r[0]&&(!e||r.length>e);)r=r.slice(1);return r},e.bytesToArrayBuffer=d,e.convertToArrayBuffer=function(t){return t instanceof ArrayBuffer?t:void 0!==t.buffer&&t.buffer.byteLength==t.length*t.BYTES_PER_ELEMENT?t.buffer:d(t)},e.convertToUint8Array=p,e.convertToByteArray=function(t){if(Array.isArray(t))return t;for(var e=[],r=0,n=(t=p(t)).length;r<n;r++)e.push(t[r]);return e},e.bytesFromArrayBuffer=function(t){for(var e=t.byteLength,r=new Uint8Array(t),n=[],i=0;i<e;++i)n[i]=r[i];return n},e.bufferConcat=g,e.bufferConcats=function(...t){let e=0;t.forEach(t=>e+=t.byteLength||t.length);var r=new Uint8Array(e);let n=0;return t.forEach(t=>{r.set(t instanceof ArrayBuffer?new Uint8Array(t):t,n),n+=t.byteLength||t.length}),r},e.longToInts=v,e.bytesFromWords=y,e.longToBytes=function(t){return y({words:v(t),sigBytes:8}).reverse()},e.longFromInts=function(t,e){return a(t).shiftLeft(32).add(a(e)).toString(10)},e.intToUint=function(t){return"string"==typeof t&&(t=parseInt(t)),t<0&&(t+=4294967296),t},e.uintToInt=function(t){return t>2147483647&&(t-=4294967296),t},e.addPadding=function(t,e=16,r,n=!1,o=!1){let s=t.byteLength||t.length,a=e-s%e;if(a>0&&(a<e||n)){console.log("addPadding()",s,e,a);let n=new Array(a);if(r)for(let t=0;t<a;t++)n[t]=0;else(new i.SecureRandom).nextBytes(n);if(t instanceof ArrayBuffer)t=o?g(n,t):g(t,n);else if(t instanceof Uint8Array){let e=new Uint8Array(t.length+n.length);o?(e.set(n),e.set(t,n.length)):(e.set(t),e.set(n,t.