mirror of
https://github.com/planetrenox/inzerosight.git
synced 2026-03-17 19:21:02 +00:00
5 lines
11 KiB
JavaScript
5 lines
11 KiB
JavaScript
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))g(d);new MutationObserver(d=>{for(const b of d)if(b.type==="childList")for(const i of b.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&g(i)}).observe(document,{childList:!0,subtree:!0});function f(d){const b={};return d.integrity&&(b.integrity=d.integrity),d.referrerPolicy&&(b.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?b.credentials="include":d.crossOrigin==="anonymous"?b.credentials="omit":b.credentials="same-origin",b}function g(d){if(d.ep)return;d.ep=!0;const b=f(d);fetch(d.href,b)}})();const I={3:{unifier:"",0:"",1:"",2:""},6:{unifier:"",0:"",1:"",2:"",3:"",4:"",5:""},8:{unifier:"",0:"",1:"",2:"",3:"",4:"",5:"",6:"",7:"\uFEFF"},encodeString:(s,r=3)=>Array.from(s,f=>f.codePointAt(0).toString(r).split("").map(g=>I[r][g]).join("")).join(I[r].unifier),encodeNumberArray:(s,r=3)=>s.map(f=>f.toString(r).split("").map(g=>I[r][g]).join("")).join(I[r].unifier),decodeToString:(s,r=3)=>s.split(I[r].unifier).map(f=>String.fromCodePoint(parseInt(Array.from(f).map(g=>Object.keys(I[r]).find(d=>I[r][d]===g)).join(""),r))).join(""),decodeToNumberArray:(s,r=3)=>s.split(I[r].unifier).map(f=>parseInt(Array.from(f).map(g=>Object.keys(I[r]).find(d=>I[r][d]===g)).join(""),r))};function X(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var F,_;function J(){if(_)return F;_=1;function s(r={}){const f=r.bits||16,g=r.rounds||22,d=r.rightRotations||7,b=r.leftRotations||2,i=2**f,c=i-1,a=(o,t)=>o>>t|o<<f-t&c,y=(o,t)=>o<<t&c|o>>f-t,k=(o,t,e)=>(o=a(o,d),o=o+t&c,o^=e,t=y(t,b),t^=o,[o,t]),A=(o,t,e)=>(t^=o,t=a(t,b),o^=e,o=o-t&c,o=y(o,d),[o,t]);function w(o,t){let e=o[0],l=o[1],n=t[0],p=t.slice(1);[l,e]=k(l,e,n);for(let h=0;h<g-1;h++){const m=h%p.length;[p[m],n]=k(p[m],n,h),[l,e]=k(l,e,n)}return[e,l]}function E(o,t){let e=o[0],l=o[1],n=t[0],p=t.slice(1);for(let h=0;h<g-1;h++){const m=h%p.length;[p[m],n]=k(p[m],n,h)}for(let h=0;h<g;h++){const m=(g-2-h)%p.length;[l,e]=A(l,e,n),[p[m],n]=A(p[m],n,g-2-h)}return[e,l]}function u(o){return(t,e)=>{const l=o([t/i|0,t&c],e);return l[0]*i+l[1]}}return{encrypt:u(w),decrypt:u(E),encryptRaw:w,decryptRaw:E}}return F=s,F}var Q=J();const v=X(Q);var R,j;function L(){if(j)return R;j=1;const s="Input must be an string, Buffer or Uint8Array";function r(i){let c;if(i instanceof Uint8Array)c=i;else if(typeof i=="string")c=new TextEncoder().encode(i);else throw new Error(s);return c}function f(i){return Array.prototype.map.call(i,function(c){return(c<16?"0":"")+c.toString(16)}).join("")}function g(i){return(4294967296+i).toString(16).substring(1)}function d(i,c,a){let y=`
|
||
`+i+" = ";for(let k=0;k<c.length;k+=2){if(a===32)y+=g(c[k]).toUpperCase(),y+=" ",y+=g(c[k+1]).toUpperCase();else if(a===64)y+=g(c[k+1]).toUpperCase(),y+=g(c[k]).toUpperCase();else throw new Error("Invalid size "+a);k%6===4?y+=`
|
||
`+new Array(i.length+4).join(" "):k<c.length-2&&(y+=" ")}console.log(y)}function b(i,c,a){let y=new Date().getTime();const k=new Uint8Array(c);for(let w=0;w<c;w++)k[w]=w%256;const A=new Date().getTime();console.log("Generated random input in "+(A-y)+"ms"),y=A;for(let w=0;w<a;w++){const E=i(k),u=new Date().getTime(),o=u-y;y=u,console.log("Hashed in "+o+"ms: "+E.substring(0,20)+"..."),console.log(Math.round(c/(1<<20)/(o/1e3)*100)/100+" MB PER SECOND")}}return R={normalizeInput:r,toHex:f,debugPrint:d,testSpeed:b},R}var T,P;function W(){if(P)return T;P=1;const s=L();function r(e,l,n){const p=e[l]+e[n];let h=e[l+1]+e[n+1];p>=4294967296&&h++,e[l]=p,e[l+1]=h}function f(e,l,n,p){let h=e[l]+n;n<0&&(h+=4294967296);let m=e[l+1]+p;h>=4294967296&&m++,e[l]=h,e[l+1]=m}function g(e,l){return e[l]^e[l+1]<<8^e[l+2]<<16^e[l+3]<<24}function d(e,l,n,p,h,m){const z=y[h],V=y[h+1],Y=y[m],$=y[m+1];r(a,e,l),f(a,e,z,V);let U=a[p]^a[e],S=a[p+1]^a[e+1];a[p]=S,a[p+1]=U,r(a,n,p),U=a[l]^a[n],S=a[l+1]^a[n+1],a[l]=U>>>24^S<<8,a[l+1]=S>>>24^U<<8,r(a,e,l),f(a,e,Y,$),U=a[p]^a[e],S=a[p+1]^a[e+1],a[p]=U>>>16^S<<16,a[p+1]=S>>>16^U<<16,r(a,n,p),U=a[l]^a[n],S=a[l+1]^a[n+1],a[l]=S>>>31^U<<1,a[l+1]=U>>>31^S<<1}const b=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],c=new Uint8Array(i.map(function(e){return e*2})),a=new Uint32Array(32),y=new Uint32Array(32);function k(e,l){let n=0;for(n=0;n<16;n++)a[n]=e.h[n],a[n+16]=b[n];for(a[24]=a[24]^e.t,a[25]=a[25]^e.t/4294967296,l&&(a[28]=~a[28],a[29]=~a[29]),n=0;n<32;n++)y[n]=g(e.b,4*n);for(n=0;n<12;n++)d(0,8,16,24,c[n*16+0],c[n*16+1]),d(2,10,18,26,c[n*16+2],c[n*16+3]),d(4,12,20,28,c[n*16+4],c[n*16+5]),d(6,14,22,30,c[n*16+6],c[n*16+7]),d(0,10,20,30,c[n*16+8],c[n*16+9]),d(2,12,22,24,c[n*16+10],c[n*16+11]),d(4,14,16,26,c[n*16+12],c[n*16+13]),d(6,8,18,28,c[n*16+14],c[n*16+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^a[n]^a[n+16]}const A=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function w(e,l,n,p){if(e===0||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(l&&l.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&n.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(p&&p.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const h={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};A.fill(0),A[0]=e,l&&(A[1]=l.length),A[2]=1,A[3]=1,n&&A.set(n,32),p&&A.set(p,48);for(let m=0;m<16;m++)h.h[m]=b[m]^g(A,m*4);return l&&(E(h,l),h.c=128),h}function E(e,l){for(let n=0;n<l.length;n++)e.c===128&&(e.t+=e.c,k(e,!1),e.c=0),e.b[e.c++]=l[n]}function u(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;k(e,!0);const l=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)l[n]=e.h[n>>2]>>8*(n&3);return l}function o(e,l,n,p,h){n=n||64,e=s.normalizeInput(e),p&&(p=s.normalizeInput(p)),h&&(h=s.normalizeInput(h));const m=w(n,l,p,h);return E(m,e),u(m)}function t(e,l,n,p,h){const m=o(e,l,n,p,h);return s.toHex(m)}return T={blake2b:o,blake2bHex:t,blake2bInit:w,blake2bUpdate:E,blake2bFinal:u},T}var C,D;function Z(){if(D)return C;D=1;const s=L();function r(u,o){return u[o]^u[o+1]<<8^u[o+2]<<16^u[o+3]<<24}function f(u,o,t,e,l,n){i[u]=i[u]+i[o]+l,i[e]=g(i[e]^i[u],16),i[t]=i[t]+i[e],i[o]=g(i[o]^i[t],12),i[u]=i[u]+i[o]+n,i[e]=g(i[e]^i[u],8),i[t]=i[t]+i[e],i[o]=g(i[o]^i[t],7)}function g(u,o){return u>>>o^u<<32-o}const d=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),b=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),i=new Uint32Array(16),c=new Uint32Array(16);function a(u,o){let t=0;for(t=0;t<8;t++)i[t]=u.h[t],i[t+8]=d[t];for(i[12]^=u.t,i[13]^=u.t/4294967296,o&&(i[14]=~i[14]),t=0;t<16;t++)c[t]=r(u.b,4*t);for(t=0;t<10;t++)f(0,4,8,12,c[b[t*16+0]],c[b[t*16+1]]),f(1,5,9,13,c[b[t*16+2]],c[b[t*16+3]]),f(2,6,10,14,c[b[t*16+4]],c[b[t*16+5]]),f(3,7,11,15,c[b[t*16+6]],c[b[t*16+7]]),f(0,5,10,15,c[b[t*16+8]],c[b[t*16+9]]),f(1,6,11,12,c[b[t*16+10]],c[b[t*16+11]]),f(2,7,8,13,c[b[t*16+12]],c[b[t*16+13]]),f(3,4,9,14,c[b[t*16+14]],c[b[t*16+15]]);for(t=0;t<8;t++)u.h[t]^=i[t]^i[t+8]}function y(u,o){if(!(u>0&&u<=32))throw new Error("Incorrect output length, should be in [1, 32]");const t=o?o.length:0;if(o&&!(t>0&&t<=32))throw new Error("Incorrect key length, should be in [1, 32]");const e={h:new Uint32Array(d),b:new Uint8Array(64),c:0,t:0,outlen:u};return e.h[0]^=16842752^t<<8^u,t>0&&(k(e,o),e.c=64),e}function k(u,o){for(let t=0;t<o.length;t++)u.c===64&&(u.t+=u.c,a(u,!1),u.c=0),u.b[u.c++]=o[t]}function A(u){for(u.t+=u.c;u.c<64;)u.b[u.c++]=0;a(u,!0);const o=new Uint8Array(u.outlen);for(let t=0;t<u.outlen;t++)o[t]=u.h[t>>2]>>8*(t&3)&255;return o}function w(u,o,t){t=t||32,u=s.normalizeInput(u);const e=y(t,o);return k(e,u),A(e)}function E(u,o,t){const e=w(u,o,t);return s.toHex(e)}return C={blake2s:w,blake2sHex:E,blake2sInit:y,blake2sUpdate:k,blake2sFinal:A},C}var O,H;function ee(){if(H)return O;H=1;const s=W(),r=Z();return O={blake2b:s.blake2b,blake2bHex:s.blake2bHex,blake2bInit:s.blake2bInit,blake2bUpdate:s.blake2bUpdate,blake2bFinal:s.blake2bFinal,blake2s:r.blake2s,blake2sHex:r.blake2sHex,blake2sInit:r.blake2sInit,blake2sUpdate:r.blake2sUpdate,blake2sFinal:r.blake2sFinal},O}var M=ee();const q=v({bits:24,rounds:23,rightRotations:8,leftRotations:3});function N(s){const r=M.blake2bHex(s,null,12);return[parseInt(r.slice(0,6),16),parseInt(r.slice(6,12),16),parseInt(r.slice(12,18),16),parseInt(r.slice(18,24),16)]}function te(s,r){const f=globalThis.crypto.getRandomValues(new Uint32Array(1))[0]&16777215,g=Array.from(s,(d,b)=>{const i=f*16777216+(b&16777215),c=q.encrypt(i,r);return(d.codePointAt(0)^c)>>>0});return[f,...g]}function ne(s,r){if(!s||s.length===0)return"";const f=s[0];return s.slice(1).map((d,b)=>{const i=f*16777216+(b&16777215),c=q.encrypt(i,r),a=(d^c)>>>0;try{return String.fromCodePoint(a)}catch{return""}}).join("")}const G=v();function x(s){const r=M.blake2bHex(s,null,8);return[parseInt(r.slice(0,4),16),parseInt(r.slice(4,8),16),parseInt(r.slice(8,12),16),parseInt(r.slice(12,16),16)]}function re(s,r){return Array.from(s,f=>G.encrypt(f.codePointAt(0),r))}function oe(s,r){return s.map(f=>{try{return String.fromCodePoint(G.decrypt(f,r))}catch{return""}}).join("")}const B=document.getElementById("textarea"),ie=document.getElementById("encoder"),ce=document.getElementById("cipher");document.getElementById("encodeButton").addEventListener("click",K);document.getElementById("decodeButton").addEventListener("click",K);function K(s){if(B.value===""){B.value="The text box is empty.";return}const r=s.target.id==="encodeButton"?"NO":"YES",f=se(),g=ie.value.split("-")[1],d=f!=="PLAIN",b=d&&prompt("enter password.");if(!(d&&!b)){try{B.value=le[r][f](B.value,g,b)}catch(i){console.log(i)}r==="NO"&&(B.select(),document.execCommand("copy"),B.value=`Copied to your clipboard.
|
||
A copy has been placed between these brackets [`+B.value+"]")}}function se(){return ce.value}const le={NO:{PLAIN:(s,r)=>I.encodeString(s,r),SPECK48_96CTR:(s,r,f)=>I.encodeNumberArray(te(s,N(f)),r),"SPECK32_64ECB (insecure)":(s,r,f)=>I.encodeNumberArray(re(s,x(f)),r)},YES:{PLAIN:(s,r)=>I.decodeToString(s,r),SPECK48_96CTR:(s,r,f)=>ne(I.decodeToNumberArray(s,r),N(f)),"SPECK32_64ECB (insecure)":(s,r,f)=>oe(I.decodeToNumberArray(s,r),x(f))}};
|