You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
8.6 KiB
1 line
8.6 KiB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.aesDecrypter=e()}}(function(){return function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[u]={exports:{}};t[u][0].call(c.exports,function(e){var n=t[u][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],n=e[1],r=t[4],i=n[4],o=void 0,u=void 0,s=void 0,a=[],f=[],c=void 0,l=void 0,d=void 0,y=void 0,p=void 0,v=void 0;for(o=0;256>o;o++)f[(a[o]=o<<1^283*(o>>7))^o]=o;for(u=s=0;!r[u];u^=c||1,s=f[s]||1)for(y=s^s<<1^s<<2^s<<3^s<<4,y=y>>8^255&y^99,r[u]=y,i[y]=u,d=a[l=a[c=a[u]]],v=16843009*d^65537*l^257*c^16843008*u,p=257*a[y]^16843008*y,o=0;4>o;o++)t[o][u]=p=p<<24^p>>>8,n[o][y]=v=v<<24^v>>>8;for(o=0;5>o;o++)t[o]=t[o].slice(0),n[o]=n[o].slice(0);return e},u=null,s=function(){function e(t){r(this,e),u||(u=o()),this._tables=[[u[0][0].slice(),u[0][1].slice(),u[0][2].slice(),u[0][3].slice(),u[0][4].slice()],[u[1][0].slice(),u[1][1].slice(),u[1][2].slice(),u[1][3].slice(),u[1][4].slice()]];var n=void 0,i=void 0,s=void 0,a=void 0,f=void 0,c=this._tables[0][4],l=this._tables[1],d=t.length,y=1;if(4!==d&&6!==d&&8!==d)throw new Error("Invalid aes key size");for(a=t.slice(0),f=[],this._key=[a,f],n=d;4*d+28>n;n++)s=a[n-1],(n%d===0||8===d&&n%d===4)&&(s=c[s>>>24]<<24^c[s>>16&255]<<16^c[s>>8&255]<<8^c[255&s],n%d===0&&(s=s<<8^s>>>24^y<<24,y=y<<1^283*(y>>7))),a[n]=a[n-d]^s;for(i=0;n;i++,n--)s=a[3&i?n:n-4],4>=n||4>i?f[i]=s:f[i]=l[0][c[s>>>24]]^l[1][c[s>>16&255]]^l[2][c[s>>8&255]]^l[3][c[255&s]]}return i(e,[{key:"decrypt",value:function(e,t,n,r,i,o){var u=this._key[1],s=e^u[0],a=r^u[1],f=n^u[2],c=t^u[3],l=void 0,d=void 0,y=void 0,p=u.length/4-2,v=void 0,h=4,b=this._tables[1],_=b[0],g=b[1],w=b[2],m=b[3],O=b[4];for(v=0;p>v;v++)l=_[s>>>24]^g[a>>16&255]^w[f>>8&255]^m[255&c]^u[h],d=_[a>>>24]^g[f>>16&255]^w[c>>8&255]^m[255&s]^u[h+1],y=_[f>>>24]^g[c>>16&255]^w[s>>8&255]^m[255&a]^u[h+2],c=_[c>>>24]^g[s>>16&255]^w[a>>8&255]^m[255&f]^u[h+3],h+=4,s=l,a=d,f=y;for(v=0;4>v;v++)i[(3&-v)+o]=O[s>>>24]<<24^O[a>>16&255]<<16^O[f>>8&255]<<8^O[255&c]^u[h++],l=s,s=a,a=f,f=c,c=l}}]),e}();n["default"]=s,t.exports=n["default"]},{}],2:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var i=e,o=t,u=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var a=s.get;if(void 0===a)return;return a.call(u)}var f=Object.getPrototypeOf(i);if(null===f)return;e=f,t=o,n=u,r=!0,s=f=void 0}},a=e("./stream"),f=r(a),c=function(e){function t(){i(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,f["default"]),this.jobs=[],this.delay=1,this.timeout_=null}return o(t,e),u(t,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}]),t}(f["default"]);n["default"]=c,t.exports=n["default"]},{"./stream":4}],3:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=e("./aes"),s=r(u),a=e("./async-stream"),f=r(a),c=e("pkcs7"),l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},d=function(e,t,n){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),i=new s["default"](Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),u=new Int32Array(o.buffer),a=void 0,f=void 0,c=void 0,d=void 0,y=void 0,p=void 0,v=void 0,h=void 0,b=void 0;for(a=n[0],f=n[1],c=n[2],d=n[3],b=0;b<r.length;b+=4)y=l(r[b]),p=l(r[b+1]),v=l(r[b+2]),h=l(r[b+3]),i.decrypt(y,p,v,h,u,b),u[b]=l(u[b]^a),u[b+1]=l(u[b+1]^f),u[b+2]=l(u[b+2]^c),u[b+3]=l(u[b+3]^d),a=y,f=p,c=v,d=h;return o};n.decrypt=d;var y=function(){function e(t,n,r,o){i(this,e);var u=e.STEP,s=new Int32Array(t.buffer),a=new Uint8Array(t.byteLength),d=0;for(this.asyncStream_=new f["default"],this.asyncStream_.push(this.decryptChunk_(s.subarray(d,d+u),n,r,a)),d=u;d<s.length;d+=u)r=new Uint32Array([l(s[d-4]),l(s[d-3]),l(s[d-2]),l(s[d-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(d,d+u),n,r,a));this.asyncStream_.push(function(){o(null,(0,c.unpad)(a))})}return o(e,[{key:"decryptChunk_",value:function(e,t,n,r){return function(){var i=d(e,t,n);r.set(i,e.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}]),e}();n.Decrypter=y,n["default"]={Decrypter:y,decrypt:d}},{"./aes":1,"./async-stream":2,pkcs7:6}],4:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e),this.listeners={}}return i(e,[{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"off",value:function(e,t){var n=void 0;return this.listeners[e]?(n=this.listeners[e].indexOf(t),this.listeners[e].splice(n,1),n>-1):!1}},{key:"trigger",value:function(e){var t=void 0,n=void 0,r=void 0,i=void 0;if(t=this.listeners[e])if(2===arguments.length)for(r=t.length,n=0;r>n;++n)t[n].call(this,arguments[1]);else for(i=Array.prototype.slice.call(arguments,1),r=t.length,n=0;r>n;++n)t[n].apply(this,i)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(e){this.on("data",function(t){e.push(t)})}}]),e}();n["default"]=o,t.exports=n["default"]},{}],5:[function(e,t,n){"use strict";var r;t.exports=function(e){var t=r[e.byteLength%16||0],n=new Uint8Array(e.byteLength+t.length);return n.set(e),n.set(t,e.byteLength),n},r=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]]},{}],6:[function(e,t,n){"use strict";n.pad=e("./pad.js"),n.unpad=e("./unpad.js")},{"./pad.js":5,"./unpad.js":7}],7:[function(e,t,n){"use strict";t.exports=function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}},{}],8:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./decrypter"),o=e("./async-stream"),u=r(o);n["default"]={decrypt:i.decrypt,Decrypter:i.Decrypter,AsyncStream:u["default"]},t.exports=n["default"]},{"./async-stream":2,"./decrypter":3}]},{},[8])(8)}); |