mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 10:47:04 +01:00
3 lines
87 KiB
JavaScript
3 lines
87 KiB
JavaScript
|
/*! For license information please see 592.d7ca037ed9b7d1c6792a.js.LICENSE.txt */
|
||
|
(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[592],{8136:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>w,CTR:()=>v,IGE:()=>g});var n=new Uint8Array(256),o=new Uint8Array(256),i=new Uint32Array(256),s=new Uint32Array(256),a=new Uint32Array(256),u=new Uint32Array(256),f=new Uint32Array(256),l=new Uint32Array(256),c=new Uint32Array(256),h=new Uint32Array(256);function p(t){if(t instanceof Uint32Array)return t;if("string"==typeof t){if(t.length%4!=0)for(var e=t.length%4;e<=4;e++)t+="\0x00";var r=new Uint32Array(t.length/4);for(e=0;e<t.length;e+=4)r[e/4]=(o=e,(n=t).charCodeAt(o)<<24^n.charCodeAt(o+1)<<16^n.charCodeAt(o+2)<<8^n.charCodeAt(o+3));return r}var n,o;if(t instanceof Uint8Array){for(r=new Uint32Array(t.length/4),e=0;e<t.length;e+=4)r[e/4]=t[e]<<24^t[e+1]<<16^t[e+2]<<8^t[e+3];return r}throw new Error("Unable to create 32-bit words")}function y(t,e,r){void 0===r&&(r=t);for(var n=0;n<t.length;n++)r[n]=t[n]^e[n]}!function(){for(var t,e,r,p,y,d=new Uint8Array(256),g=new Uint8Array(256),v=0,w=0,b=0;b<256;b++)d[b]=b<<1^283*(b>>7),g[d[b]^b]=b;for(;!n[v];v^=t||1)r=(r=w^w<<1^w<<2^w<<3^w<<4)>>8^255&r^99,n[v]=r,o[r]=v,y=16843009*d[e=d[t=d[v]]]^65537*e^257*t^16843008*v,p=257*d[r]^16843008*r,i[v]=p=p<<24^p>>>8,s[v]=p=p<<24^p>>>8,a[v]=p=p<<24^p>>>8,u[v]=p=p<<24^p>>>8,f[r]=y=y<<24^y>>>8,l[r]=y=y<<24^y>>>8,c[r]=y=y<<24^y>>>8,h[r]=y=y<<24^y>>>8,w=g[w]||1}();var d=function(){function t(t){var e=p(t);if(4!==e.length&&6!==e.length&&8!==e.length)throw new Error("Invalid key size");this.encKey=new Uint32Array(4*e.length+28),this.decKey=new Uint32Array(4*e.length+28),this.encKey.set(e);for(var r,o=1,i=e.length;i<4*e.length+28;i++)r=this.encKey[i-1],(i%e.length==0||8===e.length&&i%e.length==4)&&(r=n[r>>>24]<<24^n[r>>16&255]<<16^n[r>>8&255]<<8^n[255&r],i%e.length==0&&(r=r<<8^r>>>24^o<<24,o=o<<1^283*(o>>7))),this.encKey[i]=this.encKey[i-e.length]^r;for(var s=0;i;s++,i--)r=this.encKey[3&s?i:i-4],this.decKey[s]=i<=4||s<4?r:f[n[r>>>24]]^l[n[r>>16&255]]^c[n[r>>8&255]]^h[n[255&r]]}return t.prototype.encrypt=function(t){for(var e,r,o,f=p(t),l=new Uint32Array(4),c=f[0]^this.encKey[0],h=f[1]^this.encKey[1],y=f[2]^this.encKey[2],d=f[3]^this.encKey[3],g=this.encKey.length/4-2,v=4,w=0;w<g;w++)e=i[c>>>24]^s[h>>16&255]^a[y>>8&255]^u[255&d]^this.encKey[v],r=i[h>>>24]^s[y>>16&255]^a[d>>8&255]^u[255&c]^this.encKey[v+1],o=i[y>>>24]^s[d>>16&255]^a[c>>8&255]^u[255&h]^this.encKey[v+2],d=i[d>>>24]^s[c>>16&255]^a[h>>8&255]^u[255&y]^this.encKey[v+3],c=e,h=r,y=o,v+=4;for(w=0;w<4;w++)l[w]=n[c>>>24]<<24^n[h>>16&255]<<16^n[y>>8&255]<<8^n[255&d]^this.encKey[v++],e=c,c=h,h=y,y=d,d=e;return l},t.prototype.decrypt=function(t){for(var e,r,n,i=p(t),s=new Uint32Array(4),a=i[0]^this.decKey[0],u=i[3]^this.decKey[1],y=i[2]^this.decKey[2],d=i[1]^this.decKey[3],g=this.decKey.length/4-2,v=4,w=0;w<g;w++)e=f[a>>>24]^l[u>>16&255]^c[y>>8&255]^h[255&d]^this.decKey[v],r=f[u>>>24]^l[y>>16&255]^c[d>>8&255]^h[255&a]^this.decKey[v+1],n=f[y>>>24]^l[d>>16&255]^c[a>>8&255]^h[255&u]^this.decKey[v+2],d=f[d>>>24]^l[a>>16&255]^c[u>>8&255]^h[255&y]^this.decKey[v+3],a=e,u=r,y=n,v+=4;for(w=0;w<4;w++)s[3&-w]=o[a>>>24]<<24^o[u>>16&255]<<16^o[y>>8&255]<<8^o[255&d]^this.decKey[v++],e=a,a=u,u=y,y=d,d=e;return s},t}(),g=function(){function t(t,e,r){void 0===r&&(r=16),this.key=p(t),this.iv=p(e),this.cipher=new d(t),this.blockSize=r/4}return t.prototype.encrypt=function(t,e){for(var r=p(t),n=e||new Uint32Array(r.length),o=this.iv.subarray(this.blockSize,this.iv.length),i=this.iv.subarray(0,this.blockSize),s=new Uint32Array(this.blockSize),a=0;a<r.length;a+=this.blockSize){var u=r.subarray(a,a+this.blockSize);y(u,i,s);var f=this.cipher.encrypt(s);y(f,o),o=u,i=f;for(var l=a,c=0;l<r.length&&c<4;l++,c++)n[l]=f[c]}return n},t.prototype.decrypt=function(t,e){for(var r=p(t),n=e||new Uint32Array(r.length),o=this.iv.subarray(this.blockSize,this.iv.length),i=this.iv.subarray(0,this.blockSize),s=new Uint32Array(this.blockSize),a=0;a<n.length;a+=this.blockSize){var u=r.subarray(a,a+this.blockSize);y(u,o,s);var f=this.cipher.decrypt(s);y(f,i),i=u,o=f;for(var l=a,c=0;l<n.length&&c<4;l++,c++)n[l]=f
|
||
|
//# sourceMappingURL=592.d7ca037ed9b7d1c6792a.js.map
|