UNPKG

@material-ui/x-license

Version:
2 lines (1 loc) 2.11 kB
"use strict";const r=[];let e=0;for(;e<64;)r[e]=0|4294967296*Math.sin(++e%Math.PI);function t(t){const o=[];let n,a,c,h=unescape(encodeURI(t))+"€",C=h.length;const f=[n=1732584193,a=4023233417,~n,~a];for(t=--C/4+2|15,o[--t]=8*C;~C;)o[C>>2]|=h.charCodeAt(C)<<8*C--;for(e=h=0;e<t;e+=16){for(C=f;h<64;C=[c=C[3],n+((c=C[0]+[n&a|~n&c,c&n|~c&a,n^a^c,a^(n|~c)][C=h>>4]+r[h]+~~o[e|15&[h,5*h+1,3*h+5,7*h][C]])<<(C=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*C+h++%4])|c>>>-C),n,a])n=0|C[1],a=C[2];for(h=4;h;)f[--h]+=C[h]}for(t="";h<32;)t+=(f[h>>3]>>4*(1^h++)&15).toString(16);return t}const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";const n=r=>{let e,t,n,a,c,h,C,f="",d=0;for(r=function(r){r=r.replace(/\r\n/g,"\n");let e="";for(let t=0;t<r.length;t++){const o=r.charCodeAt(t);o<128?e+=String.fromCharCode(o):o>127&&o<2048?(e+=String.fromCharCode(o>>6|192),e+=String.fromCharCode(63&o|128)):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128),e+=String.fromCharCode(63&o|128))}return e}(r);d<r.length;)e=r.charCodeAt(d++),t=r.charCodeAt(d++),n=r.charCodeAt(d++),a=e>>2,c=(3&e)<<4|t>>4,h=(15&t)<<2|n>>6,C=63&n,isNaN(t)?h=C=64:isNaN(n)&&(C=64),f=f+o.charAt(a)+o.charAt(c)+o.charAt(h)+o.charAt(C);return f};exports.base64Decode=r=>{let e,t,n,a,c,h,C,f="",d=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<r.length;)a=o.indexOf(r.charAt(d++)),c=o.indexOf(r.charAt(d++)),h=o.indexOf(r.charAt(d++)),C=o.indexOf(r.charAt(d++)),e=a<<2|c>>4,t=(15&c)<<4|h>>2,n=(3&h)<<6|C,f+=String.fromCharCode(e),64!=h&&(f+=String.fromCharCode(t)),64!=C&&(f+=String.fromCharCode(n));return f=function(r){let e,t,o,n="",a=0;for(e=t=o=0;a<r.length;)e=r.charCodeAt(a),e<128?(n+=String.fromCharCode(e),a++):e>191&&e<224?(t=r.charCodeAt(a+1),n+=String.fromCharCode((31&e)<<6|63&t),a+=2):(t=r.charCodeAt(a+1),o=r.charCodeAt(a+2),n+=String.fromCharCode((15&e)<<12|(63&t)<<6|63&o),a+=3);return n}(f),f},exports.base64Encode=n,exports.generateLicence=function(r){const e=function(r){return`ORDER:${r.orderNumber},EXPIRY=${r.expiryDate.getTime()},KEYVERSION=1`}(r);return`${t(n(e))}${n(e)}`},exports.md5=t;